{
float maxDisplacement = 0.0;
#if defined(_HEIGHTMAP)
// TEMP: achieve parity between tessellation and POM w.r.t. height for a single tile.
// TODO: for tiling, the max. height of the tessellated height map should be reduced by NumTiles.
maxDisplacement = 0.1 * _HeightAmplitude;
maxDisplacement = _HeightAmplitude;
#endif
return maxDisplacement;
}
float3 viewDirTS = isPlanar ? float3(-V.xz, V.y) : TransformWorldToTangent(V, worldToTangent);
int numSteps = (int)lerp(_PPDMaxSamples, _PPDMinSamples, viewDirTS.z);
float2 offset;
ParallaxOcclusionMapping(lod, _PPDLodThreshold, numSteps, viewDirTS, maxHeight, ppdParam, offset, height);
// TEMP: 0.1 to achieve parity between tessellation and POM w.r.t. height for a single tile.
ParallaxOcclusionMapping(lod, _PPDLodThreshold, numSteps, viewDirTS, 0.1 * maxHeight, ppdParam, offset, height);
// Apply offset to all UVSet
layerTexCoord.base.uv += offset;
return height * maxHeight;
// Since POM "pushes" geometry inwards (rather than extrude it), { height = height - 1 }.
return height * maxHeight - maxHeight;
return 0.0;
float depthOffset = ApplyPerPixelDisplacement(input, V, layerTexCoord);
// TODO: remove the scale once the bug is fixed.
depthOffset = depthOffset * 6.0;
#ifdef _DEPTHOFFSET_ON
ApplyDepthOffsetPositionInput(V, depthOffset, _ViewProjMatrix, posInput);
float4 planarWeight = float4( layerTexCoord.base0.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base1.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base2.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0,
layerTexCoord.base3.mappingType == UV_MAPPING_PLANAR ? 1.0 : 0.0);
layerTexCoord.base0.uv += offsetWeights.x * offset;
layerTexCoord.base1.uv += offsetWeights.y * offset;
layerTexCoord.base2.uv += offsetWeights.z * offset;
layerTexCoord.details3.uv += offsetWeights.w * offset;