According to the book I have on HLSL, you can make if statements all you want. However, most shader models can only support static branching (if you had a bunch of bools that go into the function this would be ok, as it would cause those branches to NOT execute).

However, only shader model 3.0 has true dynamic branching, all the other models just end up having both the if and else executed and the shader chosing the part you wanted. So in effect, it is not giving you a performance boost in the same way regular code would if you blocked it off with an if.

This is the real difference between optimizing shaders and optimizing regular code.

and xXxGuitar511; totally valid, I failed to realize that he was making a global effect. It should definately be a local material per mesh. That would make the effect significantly easier.


"Towlie, you're the worst character ever." I know...