PDA

View Full Version : How expensive is the use of extra texture-units?



Jan
10-07-2004, 07:11 AM
Hi there

This question is kind of complicated to formulate, but ill give my best.

In my app 6 textures form one texture-object.
Diffuse (RGB)
Alpha (A)
Normalmap (RGB)
Glossmap (A)
Emissive (RGB)
Height (A) (for parallax-mapping)

So, i COULD combine them like this:
Diffuse / Alpha
Normal / Gloss
Emissive / Height

Or, since Diffuse and Height certainly have the same resolution, but Emissive and Alpha maybe have lower resolutions:

Diffuse / Height
Normal / Gloss
Emissive / Alpha

This way, i can reduce the number of texture-accesses. HOWEVER i will do some different passes, for example a z-only pass, and in such a pass i only need Alpha. Now, since i combined Emissive and Alpha, the card now needs to load and access 4 times the memory, it would need to access, if i had only Alpha in the texture.

Also, when doing Parallex-Mapping, i would need to access Diffuse/Height, instead of only Height, which is certainly slower.

What i mean is, that i DO reduce the number of necessary texture-access, but some accesses are certainly a lot slower because of unneeded data.

Since i do have enough texture-units, i could simply not combine any textures (except for Normal/Gloss which really makes sense). But then i would need more texture-accesses.

Therefore, id like to ask, if anyone knows, if this is better or maybe worse. At the moment i cannot test, which is faster, since my app is still at a very early stage, but id like to at least have a clue right now.

I hope, that most gfx-cards act quite equal in this case, but if it matters, i am working on a Radeon 9600XT.

One additional idea: If i seperate all textures, i could also save on filtering-computations, because i can use aniso-filtering on my Diffuse-Texture and bilinear on my Alpha-Texture, etc.

Thanks in advance.
Jan.

Korval
10-07-2004, 09:59 AM
So, i COULD combine them like this:Well, Diffuse pairs with Alpha for obvious reasons: the diffuse map and the alpha map should (in theory) be the same size. Now, the normal map and the height map also pair up, since the height map should, in theory, be what generated the normals. If they are not the same resolution, it could screw up the parallax, or, at least, make it less correct.

As for the rest, make them 2 textures. Or 1 if it seems reasonable.


HOWEVER i will do some different passes, for example a z-only pass, and in such a pass i only need Alpha.You should be using a different shader for a z-only pass anyway. Otherwise, you're just wasting time with the depth-pass.


Now, since i combined Emissive and Alpha, the card now needs to load and access 4 times the memory, it would need to access, if i had only Alpha in the texture.Which matters more: the efficiency of the fast z-only pass, or the efficiency of the already performance-starved real pass? Clearly, your bottleneck is going to be the real pass, so you should focus on that.


If i seperate all textures, i could also save on filtering-computations, because i can use aniso-filtering on my Diffuse-Texture and bilinear on my Alpha-Texture, etc.If you're going to pay the cost of aniso, it doesn't cost significantly much more to do it for 4 components over 3. Indeed, I wouldn't be surprised if the hardware was designed for 4 components and simply discards the unneeded/unspecified ones.