Texture Switching vs Bandwidth

Started by
11 comments, last by WarAmp 19 years, 10 months ago
quote:Original post by WarAmp
Oh it has 2 Texture Units, but each vertex has up to 8 textures (t0..t7), and so that means 8 weights (w0..w7).
(note that the sum of all weights == 1.0)

ie: Final Vertex Color = w0*t0 + w1*t1 + .. + w7*t7.

so I would need to be able to do wn*tn + w(n+1)*t(n+1) in 2 units, and I can''t figure out how without the use of the combine4_nv extension.

If you know of a way to do ab + cd with 2 units with ARB extensions only, please let me know.


Yeah, i see what you mean, NV_com4 has a nice little a0a2 + a1a3 version of GL_ADD you can use and it seems no amount of messing with the GL_INTERPOLATE_ARB (a0a2 + a1(1-a2) tex_env_combine function will let it work :|

Granted you could do it with the NV_com4 extension on NV cards and ATI''s fragment_shader extension on ATI cards, but as you want to stick with ARB stuff thats not much use
Advertisement
SimmerD: They are all uniqe textures, its based off Yann''s Terrain Texturing thread on here.

I don''t think I explained myself clearly, a gf2MX cannot do:
Tex0 * a + Tex1 * b in one pass. (Using ARB extensions).



Waramp.

Before you insult a man, walk a mile in his shoes.
That way, when you do insult him, you''ll be a mile away, and you''ll have his shoes.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.
Sorry to pseudo-necro this thread, but I figured a way to do AB + CD in 2 texture units.

A, B = Textures 0 and 1.
x, y = Texture Weights 0 and 1.

in order to do Ax + By in 2 units with OpenGL1.1 + ARB:

note that if y == 0, then don't bother with the divide.
Primary Color(x/y, x/y, x/y, y);

Texture 0: RGB: Modulate(Primary Color, A), Alpha: Anything.
Texture 1: RGB: Add(Previous, B), Alpha: Replace(Primary Color.Alpha)

glBlendFunc(SRC_ALPHA, ONE (or whatever you need))

This ends up being: (A(x/y) + B)y = Ax + By.

yay!


Waramp.

Before you insult a man, walk a mile in his shoes.
That way, when you do insult him, you'll be a mile away, and you'll have his shoes.

[edited by - waramp on May 28, 2004 5:19:55 PM]
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.

This topic is closed to new replies.

Advertisement