Wednesday, 3 January 2007

Reflection Without Raytracing

Further to my recent IBL experience, I decided to write a simple texture-based 'surface' shader for use in situations where reflection is desired - A common work-around due to the expensive nature of raytracing...

/* Simple environment-mapping shader */

surface
envmap(float Ka = 1,
Kd = 1,
intensity = 1.0;
string texturename = "";
float blur = 0.01;)
{
point Nf = faceforward (normalize(N),I);

if (texturename != "")
{
Oi = Os;
Ci = Os * Cs * (Ka * ambient() + Kd * diffuse(Nf)) * (intensity * color environment(texturename, Nf, "blur", blur));
}
else
{
Oi = Os;
Ci = Os * Cs * (Ka * ambient() + Kd * diffuse(Nf));
}
}



While not perfect, as before, the result is reasonable (for my needs) and does offer a good foundation for me to build upon as my knowledge improves.

For fun, I added our existing 'envlight' shader to the scene to provide some AO goodness - Spot the difference...

Welcome

This blog represents a common area where we can share ideas, thoughts and other verbose information with others - While giving a little more insight into the inner workings/minds of our team.

Though there might be overlap in places, the content here differs from that of the main Aqsis website and is intended to be complimentary while still acting as a useful resource for those interested in the world of 3D graphics and rendering.

So... sit back, relax, and have fun... we will !!! ;-)