Friday, 15 June 2012

opengl - How to evade color stripes -


There is 32bit float per channel "unsigned byte" per channel coloration normalization to save some PCI express bandwidth. other things. Sometimes there may be stripes of colors and they look unnatural.

How can I avoid it? Especially on the edge of the areas.

Float color channel: Enter image details here

Unwanted Byte channel: Enter image details here

Here, yellow border blue area and red color But should not exist on the blue edge.

Generalization I used (from the opencl kernel):

Multiplying with code

R = rsqrt (pixel0.x * pixel0.x + pixel0.y * pixel0.y + pixel0.z * pixel0.z + 0.001f); Unsigned four RGB 0 = (unsigned char) (pixel 0 x * 255.0); Unsigned four RGB 1 = (unsigned char) (pixel 0 y * 255.0); Unsigned four RGB 2 = (unsigned char) (pixel 0. Z * 255.0); Rgba_byte [i * 4 + 0] = rgb0 & gt; 255 255: rgb0; Rgba_byte [i * 4 + 1] = rgb1 & gt; 255 255: rgb1; Rgba_byte [i * 4 + 2] = rgb2 & gt; 255 255: rgb2; Rgba_byte [i * 4 + 3] = 255;

Compulsion to buffer:

  GL11.glEnableClientState (GL11.GL_COLOR_ARRAY); GL15.glBindBuffer (GL15.GL_ARRAY_BUFFER, ID); GL11.glColorPointer (4, GL11.GL_UNSIGNED_BYTE, 4, 0); Using the lwjgl (glfw reference) in the Java environment  

As Andon M. Said, I clamped before casting (I could not see when I nneded heavy sleep) and it solved.

Color quality is not good on the way, but using small color buffer has helped the display.

Enter image details here

< Floating-point values ​​in your original data set are generalized [ 0.0 , 1.0 ] outside of the bounded range,

, Which multiplies by 255.0 and casting unsigned char generates overflow. The scene you experienced that is in the areas of the scene is extraordinary bright in one or more color components.

It looks like when you rgb0> 255? 255: rgb0 , then this argument will not work, because when it <<>> unsigned char overflow it instead of a number greater than 255 0 .

& nbsp; & Nbsp; & Nbsp; It should be a minimal solution, clamp floating-point colors into static-point 0.8 (before converting to 8) [ 0.0 , 1.0 ] & Nbsp; & Nbsp; & Nbsp; Dangerous generalized) to avoid color, overflow.

However, if this is a continuous problem, you can do better than implementing the HDR after the process of implementing the LDR. You will identify bright pixels in some area (or all) of your area and then assuming that all the colors in that range are normal, you were implementing it to start ( r = sqrt (...) < / Code>), but it was only using the magnitude of the current pixel to normalize the color.


No comments:

Post a Comment