浏览代码

Added a bool for contact shadows in lights

/main
Antoine Lelievre 6 年前
当前提交
34d3857a
共有 4 个文件被更改,包括 22 次插入0 次删除
  1. 1
      com.unity.render-pipelines.core/CoreRP/Shadow/AdditionalShadowData.cs
  2. 1
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.Styles.cs
  3. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs
  4. 16
      com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs

1
com.unity.render-pipelines.core/CoreRP/Shadow/AdditionalShadowData.cs


[Range(0.0f, 1.0f)]
public float shadowDimmer = 1.0f;
public float shadowFadeDistance = 10000.0f;
public bool contactShadows = false;
// bias control
public float viewBiasMin = 0.5f;
public float viewBiasMax = 10.0f;

1
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.Styles.cs


public readonly GUIContent shadowResolution = new GUIContent("Resolution", "Controls the rendered resolution of the shadow maps. A higher resolution will increase the fidelity of shadows at the cost of GPU performance and memory usage.");
public readonly GUIContent shadowFadeDistance = new GUIContent("Fade Distance", "The shadow will fade at distance ShadowFadeDistance before being culled to minimize popping.");
public readonly GUIContent shadowDimmer = new GUIContent("Dimmer", "Aim to be use with script, timeline or animation. It allows dimming one or multiple shadows. This can also be used as an optimization to fit in shadow budget manually and minimize popping.");
public readonly GUIContent contactShadows = new GUIContent("Enable Contact Shadows", "Enable support for contact shadows on this light. Better for lights with a lot of visible shadows.");
// Bias control
public readonly GUIContent viewBiasMin = new GUIContent("View Bias");

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/HDLightEditor.cs


public SerializedProperty dimmer;
public SerializedProperty fadeDistance;
public SerializedProperty resolution;
public SerializedProperty contactShadows;
// Bias control
public SerializedProperty viewBiasMin;

dimmer = o.Find(x => x.shadowDimmer),
fadeDistance = o.Find(x => x.shadowFadeDistance),
resolution = o.Find(x => x.shadowResolution),
contactShadows = o.Find(x => x.contactShadows),
viewBiasMin = o.Find(x => x.viewBiasMin),
viewBiasMax = o.Find(x => x.viewBiasMax),

if (settings.isBakedOrMixed)
DrawBakedShadowParameters();
EditorGUILayout.PropertyField(m_AdditionalShadowData.contactShadows, s_Styles.contactShadows);
// There is currently no additional settings for shadow on directional light
if (m_AdditionalLightData.showAdditionalSettings.boolValue)

16
com.unity.render-pipelines.high-definition/HDRP/Lighting/LightLoop/LightLoop.cs


// 2. Go through all lights, convert them to GPU format.
// Simultaneously create data for culling (LightVolumeData and SFiniteLightBound)
//TODO: move this upwards
float biggestLight = 0;
int dominantLightIndex = -1;
for (int sortIndex = 0; sortIndex < sortCount; ++sortIndex)
{

{
directionalLightcount++;
if (additionalShadowData != null && additionalShadowData.contactShadows)
{
dominantLightIndex = lightIndex;
biggestLight = Single.PositiveInfinity;
}
// We make the light position camera-relative as late as possible in order
// to allow the preceding code to work with the absolute world space coordinates.
if (ShaderConfig.s_CameraRelativeRendering != 0)

default:
Debug.Assert(false, "TODO: encountered an unknown LightCategory.");
break;
}
if (additionalShadowData != null && additionalShadowData.contactShadows && lightDimensions.magnitude > biggestLight)
{
dominantLightIndex = lightIndex;
biggestLight = lightDimensions.magnitude;
}
// Then culling side. Must be call in this order as we pass the created Light data to the function

正在加载...
取消
保存