RE: [Algorithms] Environment map texture blending question.
Brought to you by:
vexxed72
From: Evan H. <eh...@at...> - 2001-01-05 21:26:59
|
I assume that you are looking to do this with the texture blending stages and not the alpha blender. The primary difficulty appears to be getting the routing to work. On a Radeon with OpenGL and only the Texture_Env_Combine extension, you can do the following: Texture Stage 0: Bind Base Texture TexEnvMode = REPLACE Texture Stage 1: Bind Env Map Texture TexEnvMode = COMBINE COMBINE_RGB = INTERPOLATE Source0_RGB = Previous Source1_RGB = Texture Source2_RGB = Previous Texture Stage 2: Bind Dummy Texture ( 1x1 white square) TexEnvMode = COMBINE COMBINE_RGB = MODULATE Source0_RGB = Previous Source1_RGB = Primary_color A similar setup should apply under D3D or other cards. -Evan -----Original Message----- From: Ratcliff, John [mailto:jra...@ve...] Sent: Friday, January 05, 2001 3:53 PM To: 'gda...@li...' Subject: [Algorithms] Environment map texture blending question. For those of you familiar with the various blending modes on 3d cards I have a question to ask. Perhaps this should be obvious, but I'm certainly missing it. What I want to do is combine an environment map with a base texture on a model. That's fairly straightforward. However, I want the environment map to be blended relative to the alpha channel found in the texture built for the base model. In this way to control per-pixel reflectivity. After these have been combined I then want to attenuate the result by the diffuse color component from lighting solution. That way the shiny bits are still dark if the base model is dark. If the envinronment map doesn't also absorb the same diffuse lighting as the base texture it no longer looks like a refelction and instead looks like a plastic coating oversaturating the object. Either of these two is fairly easy to do. To combine the environment map with the base texture, with a modulated blend based on the base textures alpha channel is easy to do, but it doesn't attenuate by the diffuse. Likewise you can combine the environment map and the base texture and apply a diffuse to both, but *not* have the selective alpha blend. At least I've been able to get each case to work seperately but not combined. This is assuming a two texture stage pipeline is available and we want to do this in one pass. Ideal equation: ( (BaseTextureColor * (1 - BaseTextureAlpha) ) + (EnvMap * BaseTextureAlpha ) * Diffuse Anybody know the sequences of blend modes you set up using OGL or D3D to make this happen? Thanks, John _______________________________________________ GDAlgorithms-list mailing list GDA...@li... http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |