Sign in to follow this  
thallish

Lighting questions

Recommended Posts

Ok I am trying to understand some radiometry terms to get the lighting in my demo correct. First of all is doing a diffuse convolution of an image equal to creating an irradiance map? I am using HDRShop and I creating a diffuse convolution of the image I use as a sky to light my terrain, or rather I have two different maps. I am creating two different images to use for ambient and diffuse lighting. First I take my image and mask out the sun, and do a diffuse convolution on the it. This is used as a lighting intensity in the ambient component of my Phong lighting model. This way the ambient component correctly represent the light from the sky. I then get the fraction of the reflected light and divide by PI to get the reflected radiance.
// calculate ambient lighting contribution
// look up sky irradiance in sky irradiance map
float3 realAmb = texCUBE( SkyIrradianceMapSampler, normal ) ; 
	
// divide by PI to get radiance
float3 amb = ( albedo * realAmb ) / PI;
Next I create an image with only the sun in it. I now do a diffuse convolution on it and end up with a term I can use as the intensity of the light in the diffuse component of the Phong lighting model. This way the sun is modeled correctly. I add the normal from my bumpmap to the face normal and look up in the diffuse convoluted (irradiance?) map, get the fraction of reflected light and divide by PI to get the outgoing radiance.
// get bump normal
float3 bumpNormal = tex2D( SurfaceNormalMapSampler, tex );
	
// calculate the diffuse lighting contribution
// by retrieving the irradiance from the sun irradiance map
// divide by PI to get radiance 
float diff = ( albedo * texCUBE( SunIrradianceMapSampler, normalize( bumpNormal + normal ) ) ) / PI;
Is this the correct approach?

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