- Home /
How do you get a camera's view direction with rotation in a shader
So I am making an unlit shader that uses raymarching to draw clouds. I need the direction from the camera to a pixel so I can take raymarching steps in that direction. However, the function WorldSpaceViewDir does not take camera rotation into account, it just calculates the camera offset to a point in space. Is there a way to fix that, any help would be greatly appreciated.
Comment
What do you mean by 'does not take camera rotation into account' - view direction is the vector from the camera's position to the current pixel's world position; camera rotation doesn't matter at that point as the value will always be the same regardless.