« 3d power texture lookup
» ICE point distributions on surfaces

python-ogre

ambient cube CG realtime shader

01.06.09 | 5 Comments

I added a more complex ambient term to my base CG realtime shader.

boxbot2_ambientcube

Classically, a basic shading model will contain a diffuse and ambient term, and usually a specular term. After implementing a soft texture-mapped shadow-catching function in my CG shader, i really missed having some dynamic modeling of light going on in the ambient end of the shader.

I use a classic technique of offline 3d rendering to add interest to my ambient term - sampling an ambient environment map.

Using the shading normal, I cast an environment lookup into a cube map, mapped with a simple sky-blue-to-earth-orange gradient.

The shader finally multiplies the ambient term by a baked ambient occlusion map.

In the fragment shader, the lookup is done like this:


float3 ambCube = texCUBE(ambientCubeMap, IN.nm ).xyz;

where IN.nm is the (object space) normal passed in from the vertex shader output struct.

Here is a vimeo of the ambient cube lookup in action:

ambient cube realtime CG shader from benp on Vimeo.

The ambient occlusion map was baked in xsi, through mentalray.

The model was made in xsi.

The realtime display uses python-ogre to import the model, apply the CG shader, and take mouse input for interaction.

The video was captured with fraps.

Tags: , , , , ,

5 Comments

Leave a Reply to Steven Caron

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">


« 3d power texture lookup
» ICE point distributions on surfaces