Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jakhh8 |
Im writing a shader where i need to use the world normal of an object ad i have read that i can calculate that by multiplying NORMAL
by the x, y and z components of INV_CAMERA_MATRIX.x
, .y
and .z
but it throws this error:
Invalid member for mat4 expression: .x
It says the error is from line 3
void vertex()
{
vec4 invcamx = INV_CAMERA_MATRIX.x; // The error is here
vec4 invcamy = INV_CAMERA_MATRIX.y;
vec4 invcamz = INV_CAMERA_MATRIX.z;
vec4 invcamw = INV_CAMERA_MATRIX.w;
mat3 invcam = mat3(invcamx.xyz, invcamy.xyz, invcamz.xyz);
worldNormal = NORMAL * invcam;
}