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.
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.