More bugfixing, specular effects in cel shading

· by Steve · Read in about 2 min · (270 Words)

This morning I discovered that I hadn’t quite finished the cel shading demo; specular parameters were not quite working properly and it took me a long time to figure out what it was - turns out there was a parameter binding bug still outstanding which was the cause of the problems. Unfortunately because I thought it might be my vertex or fragment program, I spent a lot of time tinkering with those, and because I was working in Cg, doing certain things changed the way the assembler was produced which often turned on or off the case under which the parameter bug would show up, so the underlying cause was a slippery customer. In the end I switched to using assembler programs only just for diagnostic purposes, which is how I tracked it down finally. Much swearing was done, but I learned something out of the process anyway, not least of which was how to write ps_1_x by hand.

Now that’s done (and I’ve uploaded another screenshot showing the sharper specular effects that are now possible using the cel shader to the Ogre web site), I’m moving on to revamping the Dot3 bump mapping demo to use vertex and fragment programs. For that, I’m going to try to keep a fallback for cards which don’t support fragment programs, although vertex program support will be mandatory since otherwise the tangent space light vectors have to be calculated on the CPU, which is very expensive. I also hope to make it a little more sexy looking since the old version was nice, but didn’t really show off the effect to it’s best.