浏览代码

HDrenderPipeline: Add some comment to shadow tessellation fix

/RenderPassXR_Sandbox
sebastienlagarde 7 年前
当前提交
b010d5c1
共有 8 个文件被更改,包括 58 次插入9 次删除
  1. 15
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl
  2. 3
      Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Gray.mat
  3. 3
      Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Green.mat
  4. 3
      Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Red.mat
  5. 3
      Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Std_Blue_Emissive.mat
  6. 40
      ImageTemplates/HDRenderPipeline/Scenes/0002-Subsurface scattering.unity.png

15
Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.hlsl


{
float maxDisplacement = GetMaxDisplacement();
// For tessellation we want to process tessellation factor always from the point of view of the camera (to be consistent and avoid Z-fight).
// For the culling part however we want to use the current view (shadow view).
// Thus the following code play with both.
bool frustumCulled = WorldViewFrustumCull(p0, p1, p2, maxDisplacement, (float4[4])_FrustumPlanes);
bool frustumCulled = WorldViewFrustumCull(p0, p1, p2, maxDisplacement, (float4[4])_FrustumPlanes); // _FrustumPlanes are primary camera planes
bool frustumCulled = WorldViewFrustumCull(p0, p1, p2, maxDisplacement, (float4[4])unity_CameraWorldClipPlanes);
bool frustumCulled = WorldViewFrustumCull(p0, p1, p2, maxDisplacement, (float4[4])unity_CameraWorldClipPlanes); // unity_CameraWorldClipPlanes is set by legacy Unity in case of shadow and contain shadow view plan
#endif
bool faceCull = false;

if (_TessellationBackFaceCullEpsilon > -0.99) // Is backface culling enabled ?
{
faceCull = BackFaceCullTriangle(p0, p1, p2, _TessellationBackFaceCullEpsilon, GetCurrentViewPosition());
faceCull = BackFaceCullTriangle(p0, p1, p2, _TessellationBackFaceCullEpsilon, GetCurrentViewPosition()); // Use shadow view
}
#endif

if (_TessellationFactorTriangleSize > 0.0)
{
// return a value between 0 and 1
tessFactor *= GetScreenSpaceTessFactor( p0, p1, p2, _ViewProjMatrix, _ScreenSize, _TessellationFactorTriangleSize);
tessFactor *= GetScreenSpaceTessFactor( p0, p1, p2, _ViewProjMatrix, _ScreenSize, _TessellationFactorTriangleSize); // Use primary camera view
float3 distFactor = GetDistanceBasedTessFactor(p0, p1, p2, GetPrimaryCameraPosition(), _TessellationFactorMinDistance, _TessellationFactorMaxDistance);
float3 distFactor = GetDistanceBasedTessFactor(p0, p1, p2, GetPrimaryCameraPosition(), _TessellationFactorMinDistance, _TessellationFactorMaxDistance); // Use primary camera view
// We square the disance factor as it allow a better percptual descrease of vertex density.
tessFactor *= distFactor * distFactor;
}

3
Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Gray.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Gray
m_Shader: {fileID: 0}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []

3
Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Green.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Green
m_Shader: {fileID: 0}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []

3
Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Red.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Red
m_Shader: {fileID: 0}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []

3
Assets/TestScenes/HDTest/Material/StandardShaderMaterials/Std_Blue_Emissive.mat


m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Std_Blue_Emissive
m_Shader: {fileID: 0}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []

40
ImageTemplates/HDRenderPipeline/Scenes/0002-Subsurface scattering.unity.png
文件差异内容过多而无法显示
查看文件

正在加载...
取消
保存