浏览代码

Fixed: use signed integer for distortion

/stochastic_alpha_test
Frédéric Vauchelles 7 年前
当前提交
e95e8e4e
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.hlsl
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/ApplyDistorsion.compute

4
ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.hlsl


// RT - 16:16:16:16 float
// distortionBlur in alpha for a different blend mode
// Tag pixel as a pixel that can be used as source for distortion (b != 0)
// It is compatible with blend mode: either Add or Multiply
// It is compatible with Add blend mode (a pixel cannot be a valid distortion source only if there is no distorting object in front of it)
outBuffer = float4(distortion, validSourceForDistortion ? 1.0 : 0.0, distortionBlur);
}

distortionBlur = inBuffer.a;
validSourceForDistortion = inBuffer.z > 0.1 || inBuffer.z < 0.1;
validSourceForDistortion = inBuffer.z != 0.0;
}
void GetBuiltinDataDebug(uint paramId, BuiltinData builtinData, inout float3 result, inout bool needLinearToSRGB)

4
ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/ApplyDistorsion.compute


DecodeDistortion(encodedDistortion, distortion, distortionBlur, validForDistortion);
// Get distortion source pixel mask (stored in _DistortionTexture.z)
uint2 distortedEncodedDistortionId = dispatchThreadId + uint2(distortion);
uint2 distortedEncodedDistortionId = dispatchThreadId + int2(distortion);
float2 distordedDistortion;
float2 distordedDistortionBlur;

if (distordedValidForDistortion && validForDistortion)
{
// Get source pixel for distortion
float2 distordedUV = float2(dispatchThreadId + uint2(distortion * _FetchBias)) * _Size.zw;
float2 distordedUV = float2(dispatchThreadId + int2(distortion * _FetchBias)) * _Size.zw;
float mip = (_GaussianPyramidColorMipSize.z - 1) * clamp(distortionBlur.x, 0.0, 1.0);
float4 sampled = _GaussianPyramidColorTexture.SampleLevel(sampler_GaussianPyramidColorTexture, distordedUV, mip);

正在加载...
取消
保存