View Full Version : specular lighting in LH
I am trying to transform OpenGL from a right-handed coordinate system into a left-handed coordinate system like in DirectX. So I reversed the signs in the perspective matrix for z and w, and reversed the order in which vertices are passed. This seems to work, lighting works as normal, but the specular light doesn't. What am I doing wrong?
10-10-2003, 10:31 AM
Well, if diffuse is defined by L dot N, and specular is L dot H... Im trying to think this out on the fly here... but it seems like your half angle vector is not "happening" correctly anymore. The half angle vector is the vector that sticks out in the middle between the normal to the lit surface and the light vector. I get this impression that you won't be able to fix this unless you use some vertex/fragment programs. If there is a way to do it in OpenGL, then I suggest you try studying lighting theory which can be found very easily if you look into vertex and fragment programs.
Maybe there's a better way for you to go about what you are trying to do. I get this impression that you are trying to create an OpenGL driver for a piece of software that already draws in Direct 3D. Maybe it would be prudent to "transform" what you are doing to a right handed system, just before you send it to OpenGL rather than trying to twist OpenGL to the ways of the Dark Side.
[This message has been edited by 147-2 (edited 10-10-2003).]
An easy way to do it. http://www.frii.com/~martz/oglfaq/transformations.htm#tran0150
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.