0
\$\begingroup\$

The pixel color component read from the Unity renderTexture is bigger than 1.0 without HDR environment map.

I'm writing a mini program to test the reflectance of Unity PBS. I use six pure white (1,1,1,1) textures to construct a skybox as a GI source. Then I set a plane with Unity standard shader material and camera. In every frame, I change the material arguments (albedo, metallic, smoothness), and get the pixel color at the center of view.

The light source I use is not bigger than 1.0 (pure white skybox, not a HDR texture). So, why is the pixel color (as reflectance) is bigger than 1? I think it supposed to be less than 1.0. The biggest data I get is near to 5. Actually, if I use the color picker to check the color from screen, the color data is never bigger than 1.0.

Here's my code:

// code in OnPostRender()

Texture2D image = new Texture2D(2, 2, TextureFormat.RGBAFloat, false, true);
// only read the center four pixels
image.ReadPixels(new Rect(renderWidth/2, renderHeight/2, 2, 2), 0, 0);

Color a = new Color();
a = image.GetPixel(0, 0);
b = image.GetPixel(1, 0);
c = image.GetPixel(0, 1);
d = image.GetPixel(1, 1);
// average the four pixels to get the exact center color
return (a.r+b.r+c.r+d.r)/4.0f;
```
\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

With GI, every side of the skybox acts as a separate light source. You have 6 lightsources with a strength of 1 each. One of them is behind the object. So measuring a brightness of up to 5.0 is expected.

Your monitor can't display more brightness than 1, so that's what the value you measure with the color picker tool is clamped at.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .