PDA

View Full Version : Ortho projection and directional light



obirsoy
04-15-2004, 07:29 PM
I am having trouble with orthographic projection and directional light. Everything works as expected except the specular component.
For example if I have a light position (0, 0, 1, 0) (directional) My scene renders correctly but specular component lights the scene as if it is a positional light at (0, 0, 1) (again just for specular component). :confused:

My question is simply what am I doing wrong? or
Is there some gotcha with ortho and specular? (should go and read lighting theory again?) :(

plasmonster
04-15-2004, 08:18 PM
How are you doing the lighting? CG with H vector?

obirsoy
04-15-2004, 08:40 PM
No fancy stuff :(
Just fixed pipeline.

plasmonster
04-15-2004, 08:47 PM
So you've got a nice setup for the combiners, I assume, and it works for point lights, but not directional? @_@ I need some coffee...

obirsoy
04-15-2004, 09:51 PM
I really mean no fancy stuff. Just good ol` 1.1 (ok maybe 1.2). :p

But for some code and pictures see
http://home.comcast.net/~obirsoy/OrthoLightProblem.htm

I suspect this is something related to GL_LIGHT_MODEL_LOCAL_VIEWER, but its been a long day. I guess, i have something to study for the weekend.

plasmonster
04-15-2004, 09:57 PM
Ahhhhh, I see. Doing great lighting with 1.1 is difficult, especially specular lighting, without tesselating your geometry, alot. That maybe your only problem, subdivision.

obirsoy
04-15-2004, 10:16 PM
Yes, i know but i have to support every possible card out there. :(

To be more clear my problem is with image 2. I expect the front "wall" have specular too, but it does not as if the light is positional(image3).

I think I have meshed the "walls" quite good.

Note: I added a new picture (Image 4) showing the mesh I have.

plasmonster
04-15-2004, 10:22 PM
You need to enable two sided lighting. Normally, you can only light the "positive" side, the side with the normal. I'd have to lookup the details on that, as I never use two sided lighting myself... I think maybe there's a simple enable for that, not sure.

@@
Oh yeah, plenty of tess there!

@@
light model: GL_LIGHT_MODEL_TWO_SIDE

@@ Oops, you have the two side.
Hmmm, not sure I see the problem.

@@ make sure the model matrix is what you expect when you set the light position.