PDA

View Full Version : single pass env. map for shininess



fps
07-30-2001, 04:58 AM
i have a untextured, colored object
lit with a lightsource (which stays fix at 0,0,0). now i wish to add the color of a environment-map texture (rgb) at a variable level of intensity.. ranging from 0.0f (just the lit object) to 1.0f (the lit object + the full envmap).
getting the final image in 2 passes (render the colored, lit object first and then disable lighting and rerender it with the envmap and needed alphavalue)works. but how to do that in one pass?
Setting the TexEnv to GL_ADD just adds the texture color, but with the full brightness.
Using GL_BLEND or GL_MODULATE doesnt fit too.
Any Ideas? Thanx for shortanswers.

fps
07-30-2001, 05:08 AM
ps: iam familiar with multitex-rendering, but saw no solution for my problem using this tech too.

DFrey
07-30-2001, 05:28 AM
Sounds like you may be interested in the GL_EXT_texture_env_combine extension. In particular, its interpolation combiner.

<edit>
No I take that back. That will not do what you want. Really, it sounds like you want the alpha components to add, and the color to modulate? When you did this using the 2 pass method, what specific blending function did you use? That will help clear up any uncertainty I'm having.


[This message has been edited by DFrey (edited 07-30-2001).]

Relic
07-30-2001, 06:50 AM
On NVIDIA HW try this: http://oss.sgi.com/projects/ogl-sample/registry/NV/register_combiners.txt

You want to mix the GL_PRIMARY_COLOR_NV with GL_TEXTURE0_NV.
You haven't mentioned where the variable level of intensity comes from, but it should be possible to do what you want in a single pass anyhow.

Rob The Bloke
07-30-2001, 12:07 PM
Originally posted by DFrey:
No I take that back. That will not do what you want. Really, it sounds like you want the alpha components to add, and the color to modulate?

You were correct 1st time, you can put it into GL_EXT_texture_env_combine.




[This message has been edited by Rob The Bloke (edited 07-30-2001).]

fps
07-31-2001, 02:18 AM
@relic: thank you, i will check this docu. my "intensity" is just a float value ranging from 0.0f to 1.0f.. so it doesnt matter for me what i use, an alpha channel or a color to modulate.

fps
07-31-2001, 02:27 AM
@dfrey: i have two options i think of
1) blend the envmap over the colored, lit shape with an alpha value (blendfunc: GL_ONE_MINUS_SOURCE_ALPHA, GL_ONE)
2) modulate the envmap with a grayscaled color and add the result to the colored, lit object.