浏览代码

Merge pull request #114 from Unity-Technologies/Update-weights-calculation

HDRenderPipeline: Update weight calculation for layering
/main
GitHub 8 年前
当前提交
32457b2e
共有 2 个文件被更改,包括 8 次插入6 次删除
  1. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/TilePass/TilePass.cs
  2. 12
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Lighting/TilePass/TilePass.cs


public int debugViewTilesFlags = 0;
public bool enableClustered = false;
public bool disableFptlWhenClustered = true; // still useful on opaques. Should be false by default to force tile on opaque.
public bool enableBigTilePrepass = false;
public bool enableBigTilePrepass = true;
const bool k_UseDepthBuffer = true; // only has an impact when EnableClustered is true (requires a depth-prepass)
const bool k_UseAsyncCompute = true; // should not use on mobile

12
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl


masks[3] = inputMasks.b;
// calculate weight of each layers
float left = 1.0f;
// Algorithm is like this:
// Top layer have priority on others layers
// If a top layer doesn't use the full weight, the remaining can be use by the following layer.
float weightsSum = 0.0;
for (int i = _LAYER_COUNT - 1; i > 0; --i)
for (int i = _LAYER_COUNT - 1; i >= 0; --i)
outWeights[i] = masks[i] * left;
left -= outWeights[i];
outWeights[i] = min(masks[i], (1.0 - weightsSum));
weightsSum = saturate(weightsSum + masks[i]);
outWeights[0] = left;
}
float3 BlendLayeredFloat3(float3 x0, float3 x1, float3 x2, float3 x3, float weight[4])

正在加载...
取消
保存