lygia
/v1.1.6
/sample
/viewPosition
)sampler the view Positiong from depthmap texture
Dependencies:
lygia
/v1.1.6
/space
/depth2viewZ
.glsl
lygia
/v1.1.6
/space
/screen2viewPosition
.glsl
lygia
/v1.1.6
/sample
.glsl
Use:
<vec4> sampleViewPosition(<SAMPLER_TYPE> texDepth, <vec2> st [, <float> near, <float> far])
#ifndef FNC_SAMPLEVIEWPOSITION
#define FNC_SAMPLEVIEWPOSITION
vec4 sampleViewPosition(const in float depth, const in vec2 st, const in float near, const in float far) {
float viewZ = depth2viewZ(depth, near, far);
return screen2viewPosition(st, depth, viewZ);
}
vec4 sampleViewPosition(SAMPLER_TYPE texDepth, const in vec2 st, const in float near, const in float far) {
float depth = SAMPLER_FNC(texDepth, st).r;
float viewZ = depth2viewZ(depth, near, far);
return screen2viewPosition(st, depth, viewZ);
}
#if defined(CAMERA_NEAR_CLIP) && defined(CAMERA_FAR_CLIP)
vec4 sampleViewPosition(SAMPLER_TYPE texDepth, const in vec2 st) {
return sampleViewPosition( texDepth, st, CAMERA_NEAR_CLIP, CAMERA_FAR_CLIP);
}
#endif
#endif
Dependencies:
lygia
/v1.1.6
/space
/depth2viewZ
.glsl
lygia
/v1.1.6
/space
/screen2viewPosition
.glsl
lygia
/v1.1.6
/sample
.glsl
Use:
<float4> sampleViewPosition(<SAMPLER_TYPE> texDepth, <float2> st [, <float> near, <float> far])
#ifndef FNC_SAMPLEVIEWPOSITION
#define FNC_SAMPLEVIEWPOSITION
float4 sampleViewPosition(const in float depth, const in float2 st, const in float near, const in float far) {
float viewZ = depth2viewZ(depth, near, far);
return screen2viewPosition(st, depth, viewZ);
}
float4 sampleViewPosition(SAMPLER_TYPE texDepth, const in float2 st, const in float near, const in float far) {
float depth = SAMPLER_FNC(texDepth, st).r;
float viewZ = depth2viewZ(depth, near, far);
return screen2viewPosition(st, depth, viewZ);
}
#if defined(CAMERA_NEAR_CLIP) && defined(CAMERA_FAR_CLIP)
float4 sampleViewPosition(SAMPLER_TYPE texDepth, const in float2 st) {
return sampleViewPosition( texDepth, st, CAMERA_NEAR_CLIP, CAMERA_FAR_CLIP);
}
#endif
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository