Closed tigrazone closed 1 year ago
Does the web link above the dither function answer your question? https://github.com/nvpro-samples/vk_raytrace/blob/master/shaders/post.frag#L46
No. I asked about "Remove banding" code, not only about dithering
The dither code is to remove banding. This is more visible with the "Sun & Sky" environment. If Dither is active, those banding are less visible, even in the first frames.
thank you. if "sun&sky" not used dither is not usable?
The remove banding code is using dithering to make color changes less visible. The two lines above the dither() are just calculating the necessary noise and quantization arguments for that function. If you look at the definitions of the pcg3d() function, that is a linear congruential generator which calculates some noise into the uvec3 components, and the uintBitsToFloat() is using that pseudo random value to calculate a float value by directly putting bits into the mantissa of the IEEE 754 32-bit floating point format (1 sign, 8 exponent, 23 mantissa bits). The hex value 0x3f800000 is float 1.0f and ORing bits into the lower 23 bits will build a random number in the range of [1.0f, 2.0f) and the minus 1.0f shifts it into the range [0.0f, 1.0f) which is usually the required range for random values.
is this code did not make monte-carlo convergence worse?
The dither code is to remove banding. This is more visible with the "Sun & Sky" environment. If Dither is active, those banding are less visible, even in the first frames.
there is no "Dither" checkbox in code
I have added the 'Dither' checkbox locally to quickly toggle its contribution. This functionality will be added soon, in a future update.
-mkl
On Tue, Nov 21, 2023 at 12:57 PM Dmytro @.***> wrote:
The dither code is to remove banding. This is more visible with the "Sun & Sky" environment. If Dither is active, those banding are less visible, even in the first frames. [image: image] https://user-images.githubusercontent.com/38076163/284561419-88ebfb4b-4cf0-417b-8712-a1721cce9d65.png
there is no "Dither" checkbox in code [image: image] https://user-images.githubusercontent.com/3808839/284570249-6e3cf0f1-0a0c-4db6-8556-8d184e745032.png
— Reply to this email directly, view it on GitHub https://github.com/nvpro-samples/vk_raytrace/issues/26#issuecomment-1820779780, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCP6A65SR5WAU4D23K2U5TYFSJKJAVCNFSM6AAAAAA7TPJVZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQG43TSNZYGA . You are receiving this because you commented.Message ID: @.***>
is this code did not make monte-carlo convergence worse?
The dither is integrated into the post-processing stage, where it adjusts colors similar to the tonemapper. However, it should be noted that it operates independently of the Monte-Carlo convergence computation.
Please explain how "Remove banding" from shaders/post.frag works: // Remove banding uvec3 r = pcg3d(uvec3(gl_FragCoord.xy, 0)); vec3 noise = uintBitsToFloat(0x3f800000 | (r >> 9)) - 1.0f; color = dither(sRGBToLinear(color), noise, 1. / 255.);
and give please example file to check this code. I dont see differencies in many scenes