浏览代码

Add default value for HDRP shadow data

/main
sebastienlagarde 7 年前
当前提交
42c1a872
共有 5 个文件被更改,包括 47 次插入3 次删除
  1. 8
      ScriptableRenderPipeline/Core/CoreRP/Editor/CoreEditorUtils.cs
  2. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineMenuItems.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs
  4. 24
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalShadowData.cs
  5. 11
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalShadowData.cs.meta

8
ScriptableRenderPipeline/Core/CoreRP/Editor/CoreEditorUtils.cs


material.shaderKeywords = null;
}
public static T[] GetAdditionalData<T>(params UnityEngine.Object[] targets)
public static T[] GetAdditionalData<T>(UnityEngine.Object[] targets, Action<T> initDefault = null)
where T : Component
{
// Handles multi-selection

for (int i = 0; i < data.Length; i++)
{
if (data[i] == null)
{
if (initDefault != null)
{
initDefault(data[i]);
}
}
}
return data;

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/HDRenderPipelineMenuItems.cs


light.gameObject.AddComponent<HDAdditionalLightData>();
if (light.GetComponent<AdditionalShadowData>() == null)
light.gameObject.AddComponent<AdditionalShadowData>();
{
AdditionalShadowData shadowData = light.gameObject.AddComponent<AdditionalShadowData>();
HDAdditionalShadowData.InitDefaultHDAdditionalShadowData(shadowData);
}
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/HDLightEditor.cs


// Get & automatically add additional HD data if not present
var lightData = CoreEditorUtils.GetAdditionalData<HDAdditionalLightData>(targets);
var shadowData = CoreEditorUtils.GetAdditionalData<AdditionalShadowData>(targets);
var shadowData = CoreEditorUtils.GetAdditionalData<AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData);
m_SerializedAdditionalLightData = new SerializedObject(lightData);
m_SerializedAdditionalShadowData = new SerializedObject(shadowData);

24
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalShadowData.cs


using UnityEngine.Experimental.Rendering;
namespace UnityEditor.Experimental.Rendering.HDPipeline
{
public class HDAdditionalShadowData
{
public static void InitDefaultHDAdditionalShadowData(AdditionalShadowData shadowData)
{
// Update bias control for HD
// bias control default value based on empirical experiment
shadowData.viewBiasMin = 0.2f;
shadowData.viewBiasMax = 10.0f;
shadowData.viewBiasScale = 1.0f;
shadowData.nrmlBiasMin = 0.5f;
shadowData.nrmlBiasMax = 0.5f;
shadowData.nrmlBiasScale = 1.0f;
shadowData.sampleBiasScale = false;
shadowData.edgeLeakFixup = true;
shadowData.edgeToleranceNrml = true;
shadowData.edgeTolerance = 1.0f;
}
}
}

11
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Light/HDAdditionalShadowData.cs.meta


fileFormatVersion: 2
guid: f6ddd04671709d04cba20d06452e9f6f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存