Sign in to follow this  
mutifus

2 Texture Units Puzzle

Recommended Posts

Hi there, I have a base texture ('B'), two alpha textures ('A'), two detail textures ('D') and a light map texture ('L'). The base texture covers 100% of the area, the two detail textures use the alpha map textures as masks. I'd like to render this in as few passes as possible since there are a lot of triangles. If the GPU has 6 texture units, it's straightforward because I can do B,A,D,A,D,L using various combines and this works fine. If there are 4 texture units, I can do B,A,D,L on the first pass and then A,D,L on the second pass. This also works fine. :) This beings me neatly onto my question, is it possible with 2 texture units? Can you do two alpha-mapped detail textures on top of a base texture with a lightmap? I have tried glBlend(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA), this works: B AD AD However, I'm not having much luck with the lightmap. I tried glBlend(GL_ZERO,GL_SRC_COLOR) and this applies the lightmap nicely, but unfortunately it darkens the fog. Is there a solution to this puzzle that doesn't involve shaders? I'm sure there's a really simply answer, it just evades me at the moment! Many thanks, Richard.

Share this post


Link to post
Share on other sites
with glsl hardware u can do it all in one pass
though for lesser hardware i'ld apply the lightmap + base texture first + then apply the detail/alpha textures afterwards blended

Quote:
f there are 4 texture units, I can do B,A,D,L on the first pass and then A,D,L on the second pass. This also works fine. :)

youre applying the lightmap twice here so its prolly not what u want (its also slower)

Share this post


Link to post
Share on other sites
Thanks for the reply! I don't want to assume GLSL - I might support it for cards that have it, but I'd also like it to work on 2 texture unit plain-vanilla GPUS. Am I attempting mission impossible?

Quote:
though for lesser hardware i'ld apply the lightmap + base texture first + then apply the detail/alpha textures afterwards blended


Unfortunately, that doesn't work because although the base texture would look nice, the detail textures won't be lit?

Quote:
youre applying the lightmap twice here so its prolly not what u want (its also slower)


Again, it's to preserve the lighting, unless I'm missing something!

The overall problem seems to be that my final pass is rendering over the top of the fog with a GL_ZERO,GL_SRC_COLOR to blend in the lightmap - that's why I'm seeing much darker fog.

This perplexing puzzle remains! Any takers?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this