View Full Version : Cube Map Cg Shader - hard

05-05-2005, 03:25 AM
Im doing a simple cube map shader for Cg using OpenGL...
If a make a simple sphere with no transformations (rotation, translate,...) the cube map work ok!
But when a make one of them the distortion in the reflexion appears...

So I remembered that I need to multiply the incoming vertex by the MODELVIEW and the incoming NORMAL by the MODELVIEW INVERSETRANSPOSE
but when I do it the vectors used by the cubemap function will be always in the same place in the Camera Reference System and the reflexion in the object will be the same always...

And now the real problem I played a bit in the FXComposer and see that it can get only the MODEL matrix (with no camera transformation) and that MODEL matrix I need to transform the incoming vertex and normal properly...

Anyone know how can I get this matrix?? And more specifically... without creating and managing one created by me?


05-10-2005, 05:38 PM
Well, lemme throw you a bone. The MODELVIEW matrix converts object space points to camera space points. What you're probably interested in are world space coordinates... So what you're going to need to do is somehow figure out the world->camera matrix or the object->world matrix, and work out your math accordingly.