PDA

View Full Version : LuminaceAlpha vs Luminace+Alpha_lookuptable



UT666
05-23-2006, 04:40 AM
Just wondering the following,

If i have an LA texture which i seperate into two textures, L + A. Say the L texture is nXn and the A is 1x256, ie: the lookup table for the alpha value, and use a fragment program to compute the alpha on the fly...

Am I reducing the texture memory used for the data, at the cost of rendering speed?

thanks,

ut.

Serge K
05-26-2006, 09:45 PM
Yes.

ebray99
05-28-2006, 03:42 AM
Short answer:

The card will do more, but you might or might not see a difference in shader execution speed.

Long answer:

This depends heavily on the contents of your shader. Here some rough conceptual performance characteristics of modern video cards (NV40+ [NV30 is a strange beast], R300+) to consider:

1.) there is a scalar math unit.
2.) there is a vec3 math unit.
3.) there is a texture unit.

That said, all of three of these things can operate in parallel. If one unit depends on another, it has to sit idle until that unit finishes.

In this case, the unit in question is the texture unit. It's performance changes considerably based on the whether or not you're using a texture coordinate coming directly from the vertex shader, or a temporary register. In your case, it's going to come from a temporary register, which is generally slower.

I've found that dependent texture reads from small textures on ATI cards can produce a hit similar to a dependent texture read for a larger texture (depending on how much the texture coordinate changes from one pixel to another). Basically, there is a fixed overhead for dependent texture reads. On NVidia cards, dependent texture lookups for small texture are very fast (usually 1 cycle).

All of this said, you may or may not see a performance hit (in fragment shader limited situations). It could be that you have enough unrelated math in your shader that adding the extra texture read will simply give an idle texture unit something to do.

Really, the best thing you can do is simply try it; simply see if it adversely affects your framerate or not. If not, and it makes your life easier, saves you memory, etc, then rock on! If it does, then decide on whether or not it's worth the hit.

Kevin B