浏览代码

Remove the temporal component from the LOD transition

/RenderPassXR_Sandbox
Evgenii Golubev 8 年前
当前提交
4787f47e
共有 2 个文件被更改,包括 6 次插入5 次删除
  1. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
  2. 7
      Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl

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


void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
LODDitheringTransition(posInput.unPositionSS, unity_LODFade.x, _Time.x);
LODDitheringTransition(posInput.unPositionSS, unity_LODFade.x);
#endif
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal

void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{
#ifdef LOD_FADE_CROSSFADE // enable dithering LOD transition if user select CrossFade transition in LOD group
LODDitheringTransition(posInput.unPositionSS, unity_LODFade.x, _Time.x);
LODDitheringTransition(posInput.unPositionSS, unity_LODFade.x);
#endif
ApplyDoubleSidedFlipOrMirror(input); // Apply double sided flip on the vertex normal

7
Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl


// LOD dithering transition helper
// LOD0 must use this function with ditherFactor 1..0
// LOD1 must use this function with ditherFactor 0..1
void LODDitheringTransition(uint2 unPositionSS, float ditherFactor, float time)
void LODDitheringTransition(uint2 unPositionSS, float ditherFactor)
// Generate a spatio-temporally varying pattern.
float p = GenerateHashedRandomFloat(uint3(unPositionSS, asuint(time)));
// Generate a spatially varying pattern.
// Unfortunately, varying the pattern with time confuses the TAA, increasing the amount of noise.
float p = GenerateHashedRandomFloat(unPositionSS);
// We want to have a symmetry between 0..0.5 ditherFactor and 0.5..1 so no pixels are transparent during the transition
// this is handled by this test which reverse the pattern

正在加载...
取消
保存