Jump to content
  • Advertisement
Sign in to follow this  

Lighting questions

This topic is 4124 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!