You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a major but common mistake which makes all the images look wrong. The images are naturally calculated using linear light values but saved as 8-bit sRGB values without any correct conversion from linear values to sRGB (gamma compressed) values. Here's how it should look once that problem is fixed:
This is quite radically different, and you can now see how the beams that cross into the shadows appear as bright as they should. The way to do it is to replace this: p[0] = p[1] = p[2] = (int)(fminf(sample((float)x / W, (float)y / H) * 255.0f, 255.0f));
with this: p[0] = p[1] = p[2] = (int)(255. * lsrgb(fminf(sample((float)x / W, (float)y / H), 1.f)));
and add somewhere a function lsrgb that does this:
double lsrgb(double linear) // converts a [0.0, 1.0] linear value into a [0.0, 1.0] sRGB value
{
if (linear <= 0.0031308)
return linear * 12.92;
else
return 1.055 * pow(linear, 1.0/2.4) - 0.055;
}
Btw in the image above I also added Gaussian antialiasing which is achieved by adding a Gaussian jitter in the sample() function to x and y independently.
The text was updated successfully, but these errors were encountered:
The default way a PNG is interpreted is sRGB. Besides you really wouldn't want an 8-bit linear image, you would see tons of banding in the darks, as if there were about only 4 bits,
There's a major but common mistake which makes all the images look wrong. The images are naturally calculated using linear light values but saved as 8-bit sRGB values without any correct conversion from linear values to sRGB (gamma compressed) values. Here's how it should look once that problem is fixed:
This is quite radically different, and you can now see how the beams that cross into the shadows appear as bright as they should. The way to do it is to replace this:
p[0] = p[1] = p[2] = (int)(fminf(sample((float)x / W, (float)y / H) * 255.0f, 255.0f));
with this:
p[0] = p[1] = p[2] = (int)(255. * lsrgb(fminf(sample((float)x / W, (float)y / H), 1.f)));
and add somewhere a function
lsrgb
that does this:Btw in the image above I also added Gaussian antialiasing which is achieved by adding a Gaussian jitter in the
sample()
function tox
andy
independently.The text was updated successfully, but these errors were encountered: