Hi, I am trying to reproduce a paper for shader planet. I am generating a plane mesh on which I apply the spatial shader for verices displacement. However, I need the plane to always face the camera - it's simple on CPU (look_at function) but I need to do in inside the shader to get proper VERTEX positions. In the paper there is an equation for computing the Rotation matrix as follow:
vec3 w =normalize(cam_pos);
vec3 v = normalize(w * vec3(0,0,1));
vec3 u = w*v;
mat3 R = mat3(u, v, w) ;
My question is: How to apply the Rotation matrix R to rotate the whole mesh? Should I somehow apply it on MODELVIEW_MATRIX? How to use mat3 to edit mat4?
Thanks for any help 😉