# viewInverse matrix transform! plz help!!

hello!
I was cheking some demos (like dispersion demo) from nVidias Site.
And in the OGLSLang vertex shader program i found this:

// transform eye position to world space
vec4 worldEyePos = viewInverse * eyePos;

viewInverse and eyePos are uniforms. But how I will find the viewInverce matrix?
I have seen a lot of demos that uses the view Invert Matrix. BUt I dont undersatnd how to find it! Some resource i find saying just make the matrix from M[i][j] to M[j][i] some others saying other ways to do it! I am confuzed! Can someone tell me how i can calculate the viewInverse Matrix?

thanks in advance!

You can take the view matrix and invert it. This is an expensive mathematical operation. Search for full matrix invert or equivalent. For some matrices (orthogonal matrices which is very probably your viewing matrix under most circumstances) the transpose (i,j becomes j,i) is the equivalent of a full invert, but much less expensive to calculate (not really any calculation).

It is best to calculate this once each frame in the application.