Shininess

BlitzMax Forums/OpenGL Module/Shininess

simonh(Posted 2006) [#1]
I'm currently trying to get shininess to work the same as it does in B3D.

Without textures, I can get it to work the same. I get a bright white spot in the corner of a sphere.

However, with textures the shininess is dimmer than in B3D. In B3D, shininess applied to a textured object still shows through as a bright white spot.

I'm using modulate blending for the texture, which is the default blend mode in B3D.

Any ideas?


simonh(Posted 2006) [#2]
Ah, this looks like it could be the answer:

http://72.14.203.104/search?q=cache:DV3tOaN5BzQJ:www.opengl.org/resources/tutorials/advanced/advanced98/notes/node98.html+opengl+texturing+and+shininess&hl=en&ct=clnk&cd=6


simonh(Posted 2006) [#3]
Gah, that works except the shininess part flickers.


N(Posted 2006) [#4]
What depth function are you using?


simonh(Posted 2006) [#5]
glEnable(GL_DEPTH_TEST)		
glDepthFunc(GL_LEQUAL)
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)

Plus I've got a camera range of 1,1000.


N(Posted 2006) [#6]
Well, you could try doing it multipass (well, it sortof is multipass now, but I mean clearing the scene and redrawing everything with its material properties/shininess and no textures).

E.g.,
- draw with texture
- clear depth buffer
- draw without texture and with shininess
- flip


simonh(Posted 2006) [#7]
That doesn't work either. This one has got me stumped. I see no reason why a simple multipass operation like this should produce flickering.


fredborg(Posted 2006) [#8]
This should be enough:
		glEnable(GL_LIGHTING)
		glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR)
		glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE)
There is no need for multipass rendering or other stuff like that.

Remember that lights are calculated relative to the current model view matrix, so you need to multiply the location and direction of the light by the inverse model view matrix, before rendering each entity/mesh/object/surface/whatever...


simonh(Posted 2006) [#9]
That did the trick. Thanks Fredborg!