MinZe Posted August 24, 2018 Share Posted August 24, 2018 Hi! I'm trying to extract the position for every pixel in my pixel shader. I need it to calculate the direction from the camera to each pixel. How can I achieve this? Quote Link to comment Share on other sites More sharing options...
Guest Posted August 24, 2018 Share Posted August 24, 2018 Do you need it in projected space or world space? (if world space, you have to create a varying and fill it in the vertex shader) Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted August 25, 2018 Share Posted August 25, 2018 vec3 dir = normalize(vPositionW - vEyePosition); http://www.babylonjs-playground.com/#L3PEXN#21 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.