Game Development Community

Shader math function use

by Kevin Johnson · in Torque Game Engine Advanced · 08/30/2004 (2:57 pm) · 2 replies

OK, with all this mumbo jumbo about progamable pipelines,multi pass rendering, blah blah blah.. I 've come across a question..Which is more important..doing the math stuff (normalize,dot, ect..)on the GPU or, to normalize or whatever then pass it in to the fragment. Mainly I'm asking in relation to normalizing stuff before i pass it in..but this topic may be of use to someone else..

#1
08/31/2004 (6:28 am)
You'll want to do as much of the math as you can in the vertex-shader as it normally runs an order of magnitude less times that the fragment shader so you'll save GPU time. Sometimes though, dependant upon what you are doing, you'll have no alternative than to do the stuff in the fragment shader if it has to be calculated per-pixel and cannot be interpolated.

Although vague, does this make sense?

- Melv.
#2
08/31/2004 (7:04 am)
Actually.. Yes it does..:)