Sign in to follow this  
Quat

ndotL environment mapping?

Recommended Posts

I've been reworking my lighting shaders for physically based rendering.

 

Real-Time rendering 3rd edition scales specular reflection by nDotL (page 269), which makes sense that nDotL should apply to both diffuse and specular. 

 

Therefore, should I also scale the light from environment mapping (to do specular reflections) by nDotL as well?  Seems like I should since environment mapping reflections are basically the same thing as light source specular reflections.  However, I couldn't find a mention in Real-Time rendering of this.

 

 

Share this post


Link to post
Share on other sites

The idea here is twofold :

1) there is a tradeoff between diffuse & specular reflected energy.  more diffuse reflections mean less energy available for specular and vice versa.  

2) when N dot L is zero, N.H ( or R.L ) should be zero too

Share this post


Link to post
Share on other sites

The N dot L factor only applies if you are performing a convolution on the environment map (i.e. considering each texel in the cube map as its own lightsource)
If you are using the environment map as a light source, it is generally assumed that this step is already done.

If you did an N dot L from  a specific light source, then suddenly you would be losing a light from every direction except that light source...

Share this post


Link to post
Share on other sites


1) there is a tradeoff between diffuse & specular reflected energy.  more diffuse reflections mean less energy available for specular and vice versa. 

 

Right.  The incoming light is scaled by ndotL because the light gets spread over a different area based on the angle between n and L.  Some of that light will get specularly reflected based on Fresnel, and the remaining will undergo diffuse reflection.  

 

For specular reflections, there is a light ray coming from the reflected direction r (the color sampled from the cube map).  Shouldn't this also be scaled by ndotL as the light gets spread over a different area based on the angle between n and L? 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this