Wednesday, October 19, 2005

Back to HLSL Shaders

After taking a break for a few months to learn some MaxScripting, I've jumped back into shader writing. So far I've mainly been focusing my efforts on figuring out the best and least expensive way to do normal mapping in shaders written to work in the viewport of Max 8.

Up until now I've been using the vertex shader to put all the vectors in tangent space. Doing all of the lighting calculation in tangent space worked pretty well for Max 7, but when I was beta testing Max 8 I found that the tangent space lighting was causing some very strange lighting artifacts to show up around UV borders. After seeing this, I went back to Max 7 and realised that the same artifacts were there in 7 as well - just not as prominent. I have no idea what was causing these artifacts, but I posted them as a bug. I don't know if the issue was fixed since I haven't gotten my copy of the final version of Max 8 yet.

Anyway, to get around the problem, I'm now converting all of my normal map shaders so that they do their lighting in world space. This seems to be working very well. Putting vectors in world space is much cheaper for the vertex shader, and the lighting annomalies that I saw with my previous tangent space lighting are gone. Of course, the offset mapping shader has to stay the way that it was since offset mapping requires that the view vector be in tangent space.

I was excited to see that the problem I posted before with the normal map seams at UV borders is fixed in Max 8. Nice! They've also solved the UV mirroring problem, so now you can have mirrored UVs and the normals all work correctly. Max 8 will be very nice to work with because of these fixes.

I plan on posting the newer versions of my normal mapping shaders soon as well as some additional shaders that I've been working on.

Since I'm back on the topic of shaders, I really need to mention that Joel Styles has posted a really sweet skin shader on his site. If you're looking for a nice HLSL skin shader that works in Max, this is it! Nice job, Joel.

Tuesday, October 04, 2005

Helping Hands

On a completely unrelated note - I got back late last night from Hattiesburg, Mississippi. I went there on Friday with a group of 24 guys from my church to do volunteer hurricane relief work over the weekend. (More info here) The eye of Hurricane Katrina passed right over Hattiesburg and the people we talked to said that they had hurricane force winds for 12 hours! It's been four weeks now and life seems to be slowly getting back to normal, although there is still a tremendous amount of work to be done. Our team of 24 (along with about 900 other members of our church from the Raleigh region) mainly worked to remove giant trees that had fallen over in people's yards - often times causing major damage to their homes. We helped to apply tarps to damaged roofs and to clear away the massive amount of debris from downed trees. You have no idea how heavy a tree is until you try to haul it away! It was the most fun I've had in a long time, and I've got the sore muscles to prove it.