Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Yau

lighting problems

This topic is 5849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m in the process of makin'' a really cool mecha game and I seem to be having minor problems with my lighting. The situation is this I have a light in the middle of my scene 100 units up in the sky. I have a terrain, and a mecha the user can control. The camera always follow the mecha, so it''s a 3rd person game kinda like Ghost in the shell and Armoured Core. My problem is: This lighting effect on the echa seems to change when into rotates! I know the light source is always above the mecha so theorectially: mecha should always be brighter near the top if it is standing directly under the light, or be brighter top and side if it is not standing directly under the light. So, for example, if my mecha is standing directly under the light facing north, the the top of the mecha is bright and the bottom dull, which is what I want. But is I turn my mecha around and it faces south the bottom of the mecha is bright and the top is dull, even though the light source remains above the mecha!!! Heres the pseudo-code of how I render my scene: Draw() Set the viewing transformation so the the camera is behind the mecha and facing the same direction as the mecha. Set the light at the position (50, 100, 50). Draw the mecha at it''s position and orientation. Draw the terrain.

Share this post


Link to post
Share on other sites
Advertisement
Upps...

If you want those things to happen with the distance and so on,
You must use a point light, but this is more expensive.
I guess, you use a directional light, some of your expected behaviours are not possible with that. Please give some mor infos of your light stuff


greetings

Share this post


Link to post
Share on other sites
Before setting the light position are you loading the identity matrix? ie


  

glPushMatrix();
glLoadIdentity();
SetLightPos();
glPopMatrix();

RenderWorld();



-Weasalmongler

Share this post


Link to post
Share on other sites
I am experiancing similar effects here, and i don't think that it has anything to do with 'point lights' or 'directional lights'. When i rotate my scene, then the light rotates with it ... how could that be?

[edited by - Jonus on September 13, 2002 3:46:18 PM]

Share this post


Link to post
Share on other sites
Does gluPerspective() or gluLookAt() influence the values of my lights?

I am rotating my scene with gluLookAt() and the meshes are totaly wrong shaded ...

I mix up perspective (landscape,meshes,...) and orthogonal(gui) projection and the light position seems to me like random. There are totally strange side effects in OpenGL. Any hints?


[edited by - Jonus on September 13, 2002 8:59:50 PM]

Share this post


Link to post
Share on other sites
glPushMatrix();
glLoadIdentity();
SetLightPos();
glPopMatrix();
RenderWorld();

wont work

to find a solution check www.opengl.org right side of page the opengl FAQ

http://uk.geocities.com/sloppyturds/gotterdammerung.html

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!