mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 19:53:48 +00:00
Companion PR to #719
Adds the OGL side. redoing it to make sure the PR history is clean.
This commit is contained in:
parent
95ab3a33a5
commit
71c19a6151
4 changed files with 50 additions and 4 deletions
|
|
@ -150,6 +150,21 @@ vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float dept
|
|||
return offset;
|
||||
}
|
||||
|
||||
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
|
||||
vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale)
|
||||
{
|
||||
float depth = texture(texMap, texCoord).r;
|
||||
vec2 offset = negViewTS.xy * (depth * depthScale);
|
||||
|
||||
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
|
||||
{
|
||||
depth = (depth + texture(texMap, texCoord + offset).r) * 0.5;
|
||||
offset = negViewTS.xy * (depth * depthScale);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/// The maximum value for 16bit per component integer HDR encoding.
|
||||
const float HDR_RGB16_MAX = 100.0;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,21 @@ vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float dept
|
|||
return offset;
|
||||
}
|
||||
|
||||
/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha
|
||||
vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale)
|
||||
{
|
||||
float depth = texture(texMap, texCoord).r;
|
||||
vec2 offset = negViewTS.xy * (depth * depthScale);
|
||||
|
||||
for (int i = 0; i < PARALLAX_REFINE_STEPS; i++)
|
||||
{
|
||||
depth = (depth + texture(texMap, texCoord + offset).r) * 0.5;
|
||||
offset = negViewTS.xy * (depth * depthScale);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
/// The maximum value for 16bit per component integer HDR encoding.
|
||||
const float HDR_RGB16_MAX = 100.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue