Jump to content
  • Advertisement
Sign in to follow this  
Crisium

texture combiners

This topic is 3782 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, This is the setup: texture0: RGB no alpha (contains white text on black background) texture1: RGB no alpha (contains an image of a forest) I would like to have only the white text combined with the forest, so basically I would like to force an alpha that uses the RGB values from texture0. Is this possible? or is there another way without having to create textures with alpha? Peter

Share this post


Link to post
Share on other sites
Advertisement
Yes, it is possible. How exactly depends on the type of texture combiners you are using.

But seriously, just use shaders. Texture combiners are so obsolete and inflexible, it isn't even funny anymore. Doing what you want is a five second job when using a shader.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
Yes, it is possible. How exactly depends on the type of texture combiners you are using.

But seriously, just use shaders. Texture combiners are so obsolete and inflexible, it isn't even funny anymore. Doing what you want is a five second job when using a shader.


I agree .. using shaders this is a piece of cake... but I have people asking me how to do this with OpenGL and using the multitextering combiners...

if this is possible.. then how? remember I have no alpha in my textures... I have don't this succesful with textures with alpha.. but I would like to see if I can do the same without alpha.

Direct3D actually has something that allows you to use alpha on the RGB components... but how is this done in OpenGL.

Peter

Share this post


Link to post
Share on other sites
Quote:
Original post by Crisium
Direct3D actually has something that allows you to use alpha on the RGB components... but how is this done in OpenGL.

As I said, it depends on the type of combiners you are using. You didn't specify this.

Quote:
Original post by Crisium
but I have people asking me how to do this with OpenGL and using the multitextering combiners...

If you don't mind me asking, why would anyone want to do something like this ? I mean, all 3D cards of the few last generations will internally emulate combiners with shaders anyway. So it doesn't make any sense not to use shaders directly.

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
Quote:
Original post by Crisium
Direct3D actually has something that allows you to use alpha on the RGB components... but how is this done in OpenGL.

As I said, it depends on the type of combiners you are using. You didn't specify this.

Quote:
Original post by Crisium
but I have people asking me how to do this with OpenGL and using the multitextering combiners...

If you don't mind me asking, why would anyone want to do something like this ? I mean, all 3D cards of the few last generations will internally emulate combiners with shaders anyway. So it doesn't make any sense not to use shaders directly.


I'm using glTexEnvi.

Some people still use older version of OpenGL and graphics cards for reasons I do not need to know.

Peter

Share this post


Link to post
Share on other sites
Quote:
Original post by Crisium
I'm using glTexEnvi.

Of course you do, all types of combiners use glTexEnv. You need to specify the exact type of combiner you use (texture_env_combine, register combiners, etc)

Share this post


Link to post
Share on other sites
Quote:
Original post by Yann L
Quote:
Original post by Crisium
I'm using glTexEnvi.

Of course you do, all types of combiners use glTexEnv. You need to specify the exact type of combiner you use (texture_env_combine, register combiners, etc)


glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);

Peter

Share this post


Link to post
Share on other sites
Quote:
Original post by Crisium
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);

You still don't specify if you are using ARB_texture_env_combine or EXT_texture_env_combine. In the future, please be more precise in your questions. This will save us the guessing around. For now, I'll assume the former.

This a very primitive combiner extension, and so your options are limited. You cannot get the alpha from a colour source. But you can use a colour source to interpolate between two textures. So use combiner mode INTERPOLATE, Arg0 is your first textures' colour, Arg1 your second texture colour, and Arg2 again your first texture colour.

Note that this will only work if the text in the first texture is guaranteed to only contain shades of grey. If it contains other colours, then the blending will be pretty strange, since you don't do any RGB to greyscale conversion for the interpolation factor.

Also, this will only work with ARB_texture_env_combine, and NOT with EXT_texture_env_combine. The latter doesn't allow colour sources for Arg2.

Share this post


Link to post
Share on other sites
Sounds like just doing a modulation would work.
With standard GL,
glActiveTexture(GL_TEXTURE0);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glActiveTexture(GL_TEXTURE1);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

Quote:
Just out of curiosity, how would this be done with a shader (GLSL or Cg)?

How complicated is it to sampler a couple of a texture?

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!