Original Post
Hi everyone!
I'm trying to implement sun shafts in my pixel shader. So I need to compute the sun direction relative to the screen / view direction.
I got the following globals:
The latter two I'm not sure whether they are absolute or not. However with the right math it should be easy to find out.
What I'm missing now is the math / formula for getting the view-relative sun direction out of those values. Should be a no-brainer for the experienced guys of you, but for me it's quite hard to figure out.
Who can help me with that math?
I'm trying to implement sun shafts in my pixel shader. So I need to compute the sun direction relative to the screen / view direction.
I got the following globals:
L_sun_dir_w // absolute (world coords) sun direction
eye_direction // direction of the camera
eye_position // position of the camera
The latter two I'm not sure whether they are absolute or not. However with the right math it should be easy to find out.
What I'm missing now is the math / formula for getting the view-relative sun direction out of those values. Should be a no-brainer for the experienced guys of you, but for me it's quite hard to figure out.
Who can help me with that math?