浏览代码

[ReflectionProbeEditor] Updated influence fade per face for box

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
1b9fa715
共有 2 个文件被更改,包括 13 次插入30 次删除
  1. 10
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Drawers.cs
  2. 33
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

10
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Drawers.cs


p.resolution.intValue = renderPipelineAsset.GetRenderPipelineSettings().lightLoopSettings.reflectionCubemapSize;
EditorGUILayout.LabelField(CoreEditorUtils.GetContent("Resolution"), CoreEditorUtils.GetContent(p.resolution.intValue.ToString()));
EditorGUILayout.PropertyField(p.shadowDistance);
EditorGUILayout.PropertyField(p.cullingMask);
EditorGUILayout.PropertyField(p.useOcclusionCulling);
EditorGUILayout.PropertyField(p.nearClip);
EditorGUILayout.PropertyField(p.farClip);
EditorGUILayout.PropertyField(p.shadowDistance, CoreEditorUtils.GetContent("Shadow Distance"));
EditorGUILayout.PropertyField(p.cullingMask, CoreEditorUtils.GetContent("Culling Mask"));
EditorGUILayout.PropertyField(p.useOcclusionCulling, CoreEditorUtils.GetContent("Use Occlusion Culling"));
EditorGUILayout.PropertyField(p.nearClip, CoreEditorUtils.GetContent("Near Clip"));
EditorGUILayout.PropertyField(p.farClip, CoreEditorUtils.GetContent("Far Clip"));
}
static void Drawer_AdditionalSettings(UIState s, SerializedReflectionProbe p, Editor owner)

33
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// Calculate falloff value, so reflections on the edges of the volume would gradually blend to previous reflection.
// Calculate distance to cube face
float3 minPositionLS = positionLS + extents;
float3 maxPositionLS = extents - positionLS;
int extentDistAxis = 0;
float extentDist = minPositionLS[0];
for (int i = 1; i < 3; ++i)
{
if (minPositionLS[i] < extentDist)
{
extentDistAxis = i;
extentDist = minPositionLS[i];
}
}
for (int i = 0; i < 3; ++i)
{
if (maxPositionLS[i] < extentDist)
{
extentDistAxis = i + 3;
extentDist = maxPositionLS[i];
}
}
float3 negativeDistance = extents + positionLS;
float3 positiveDistance = extents - positionLS;
float influenceFalloff = 0;
if (extentDistAxis < 3)
influenceFalloff = extentDist / max(0.0001, lightData.blendDistance2[extentDistAxis]); // avoid divide by zero
else
influenceFalloff = extentDist / max(0.0001, lightData.blendDistance[extentDistAxis - 3]); // avoid divide by zero
float3 negativeFalloff = negativeDistance / max(0.0001, lightData.blendDistance2);
float3 positiveFalloff = positiveDistance / max(0.0001, lightData.blendDistance);
float influenceFalloff = min(
min(min(negativeFalloff.x, negativeFalloff.y), negativeFalloff.z),
min(min(positiveFalloff.x, positiveFalloff.y), positiveFalloff.z));
float alpha = saturate(influenceFalloff);

正在加载...
取消
保存