Advertisement

Texture Environment

Started by March 26, 2002 07:50 PM
11 comments, last by tSG 22 years, 11 months ago
Hi, I would like to make such a shader system which can set the visibility factor for each pass(texture unit) and would also use the primary color and the texture color... I have came on the idea to use GL_EXT_texture_env_combine so that the texenv_color should contain how much the pass is visible... But I would need a function like Texture*PrimaryColor*TexEnvColor which can''t be made with texturecombiners. How could I do that? The visibility factor is not clear I see It says how cleanly the pass is visible... so if pass1-s visibility factor is 1 pass0 is invisible, if it is 0 pass1 is invisible... Without the lighting I could made what I wanted but vertex lighting is really important for me, so using GL_COMBINE_EXT ; GL_INTERPOLATE_EXT is not good... (Tex*EnvColor + PrimaryColor*(1-EnvColor) - that''s what I have done so far but that is not good if I want to use lighting) Thanks in advance and ask if you don''t understand something (and sorry for my english... -- tSG --
-- tSG --
No ideas?? (
Have you seen fly3D 2.0 rc1? It does the same thing but unfortunately I haven''t got the source code which is not free... So this is possible somehow but I dunno how. It''s so sad!


-- tSG --
-- tSG --
Advertisement
I''m having a hard time understanding you, but are you just on about alpha?


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
quote:

But I would need a function like Texture*PrimaryColor*TexEnvColor which can''t be made with texturecombiners.


You''re right. That can''t be made. At least in one pass.

But as long as the texture environment color is a constant, you can do it with another method, such as multiplying that constant with light colors.
I just thought of something.
If you don''t use fog on those objects, you could use the OpenGL fog coordinates.
It is extremely easy to use and exactly does what you want.

BUT your objects won''t be able to be fogged "naturally" eg fade into the background.
vincoof: Fog coordinates... How could I use? I only know about glFog(). Could you point me out the functions/keywords which I need? Btw. have you heard about fly3d? (http://www.fly3d.com.br) I think I will write to the author to ask how he did it because I haven't seen such a robust shading system yet as he did in it.
Btw. the problem is that the environment color is not constant in the most cases. (And also each pass' environment color is important)

siaspete: no, it is not alpha. It is a rather complicated shader class in which each pass can be hided dynamically. I can't tell it better. Maybe if you have a fast net download fly3d and have a look at flyshader.exe. It does what I am talking about.

Thanks for your replies!


-- tSG --

[edited by - tSG on March 27, 2002 5:21:55 PM]
-- tSG --
Advertisement
About fog:
glFog computes fog depending on the Z fragment : the farther the object is, the more it is blended with the fog color.
BUT ! you can specify the fog coordinates yourself, ie override the "default" behaviour described above.
You use fog coordinates just as you use texture coordinates or vertex coordinates : call glFogCoord().

In your case, you could copy the texture environment color to the fog color, and then call glFogCoord to define how many you want your object(s) to blend with the fog.

Note: you can also use fog coordinates in vertex arrays.

I''ve sent you a fog demonstration by email.

Hmmm. after thinking about it. It may not be a perfect solution because the fog equation is :
object_color * (1 - fog_weight) + fog_weight * fog_color
Might be useful anyway, dunno...
vincoof: thanks now I see this extension and another thanks for the sample program! It is also a to-be-considered way of doing the class.
-- tSG --
TSG: you have an nVidia card ? In that case, you could just use the NV_texture_env_combine4 extension.
TSG: you have an nVidia card ? In that case, you could just use the NV_texture_env_combine4 extension.

This topic is closed to new replies.

Advertisement