PDA

View Full Version : Shaders, Depth testing and lighting problems



M109uk
06-09-2004, 10:39 PM
Hi all,
I have yet another question lol,

I have built in support shaders as i mentioned before, but for some reason the animation i have in the shaders will not work while GL_LIGHTING is enabled, the animation that im using at the most uses the alpha of the texture.. Does GL_LIGHTING disable the use of the alpha channel?

Secondly, i change the Depth func to GL_NEVER or GL_EQUAL in the shaders, and then change it back GL_LESS but i always seem to be able to see the shader on the other side of the wall in my world editor, i have tried to change this to all the values GL_EQUAL, GL_LEQUAL, GL_GREATER, etc but i cant get rid of the effect, iv tried turning of DL_DEPTH_TEST and this of course doesnt help much at all, i have included a screenshot of whats happening..
http://www.biocoders.org/knw0019b.jpg
I am probably missing something really dumb but i cant seem to get rid of it unless i remove the DepthFunc from the shader, and then the shader doesnt look right lol

Thanx for any help

Paulius
07-09-2004, 01:43 PM
As lighting is part of the fixed function pipeline you?¢_Tll have to do your own lighting calculations in the shader. And why would you want to use alpha testing in that way, just draw you?¢_Tre opaque geometry front to back, and then transparent geometry back to front.

M109uk
08-09-2004, 07:33 PM
Ok, the lighting isnt really a problem since it is only used in the editor when a lightsource is selected.

Im not quite sure what you mean, i use the alpha value in glColor4f to set the blink state of a section of a shader in my case its the light part of the shader. I have some how solved the problem, but all i did was change something of the shader in my shader editor, but i cant remember what i was doing, and i cant get the problem back lol :roll:

Thanx for your help..

Paulius
08-09-2004, 08:19 PM
Urgh sorry, I took a look at you?¢_Tre post in a hurry and somehow managed to get the idea you were talking about alpha func instead of depth func.