Advertisement

Lighting recommendation?

Started by March 12, 2003 09:48 AM
1 comment, last by DalTXColtsFan 21 years, 11 months ago
Greetings all, In the latest version of the "city" program I''ve been working on, I''m trying to simulate the sun rising and setting over 180 degrees, i.e. so it shines on one side of the building, moves straight up, shines on the other side of the building, and sets. I''m using a single directional light that moves along the XZ plane in a circle, and it gets MOST of the desired effect I want, but the problem is all of my buldings have front faces that are parallel to the XZ plane so they never get any light. What I was thinking about doing is using two positional lights that travel in circles about 10 degrees each way from the XZ plane to make sure the building fronts get "shined on". Anyone else have any suggestions? I''m all eyes! On an unrelated note, I used the texture matrix to simulate a flowing river going down one of the streets. The source code is at http://home.att.net/~tennisman5/BaseCity.zip and all of the BMP files I used are at http://home.att.net/~tennisman5/ReleaseZip.zip.
Well, I''m no expert, but I''m guessing that you shouldn''t be moving the "sun" perfectly aligned with the buildings as this is not the behavior in the real world. I suggest you move it at some other angle so that all faces of the buildings get hit.

If that doesn''t work, then your other idea should.

Joel Martinez
http://www.codecube.net/
Joel Martinez
http://codecube.net
[twitter]joelmartinez[/twitter]
Advertisement
Well, directional lights can't move because they don't have any position. In fact they are in infinite distance and have only direction. So you can change only the direction of sun rays. I suggest you to use a point light and to change not only it's intensity over the time but also the ambient lighting of the whole scene. This way also the parallel faces will be properly lit and will get darker or lighter as the ambient lighting changes over time. Take a look at glLightModelfv for more details.

[edited by - QWERTY on March 13, 2003 5:02:48 PM]

This topic is closed to new replies.

Advertisement