Advertisement Jump to content
Sign in to follow this  

How to get a ray in view space in volume rendering

This topic is 677 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


In PS, I want to get a ray in view space to do volume rendering.

Let's say I have the camera position in the view space. I want to get the other end of the ray corresponding with the screen position. So I can define the ray.

My question is how to convert the screen position to view space in PS?


Thanks a lot.



Share this post

Link to post
Share on other sites
The camera position in view space ? It is the origin : float3(0,0,0) :)

The viewspace ray can be determine from the screen coordinate normalize to -1..1, add a fake z that represent something like the far plane (value depends on the kind of projection you use), w set to 1 and multiply by the inverse projection. Divide the result by w, normalize the float3, and you have your viewdirection

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!