Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GPUShaders::Common::Common_parallax Class Reference

Common parallax general shader. More...

Public Member Functions

vec2 parallax (vec2 uv, vec3 vTangentDir, texture2D depth, out float shiftDistance)
 
vec3 updateFragmentPosition (float shiftDistance, vec3 viewPos, mat4 proj)
 

Detailed Description

Common parallax general shader.

See also
GPUShaders::Common::Samplers

Member Function Documentation

◆ 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
uvthe initial texture coordinates
vTangentDirthe view direction in tangent space
depththe heightmap
shiftDistancewill 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
shiftDistancethe shift along the view direction
viewPosthe initial view space fragment position
projthe 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: