   Transforming points into "spaces" in lighting equations
  I was wondering when transforming points in a vertex shader does it matter what "space" they're in when it comes to lighting.  Meaning one can transform the points into "world" space by multiplying it by the world matrix, etc.Is there a standard way to do this or does it depend on the lighting model?   
  Doesn't matter as long as your "spaces" are consistent.  For example, if your vertex coordinate is in world space, make sure that your light position is also in world space.   ;  Use world-space if possible. Just as a procuderual matter.Most of the samples out there use worldspace so they'll just work easier when you come to adapt them to your own ends.Another one is that if you start to use hardware instancing, it's much easier to deal with worldspace matrices coming through in the 2nd stream.   ;Quote:Original post by rofseekIs there a standard way to do this or does it depend on the lighting model?I think it depends more on what effect your trying to achieve. For example, with phong shading you need a vector from the point your shading to the viewers eye position. You can achieve that by passing in the eye position in world space but in view space, the eye is always at 0,0,0 so if you work in eye space then things become simpler.Normal mapping etc is best suited to being done in tangent space. In general, world space is much easier to understand so its a good choice but some things are far easier to achieve just by using a different space. As others have said, as long as everything is consistent you won't have a problem.;Quote:Original post by rofseekIs there a standard way to do this or does it depend on the lighting model?At least for deferred rendering  I'm pretty sure that the standard way of doing it is to use camera space. Many modern games use some kind of deferred rendering nowadays (including light prepass etc.).;  I use camera space. Phong/Blinn and most shadowing effects usually need (see: are simpler to do) stuff in eye space.The main thing here is that it doesn't realllly matter which space you choose to use, just as long as in any related calculations all points, vectors planes etc etc are all in the same space.One thing I would strongly recommend, is finding a list of the different spaces used in rasterization, and at each stage understanding what each associated transform matrix does to the vectors it operates on. Once you have a strong grasp of why conversions happen and what the resulting conversions are, this worry over "which space should I use" fades into the background.   