Happycake Development Notes:
28 August 2004

Since I'd been working on graphics stuff with the shadows, I decided it was time to add a couple of other graphics features that'd been on the slate for a while.  First was adjustable materials.  Materials are referenced by name (e.g. "shiny_metal") and are stored in files that get hotloaded, so you can tweak them and see the updates live in the engine.  So far there are just five parameters per material: ambient albedo, diffuse albedo, specular albedo, specular power, and specular metalness (which controls the color of the specular highlight).  Certainly I could have gone all-out and done more (Fresnel, anisotropic BRDFs, whatever).  But the focus of this project isn't on graphics, so I stopped at these 5 parameters, which was a sweet spot of Good Benefit for Not Too Much Work.

Here's an example of 4 barrels that have the same color texture but 4 different materials:


The banding on the barrels is there because my procedural cylinder generator doesn't want to do shared vertex normals right now.  Yeah, it sort of ruins the effect.  When we start importing artist-created models, it'll look a lot nicer.

In this next shot you can see the difference in materials between the pavement runway-ish thing and the rail beside it.  The rail has a metal-ish material parameters so the specular highlight results in color amplification of that surface per pixel.  The surface next to it has a non-metal-ish setting, and a different specular power, so we get this broader white shininess across it.  (This stuff can be hard to see from still images like this, but compare the walkway to the picture above to see the difference the specularity makes).

The other thing I added was dual-hemisphere ambient lighting.  Instead of a constant, objects get lit by blue from the top, brownish-red from the bottom, and a gradient in between.  Atman and I were generally talking about a plan to use an environment cube map to do ambient illumination as well as reflective surfaces, but just in case we didn't get to that any time soon, I wanted to put this in.

You can see it in action on the barrels in the above picture; here's a close-up:


The brown-ness on the bottom is the effect of the ambient.  It's pretty heavily overstated right now; I imagine I'll turn it down.

Sensitive tuning of parameters like that probably won't happen for a little while.  Supposedly this engine is all-HDR, except that we're not actually using HDR-scaled lighting coefficients right now, because we often need to run in 8-bits-per-channel so that blending will work on our development hardware.  And if you try to use HDR-scale constants with an 8-bit frame buffer, you find that a whole lot of stuff gets quantized down to nothing or saturated to white.  It's not a fun situation.  Maybe at some point I will figure out the right values for an appropriate HDR scale, and then put in some hack factors to convert those silently when we run in 8-bit.  Hmmm....

[Back to Happycake development log]