HLSL's, Cg and the RenderMonkey

But HLSLs Can Make Life Easier

I've discussed the combination/ permutation problem in great depth in my last article, Vertex Shaders and Pixel Shaders. This is still a big problem when using an HLSL to target the DX8 platform. However, there are a number of ways that HLSLs can actually make this problem easier to solve.

The alternative to a fragment system is a set of general shaders, which cater to common lighting environments. Different lighting environments aren't catered to with different shaders, they're just shoehorned into the general shader that has already been written. This system is also helped by HLSLs where the time taken to write each general shader drops dramatically, allowing the programmer to create more general shaders to cater to a variety of different lighting environments. Because HLSL is so much quicker to develop, these variants are very quick to write.

To be honest, I'm not entirely sure that HLSLs have much to give in the case of pixel shaders. As I've already discussed, the programmer is going to have to be on his toes at all times when playing with DX8 pixel shaders. However, there is something to be said for increased code clarity. And in the future, the pixel shaders are going to get more complex, and more general, making HLSLs imperative if we're to take full advantage of the hardware. For now, it doesn't hurt to use HLSLs for pixel shaders, but don't expect beginners to understand what's going on without teaching them the assembly level first.