Archive for the ‘shader’ tag
Pixelation Effect
I recently “borrowed” a pixelation effect posted some time ago by compsci89 to the Irrlicht forums. While it seems counter-intuitive on some level to write an effect that intentionally reduces pixel resolution and color depth, I like the effect:
The effect, modified from the original form to do non-uniform color reduction and a mix of pixelation and actual value, is now in the LxEngine code base and used in the work-in-progress Tutorial 5 code.
It does make me feel good about the state of LxEngine that adding a straightforward effect like this took about 2 minutes.
Light Color Gradients
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).
Screenshot
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.
Lithosphere Terrain Generator
From the author of the blog over at CodeFlow, here’s a video of a fantastic shader-graph based procedural terrain generator. It’s GPU driven via OpenGL fragment shaders – and while it’s a resource hog, the terrains can be imported and exported in static form:
Thanks to FreeGamer for the link.
The project description on CodeFlow is located here, which includes the source code, documentation, additional screenshots, etc. The author, Florian Bösch, appears to do some high-quality work. He provides his LinkedIn page, if you want to know more about the author himself.
This impressive work really sets a new standard after my recent, low-expertise experiments with heightmaps in Blender. Wow. I’ve always been interested in the idea of having LxEngine content be driven by procedurally generated content as much as possible; the above video is a good reminder of the potential behind that idea.

