PDA

View Full Version : env_combine and transparency



V-man
01-02-2003, 08:00 AM
Hello,

If I want to use the alpha of the secondary color to control the blending between 2 textures, would that be possible?

I would like to use the alpha of the primary color to do transparency of the entire polygon.

I want the transparency of the polygon and the blending between the 2 textures to be dynamic. So I need some way to feed those alpha's to the the texture combiners.

Thanks

PH
01-02-2003, 08:05 AM
As far as I know, the only way to specify alpha in the secondary color is via this extension,
http://www.nvidia.com/dev_content/nvopenglspecs/GL_NV_secondary_color_alpha.txt

Otherwise, the alpha component is assumed to be 1 or 0 ( don't remember which ).

DFrey
01-02-2003, 08:31 AM
If you have more than 2 texture stages available, you can use a 1-D texture (that contains an alpha ramp) to control the blending. Then your programmable blending parameter would effectively be the 1-D texture coordinate.



[This message has been edited by DFrey (edited 01-02-2003).]

pbrown
01-02-2003, 06:17 PM
There is technically no alpha in secondary color, and there's no way to get at an alpha. ARB_texture_env_combine doesn't even allow you to get at any of the RGB secondary color.

The NV_register_combiners spec does have a full register corresponding to secondary color, but the initial contents of alpha are undefined.

I see that an NV_secondary_color_alpha spec was published on our developer site, but it probably shouldn't have been -- it is not supported in our driver.

V-man
01-02-2003, 06:28 PM
It says that NV extensions is "Proposed", so I think that's the reason why it's not in the extension list.
/*edit*/pbrown just posted while I was typing!

I was hoping that someone was gone tell me there will be a ARB_texture_env_combine2 soon http://www.opengl.org/discussion_boards/ubb/frown.gif

What about GL_CONSTANT? I think I can do something like

GLfloat color[]={r, g, b, a};
glTexEnvf(GL_TEX_ENV, GL_TEXTURE_ENV_COLOR, color);

This should allow me to stay in the limits of 2 tex units if it does what I think does.

[This message has been edited by V-man (edited 01-02-2003).]

V-man
01-03-2003, 08:13 PM
I would like to confirm something.

If you use glMaterial and give GL a diffuse alpha of X, then after the lighting calculations (or no lighting at all), the primary color gets an alpha of X.

Is that correct? Or maybe I misunderstood what the definition of primary color is...

I would like to query GL and see what numbers are "flying" around but no such tool http://www.opengl.org/discussion_boards/ubb/frown.gif

Thanks again.

zed
01-03-2003, 09:08 PM
tex_env_combine aint very flexible.
what u want can be done with
register combiners
fragment_program
unfortunaly not all hardwaresupports the above extensions

>>I would like to query GL and see what numbers are "flying" around but no such tool <<

recently i restarted writing opengl state information code ill post a link when/if it ever gets finished http://www.opengl.org/discussion_boards/ubb/smile.gif

V-man
01-04-2003, 05:01 AM
That would be a nice tool to have. Also try adding something that allows us to trace a vertex or any other piece of data as it goes through the GL pipe.

It would be an great educational tool for newbies.

zed
01-04-2003, 11:35 AM
i actually started it a couple of years ago so that should of been

recently i restarted REwriting opengl state information code ill post a link when/if it ever gets finished

(so dont hold your breath, though i done quite a bit last night http://www.opengl.org/discussion_boards/ubb/smile.gif)


Originally posted by V-man:
That would be a nice tool to have. Also try adding something that allows us to trace a vertex or any other piece of data as it goes through the GL pipe.

It would be an great educational tool for newbies.

i actually see it being more used for optimization (eg alphatest is enabled at X time even though its not necessary) + hopefully will aid in helping to track down opengl bugs in your code.

heres it in use anyways

GLstateSnapshot ss1;
ss1.log( GLstateInfo::VALID_STATE | GLstateInfo::INITIAL_STATE );
glColor3f(1,0,1);
GLstateSnapshot ss2;
ss2.log( GLstateInfo::VALID_STATE | GLstateInfo::INITIAL_STATE );
where_do_these_2_statesnapshots_differ( ss1, ss2 );

ive done ~20 of the ~30 opengl1.4 spec pages