|
Ray | cameraRay (vec2 pixelPosition, vec4 projInfo) |
|
float | depthBufferValue (float csZ, vec3 clipInfo) |
|
Converts a camera-space Z value to a depth buffer value. More...
|
|
bool castScreenSpaceRay() | numLayers (vec3 csOrigin, vec3 csDirection, mat4 projectionMatrix, sampler2D csZBuffer, vec2 csZBufferSize, vec3 clipInfo, float jitterFraction, const int numSteps, out int s, float layerThickness, in float maxRayTraceDistance, out float actualRayTraceDistance, out vec2 hitTexCoord, out int which, const in bool csZBufferIsHyperbolic, float GUARD_BAND_FRACTION_X, float GUARD_BAND_FRACTION_Y) |
| Ray march against thickened depth buffer surface. More...
|
|
vec3 | reconstructCSFaceNormal (vec3 C) |
| Reconstructs screen-space unit normal from screen-space position. More...
|
|
vec3 | reconstructCSPosition (vec2 S, float z, vec4 projInfo) |
| Reconstruct camera-space C.xyz from screen-space S = (x, y) in pixels and camera-space z < 0. More...
|
|
vec3 | reconstructCSPositionFromDepth (vec2 S, float depth, vec4 projInfo, vec3 clipInfo) |
| Helper for reconstructing camera-space P.xyz from screen-space S = (x, y) in pixels and hyperbolic depth. More...
|
|
float | reconstructCSZ (float d, vec3 clipInfo) |
|
vec3 | reconstructNonUnitCSFaceNormal (vec3 C) |
|
vec3 | reconstructWSPositionFromDepth (vec2 S, float depth, vec4 projInfo, vec3 clipInfo, mat4x3 cameraToWorld) |
| Helper for the common idiom of getting world-space position P.xyz from screen-space S = (x, y) in pixels and hyperbolic depth. More...
|
|
Ray | worldRay (vec2 pixelPosition, mat4x3 cameraToWorld, vec4 projInfo, out float csRayZ) |
|
More...
|
|
Ray | worldRay (vec2 pixelPosition, mat4x3 cameraToWorld, vec4 projInfo) |
| Given pixel coordinates and camera data (e.g., g3d_CameraToWorldMatrix and g3d_ProjInfo or Camera.frame and Camera.projInfo), returns the world space ray through the pixel position. More...
|
|
Routines for reconstructing linear Z, camera-space position, and camera-space face normals from a standard or infinite OpenGL projection matrix from G3D.
vec3 glsl::reconstructFromDepth_glsl::reconstructCSPosition |
( |
vec2 |
S, |
|
|
float |
z, |
|
|
vec4 |
projInfo |
|
) |
| |
|
inline |
Reconstruct camera-space C.xyz from screen-space S = (x, y) in pixels and camera-space z < 0.
Assumes that the upper-left pixel center is at (0.5, 0.5) [but that need not be the location at which the sample tap was placed!]
Costs 3 MADD. Error is on the order of 10^-3 at the far plane, partly due to z precision.
In C++ (not GLSL, which transposes the matrices!), compute projInfo as
projInfo = Vector4(-2.0f / (width*P[0][0]), -2.0f / (height*P[1][1]), ( 1.0f - P[0][2]) / P[0][0], ( 1.0f - P[1][2]) / P[1][1])
where P is the projection matrix that maps camera space points to [-1, 1] x [-1, 1]. That is, Camera::getProjectUnit().
- See also
- G3D::Projection::reconstructFromDepthProjInfo