PDA

View Full Version : Brighter light



jason_shaffer
10-22-2001, 01:10 PM
To this point I've been able to use lighting on a texture mapped object, but the portions of the object where the lighting is most intense seem to have color brightness the same as the original texture map. Then as the light gets less intense on the other portions of the object the color seems to be darker or shaded.

Is it possible to increase the light's brightness so the portions of the object where that the light is most intensely hitting have even a brigter or whiter color then the original texture map?

Morglum
10-23-2001, 05:13 AM
Yes. Set a white specular color with glMaterialfv (this IS compatible with texture mapping) and adjust the shininess with glMaterialf (smaller GL_SHININESS yields brighter highlights). Hope that helps.....

jason_shaffer
10-23-2001, 06:47 AM
Originally posted by Morglum:
Yes. Set a white specular color with glMaterialfv (this IS compatible with texture mapping) and adjust the shininess with glMaterialf (smaller GL_SHININESS yields brighter highlights). Hope that helps.....

I've tried this all ready. I can see the effect of adjusting both the material specular and shininess so I assume they are working in my implementation. But the best shininess I've been able to achieve is a brightness level at what the texture mapped object looks like with lighting disabled. Don't get me wrong, the lit part of the object is lighter than the rest, but I need it to be even brighter - a white gleam or speckle. Thanks for your reply, it is appreciated - as well as any more suggestions.

Ketzal
10-23-2001, 01:46 PM
I posted that same question a while ago in gamedev.net. The simple approach to achieve specular highlights is passing GL_ADD instead of GL_MODULATE to the glTexenvf function. The downside to using this is that the darkest color you will get is the texture's original colors (the exact inverse of GL_MODULATE). The other way is to use the SEPARATE_SPECULAR_COLOR extension, but I haven't tried this yet.

FXO
10-24-2001, 04:11 AM
I assume you mean diffuse lighting and not specular.

I have been thinking about this to, Quake3 has hacked the color-bits somehow, to get overbright bits ie. brighter than textures colors.
Hoever, I don't know how to do this.
I tried another (slow) approach, just draw the same lit texture two times, and blend them toghether.
This will mean that you will get overbright with any light values > 0.5 and darker textures < 0.5.

This might not be a good approach if speed is vital, but It works.

HTH

jason_shaffer
10-24-2001, 05:51 AM
Originally posted by FXO:
I assume you mean diffuse lighting and not specular.

I have been thinking about this to, Quake3 has hacked the color-bits somehow, to get overbright bits ie. brighter than textures colors.
Hoever, I don't know how to do this.
I tried another (slow) approach, just draw the same lit texture two times, and blend them toghether.
This will mean that you will get overbright with any light values > 0.5 and darker textures < 0.5.

This might not be a good approach if speed is vital, but It works.

HTH

No, I believe we're talking about specular color, not diffuse color. After doing some research, I found the answer to the problem.

There's at least two ways to get specular highlighting to work properly with texture mapping. OpenGL 1.2 has functionality to accomplish this with the method Ketzal was talking about. You can read about the problem and solution here: http://oss.sgi.com/projects/ogl-sample/registry/EXT/separate_specular_color.txt . Basically you need to add glLightModel(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPAR ATE_SPECULAR_COLOR) to your code.

The second way is using a two-pass drawing method. This is discussed in Eric's post @ http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/000128.html .

I couldn't use the first method because my video card doesn't support that OpenGL extension, so I tried the second method and got it to work.

Jason

[This message has been edited by jason_shaffer (edited 10-24-2001).]

[This message has been edited by jason_shaffer (edited 10-24-2001).]