Jump to content
  • Advertisement

Archived

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

orange144

Environment mapping: what if I change the viewpoint?

This topic is 5211 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

(not sure the subject is clear enough.) First, hi everyone! I''ve got a problem using GL_SPHERE_MAP on my application... let me explain: I''m working on the simulation & rendering of the ocean. I draw a big big mesh in front of the camera, and I want it to reflect the sky... in other words my sky texture, which is juste blue sky with clouds. Using environment mapping with GL_SPHERE_MAP seemed to be the good idea, but all goes bad when I try to move the camera (yeah, I know in opengl you don''t "move the camera". I just glulookat, thanks ;-) ) So if I move the camera up and down (if I look up or down), it looks ok, but when I try to turn the camera left or right, the texture mapped on my ocean doesn''t change at all! I always see the same cloud on my ocean! :D :/ I''m kinda convinced it''s the way it''s meant to work, but that''s not how i want it to work! help! Seriously, if anyone can explain... thanks! (ha! it says "Store my login information on my PC"... I''ve got a mac, you insensitive clod! )

Share this post


Link to post
Share on other sites
Advertisement
Could you tell a bit more? Like what are you using for the water? Pixel shaders? Then why dont you show some code of how you get the eye vector and the reflected vector?

It really should be real simple:

(In world space)

1) eye_vector = vertex(or pixel)_position - eyeposition;
2) reflected_vector = reflect(eye_vector,normal); //there is this really cool reflect function in Cg i dont know the math behind it, so if youre doing the reflecing manually, you may have got something wrong there
3) out_color = texSPHERE(Sky,reflected_vector);

[edited by - Bouga on May 8, 2004 2:15:57 PM]

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!