Tangent-Space to World-Space

I recently wrote a GLSL shader that tried to convert light posistion, spot direction, and eye posisition to tangent space. I tried to do this for all eight lights. It didnt’ work. It turns out you can’t pass that much data from a vertex shader to a fragment shader.

Instead, I was wondering if there was some way of translating the normal-map value from tangent space to world space?

This would let me pass only one varying vec4 instead of 13.

AdamNation :slight_smile:

You can send transformation matrix from tangent space to world space into fragment shader and do the transformation of normal stored in a normal map there…

( this is often done when you are using cube-map environment mapping with bumpmapping becouse you to get the right value from cube map you need to provide correct world - space coordinates )

Great does anybody know how to invert a matrix inside a fragment shader?