Archived

This topic is now archived and is closed to further replies.

Electron

Is there a way to disable color clamping?

Recommended Posts

If i set the color value to, say 0.5,0.5,0.5 (RGB) when rendering a texture, the texture''s colors get''s half of it''s original value. Say that i want the color to get twice as high instead? A very satisfactory sollution would just be to enter the color 2.0,2.0,2.0. the problem is that GL clamps it to the range [0.0 - 1.0]. Is there a way to disable this? Electron

"The truth can be changed simply by the way you accept it."


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Electron
If i set the color value to, say 0.5,0.5,0.5 (RGB) when rendering a texture, the texture''s colors get''s half of it''s original value.

Electron<P>"The truth can be changed simply by the way you accept it."<P><BR>

If you set the color value for a texture to [.5, .5, .5], then the texture will have a greyish color. I think you''re thinking about factoring in lighting properties...?


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
nope. there is nothing past 1.0. openGl clamps because 0.0 represents no intesity for that color and 1.0 for full intensity. And then everything in between. 2.0 is the same as saying 1.0 because once you reach full intensity there cannot be a more full value.

You might light into lighting and light maps if you want to add brightness to textures.

Share this post


Link to post
Share on other sites
That''s Excactly my intention, but my problem is that my light map result can never get brighter than it''s original texture.

I use multitexturing with GL_MODULATE as TexEnv, which only results in a downscaling factor. (dark light)

This might be satisfactory, but my ultimate goal is to be able to put a light source which is also able to intensify the color values.

for instance, the color (0,0,0) gives pitch black, (0.5,0.5,0.5) original texture intensity, and (1,1,1) Blindly white.

I CAN achieve this by rendering the light map over the surface a second time, using blending, but i would like to skip this additional pass if possible.

Electron

"The truth can be changed simply by the way you accept it."


Share this post


Link to post
Share on other sites
You can use the texture environment to scale the ouput from the texture unit.

  
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 2);

That will multiply the texture and the previous output (lightmap * base texture for example) and then scale the output by two. The resulting formula is lightmap * base texture * 2, which can be seen as scaling the lightmap by a factor two and then modulate it with the base texture. The range of the lightmap is now [0, 2].

You can use 1 and 4 as scale factors too.

Share this post


Link to post
Share on other sites