Zulfiqar Malik
09-01-2005, 03:39 AM
I have a world with lots of different objects where each object is in object space and i translate it directly to eye space using glTranslatef(...) etc. etc.
Also some of my objects can use a reflection material and their fragment program will access a cube map passed by the application for reflection texel lookup. The reflection vector is calculated per-vertex and interpolated value is used in fragment shader. Now the problem is that a cube map lookup vector must be in world space (at least thats whats documented, since a cube map is in world space) and the input positions of my vertexes are in object space whereas output vertexes are in clip space. I need to have vertexes in world space so that i can do proper cube map lookups and that's not available in OpenGL. I want to know whether there is a way to have proper cube map lookups using a reflection vector in eye space (as that's available in GL), or do i have to create a world space matrix logic in application? But by doing so i would be transferring load to the CPU which i don't want!
Are there any other work arounds because cube maps are fairly common these days, and lots of games out there use them. Thanks in advance.
Also some of my objects can use a reflection material and their fragment program will access a cube map passed by the application for reflection texel lookup. The reflection vector is calculated per-vertex and interpolated value is used in fragment shader. Now the problem is that a cube map lookup vector must be in world space (at least thats whats documented, since a cube map is in world space) and the input positions of my vertexes are in object space whereas output vertexes are in clip space. I need to have vertexes in world space so that i can do proper cube map lookups and that's not available in OpenGL. I want to know whether there is a way to have proper cube map lookups using a reflection vector in eye space (as that's available in GL), or do i have to create a world space matrix logic in application? But by doing so i would be transferring load to the CPU which i don't want!
Are there any other work arounds because cube maps are fairly common these days, and lots of games out there use them. Thanks in advance.