# Enviroment lighting

## Recommended Posts

When lighting a mesh with an outdoor enviroment map(cubemap), in the past Ive lit the object with a blend between a directional light with both specular and diffuse components, and the the reflection colour from the cube map.

out = lerp( ( SunDiffuse + SunSpecular ), CubeMapReflectionColour, Weight );

Which generally gives nice results, but only works with shiny objects, as the cubemap reflection is always a perfect reflection no matter how low the weighting is. I'm thinking that a way for dull diffuse objects like wood would be to treat the map like an actual light.

Out = CubeMapDiffuse + CubeMapSpecular; // Scattered light
Out = SunDiffuse + SunSpecular; // Direct light

Where CubeMapSpecular is a perfect refletion colour from the ennviroment map and both CubeMapSpecular and SunSpecular would be very low values for something like wood.

But the question arises how to compute CubeMapDiffuse? For this I really would need a blurred out copy of the enviroment map to simulate the diffuse reflected light within the enviroment.

Rather than keeping two copies of the enviroment map, one for diffuse(blurred) and one for specular(no changes), I was thinking of just using a low resolution mip map level for diffuse and high res for specular. Any other suggestions?

##### Share on other sites
Yes. diffuse enviroment map can be much in lower resolution.
But. mip map "burring" dont use same sort of filter as diffuse calculation neads.
So Its better to use separate low resolution cube map for diffuse enviroment light. (some 64x64 x6 is good for capturing enviroment, and mem usage is minimal)

look HDR shop (version 1 has free version)

/Tyrian

##### Share on other sites
If you want to use a cube map to approximate diffuse, I would suggest using CubeMapGen to generate a low-res version of your environment map using a cosine filter.

## 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