Reason for Normal Calculation
For actual numeric constants, those are baked into the shader microcode, so that's irrelevant. However, the more important thing is that when doing a scale + bias operation, you should try to always do the scale operation first. (eg: (nrm * 2) - 1). The reason is that GPU instruction sets include an instruction known as 'mad' - multiply+add. It's meant to perform (a*b+c). There is no instruction for doing add+multiply (a+b)*c. If you're using all constants, the compiler might be able to rewrite your expression to produce a mad operation, but it's better to be safe...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement