浏览代码

Fix view-space depth for POM (again)

/Branch_Batching2
Evgenii Golubev 7 年前
当前提交
185e4373
共有 2 个文件被更改,包括 9 次插入5 次删除
  1. 8
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  2. 6
      Assets/ScriptableRenderPipeline/ShaderLibrary/PerPixelDisplacement.hlsl

8
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl


#if defined(_HEIGHTMAP)
maxDisplacement = _HeightAmplitude;
#endif
return maxDisplacement;
// TODO: explain this 0.5 factor. It is likely related to the fact that
// setting the amplitude to 2 in the UI only results in the max. displacement of 1.
return 0.5 * maxDisplacement;
}
// Return the minimun uv size for all layers including triplanar

#endif
#endif
return maxDisplacement;
// TODO: explain this 0.5 factor. It is likely related to the fact that
// setting the amplitude to 2 in the UI only results in the max. displacement of 1.
return 0.5 * maxDisplacement;
}
// Return the minimun uv size for all layers including triplanar

6
Assets/ScriptableRenderPipeline/ShaderLibrary/PerPixelDisplacement.hlsl


// ref: https://www.gamedev.net/resources/_/technical/graphics-programming-and-theory/a-closer-look-at-parallax-occlusion-mapping-r3262
float2 ParallaxOcclusionMapping(float lod, float lodThreshold, int numSteps, float3 viewDirTS, float maxHeight, PerPixelHeightDisplacementParam ppdParam, out float outHeight)
{
// TEMP: 0.1 to 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.
maxHeight *= 0.1;
// TEMP: 1/5 to achieve parity between tessellation and POM w.r.t. height for a single tile.
// TODO: explain this factor. Is there a connection with the number of samples?
maxHeight *= 0.2;
// Convention: 1.0 is top, 0.0 is bottom - POM is always inward, no extrusion
float stepSize = 1.0 / (float)numSteps;

正在加载...
取消
保存