Archive for the ‘science’ tag
In addition to the clean-up work of late, I modified the LxEngine ray tracing sample to support multiple types of materials (i.e. surface shaders).
The general implementation is not complex as it essentially only meant changing the shade() function to be a virtual method on the Material object and allowing multiple sub-classes of the object. However, the actual shaders are a bit more interesting:
The yellow sphere in the back is a simple, standard Phong-Blinn shader (as used previously). The multi-colored sphere to the right of the yellow sphere is shaded using the abs() of the intersection normal as the color (i.e. useful for visual debugging).
Light Color Gradients
The actually interesting shaders are the final two spheres. They are both based on the very simple, but nonetheless useful idea presented in Bioware’s 2011 GDC presentation “Cinematic Character Lighting in STAR WARS: THE OLD REPUBLIC” called “Light Color Gradients”.
What’s a “light color gradient”?
Very simple: instead of computing a diffuse color via “N dot L” times the diffuse lighting, do a 1d texture sample on a gradient texture based on (N dot L + 1) / 2. That’s all.
Again, no complex math. Not photorealistic. But this doesn’t prevent the results from be visually appealing. A good reminder that computer graphics can be an art as well as a science.