Hello Erik,

Erik Podetti wrote:
> Hi everybody.
> I would like to know if it would be possible to extract or save in any 
> way the precomputed gl_NormalMatrix matrix from a shader. As I'm 
> implementig a deferred shader I saved normals in world coordinate and I 
> need to transform them in eye-space (mgr->camera point of view) inside a 
> PolygonForeground shader (where the gl_NormalMatrix is obviously 
> incoherent).


as Marcus already said, the gl_NormalMatrix is the transpose of the 
inverse of the gl_ModelViewMatrix. It transforms normals from object to 
eye space. You are saying that you store normals in world coordinates, 
so what you need is the inverse transpose of the viewing matrix, to 
transform the normals into eye space.
You get the viewing matrix from Camera::getViewing().

        Hope it helps,
                Carsten

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to