Jump to content
  • Advertisement
Sign in to follow this  
mutifus

2 Texture Units Puzzle

This topic is 4487 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!