world view spaces clarification

Started by
-1 comments, last by edwinnie 17 years, 7 months ago
Hi guys! I need some clarification on understanding some of the math. Basically, I am trying to reconstruct world space position for a pixel.

//VS
//IN.vPosition are clipspace positions for a fullscreen quad
//eyeViewProjInvMatrix - user camera's view projection inverse matrix
half4 rayScreenPos = half4(IN.vPosition,1.0,1.0);
half3 rayDirection = mul(rayScreenPos,eyeViewProjInvMatrix);

//PS
//reconstruct world position
//ray direction interpolated from fullscreen quad
//g_EyeWorldPosition - user camera's worldspace position
half3 rayDirection = normalize(IN.rayDirection);
half viewDepth = //viewspace depth
half3 worldPosition = g_EyeWorldPosition + viewDepth * rayDirection;

is this theortically correct? thx! Edwin

This topic is closed to new replies.

Advertisement