Common parallax general shader.
More...
|
| vec2 | parallax (vec2 uv, vec3 vTangentDir, texture2D depth, out float shiftDistance) |
| |
| vec3 | updateFragmentPosition (float shiftDistance, vec3 viewPos, mat4 proj) |
| |
Common parallax general shader.
- See also
- GPUShaders::Common::Samplers
◆ parallax()
| vec2 GPUShaders::Common::Common_parallax::parallax |
( |
vec2 |
uv, |
|
|
vec3 |
vTangentDir, |
|
|
texture2D |
depth, |
|
|
out float |
shiftDistance |
|
) |
| |
|
inline |
Perform parallax mapping by marching against the local depth map, and output the final UV to use.
- Parameters
-
| uv | the initial texture coordinates |
| vTangentDir | the view direction in tangent space |
| depth | the heightmap |
| shiftDistance | will contain the final shift along the view direction |
- Returns
- the final texture coordinates to use to query the material maps
◆ updateFragmentPosition()
| vec3 GPUShaders::Common::Common_parallax::updateFragmentPosition |
( |
float |
shiftDistance, |
|
|
vec3 |
viewPos, |
|
|
mat4 |
proj |
|
) |
| |
|
inline |
Compute the new view space position of the parallax-mapped fragment and update its depth in the depth buffer.
- Parameters
-
| shiftDistance | the shift along the view direction |
| viewPos | the initial view space fragment position |
| proj | the projection matrix |
- Returns
- the updated position
- Bug:
- Depth output is sometimes incorrect, leading to floating effects on the surface of the object.
The documentation for this class was generated from the following file:
- resources/common/shaders/objects/common_parallax.glsl