PDA

View Full Version : glTexGen & performance



remdul
02-21-2006, 06:54 AM
I remember testing this some time ago, and have read about it several times; does the use of glTexGen have any positive effect on performance? I didn't notice much difference.

Are the drivers generating the coordinates and sending it to the hardware? What's the deal?

I'm using texgen to map multi-textured terrains, and am also wondering whether it would be worth the trouble to replace it with a vertex shader. :)

CrazyButcher
02-21-2006, 09:51 AM
texgen is slower then just passing texcoords straight. because it needs to compute texcoords based on vertexpositions. whilst if you just pass the values, nothing needs to be computed.

especially for terrain, which likely doesnt change its texcoords, you should just precalc on cpu, I would think.

dorbie
02-21-2006, 12:45 PM
Then again there's bandwidth of sending coordinates vs the cost of generating them directly from the vertex locations so it might be faster to do some dot products on the GPU than send another vector. :-)

I thing the answer is it depends, and your vertex data may be stored in slower or faster memory.

If you are using texgen the best of both worlds may be to use a vertex shader to generate texture coordinates directly from the vertex position attribute in object or eyespace without the fixed function pipeline, and basically for free because the texgen plane equations are eliminated.

halo
02-21-2006, 12:57 PM
It would be much better to use a texcoord buffer. If your terrain layers map differently, you can push and scale the texture matrix.