Jump to content
  • Advertisement
Sign in to follow this  
Code-R

Eye space? World space? I'M LOST!

This topic is 4591 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 a bit lost about this. now, when I specify a vertex/normal using the glVertex/Normal calls, I specify it in Model space. now, Multiplying that in my shader with the ModelView matrix yields it in Eye space (I'm not sure i'm even correct about this). now, how can I get it in WORLD space? and what's the difference between world space (global coord, if i know what i'm blabbering about) and eye space? TIA

Share this post


Link to post
Share on other sites
Advertisement
>> I specify it in Model space.

Usually in GL land it's called Object space but Model space works fine too. :)

>> how can I get it in WORLD space?

You'll have to keep track of your matrices yourself for this one. To get into world coordinates (space) you'd need to multiply by the model part of the modelview matrix. But since GL puts those two matrices together, that's why you would need to keep track of the matrices yourelf.

>> and what's the difference between world space and eye space?

Eye space is where the eye is at the origin, world it's not. The viewing transform after the modelling transform is what makes this happen. There's some old presentations (from quite a few years ago) at NVIDIA's dev site that talk about per pixel lighting/bump mapping by Cass Everitt that describe this with pictures.



-SirKnight

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The ModelView matrix is a combination of the model-to-world transform and the world-view transform, allowing you to do the model-to-view (view space == eye space) transform in one step. Eye/view space is the world transformed so it is viewed from your (or your eye's/camera's) location. To get from model space to world space you just need the model-to-world transform (i.e. the combination of translations, rotations, and scales you apply to your model to get it in the right position).

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
The ModelView matrix is a combination of the model-to-world transform and the world-view transform, allowing you to do the model-to-view (view space == eye space) transform in one step. Eye/view space is the world transformed so it is viewed from your (or your eye's/camera's) location. To get from model space to world space you just need the model-to-world transform (i.e. the combination of translations, rotations, and scales you apply to your model to get it in the right position).


Bugger, that was me (too trigger-happy with the 'Ok'/'Cancel' prompt)! Hope it's some help. :)

Share this post


Link to post
Share on other sites
ok, that made it clear now! thanks, ratings++. But I hve one more question: how can I transform a point/vector (mainly a light's position/direction) from worldspace to eyespace, given the eye's view position, direction and up vector?

edit: Got some idea, not sure about it. by acquiring the right vector (view dir cross up dir), I can get a 3x3 matrix (front, up and right - not sure how should I order them though) that I could multiply the 3d position , as a vector by it (or multiply it by the vector - as you can see I'm not that good at math: I got the rought concept but I need some guidance through the details.)

Share this post


Link to post
Share on other sites
Quote:
Original post by Code-R
ok, that made it clear now! thanks, ratings++. But I hve one more question: how can I transform a point/vector (mainly a light's position/direction) from worldspace to eyespace, given the eye's view position, direction and up vector?

edit: Got some idea, not sure about it. by acquiring the right vector (view dir cross up dir), I can get a 3x3 matrix (front, up and right - not sure how should I order them though) that I could multiply the 3d position , as a vector by it (or multiply it by the vector - as you can see I'm not that good at math: I got the rought concept but I need some guidance through the details.)


Take a look at the bottom of this man page for a world space to eye space transformation matrix given the eye's translation, view vector, and up vector.

Share this post


Link to post
Share on other sites
thanks, I'll be using it. I have no idea why they didn't pack the translate call into the matrix too, but I'll be doing it. thanks a lot, rating++.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!