浏览代码

Added additional bias parameter for all algorithms.

Changed the scale of the PCF bias parameter.
/main
uygar 8 年前
当前提交
d717a22e
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 5
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/Shadow.cs
  2. 1
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/ShadowAlgorithms.hlsl

5
Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/Shadow.cs


public void Slider( ref int currentVal ) { currentVal = ShadowUtils.Asint( ValScale * UnityEditor.EditorGUILayout.Slider( Name, ShadowUtils.Asfloat( currentVal ) / ValScale, ValMin, ValMax ) ); }
public int Default() { return ShadowUtils.Asint( ValScale * ValDef ); }
}
readonly ValRange m_DefPCF_DepthBias = new ValRange( "Depth Bias", 0.0f, 0.05f, 1.0f, 00.1f );
readonly ValRange m_DefPCF_DepthBias = new ValRange( "Depth Bias", 0.0f, 0.05f, 1.0f, 000.1f );
readonly ValRange m_DefPCF_FilterSize = new ValRange( "Filter Size", 1.0f, 1.0f, 10.0f, 1.0f );

// set light specific values that are not related to the shadowmap
GPUShadowType shadowtype;
ShadowUtils.MapLightType( ald.archetype, vl.lightType, out sd.lightType, out shadowtype );
sd.bias = SystemInfo.usesReversedZBuffer ? l.shadowBias : -l.shadowBias;
// current bias value range is way too large, so scale by 0.01 for now until we've decided whether to actually keep this value or not.
sd.bias = 0.01f * (SystemInfo.usesReversedZBuffer ? l.shadowBias : -l.shadowBias);
sd.normalBias = l.shadowNormalBias;
shadowIndices.AddUnchecked( (int) shadowDatas.Count() );

1
Assets/ScriptableRenderPipeline/HDRenderPipeline/Shadow/ShadowAlgorithms.hlsl


float3 EvalShadow_GetTexcoords( ShadowData sd, float3 positionWS )
{
float4 posCS = mul( float4( positionWS, 1.0 ), sd.worldToShadow );
posCS.z -= sd.bias * posCS.w;
float3 posNDC = posCS.xyz / posCS.w;
// calc TCs
float3 posTC = posNDC * 0.5 + 0.5;

正在加载...
取消
保存