Jump to content

[SOLVED] how can I get camera direction in shader?


photo

Recommended Posts

Posted

I want to write a custom shader for ObjectDynamic, which will need a camera direction. but the shader system has no variable defined as s_camera_dir or s_camera_direction.

 

so how can I get the camera's direction in shader?

 

I'm assuming using column 3 of s_imodelview matrix should be the camera direction. But I'm not sure this is right.

Posted

Unigine render is camera relative. So in terms of shaders camera direction is 0,0,1 or (0,0,-1). s_imodelview matrix is required only if you need to get world-space camera direction.

Posted

Yes, I need the world space camera direction, so column 3 of s_imodelview is the camera direction in world space?

×
×
  • Create New...