浏览代码

- Fixed reflection probe dimmer for automotive

- Fixed null reference exception in sky manager.
/2018.1
Julien Ignace 7 年前
当前提交
f0c93c99
共有 13 个文件被更改,包括 64 次插入29 次删除
  1. 7
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  2. 8
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs
  3. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  4. 6
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/SerializedPlanarReflectionProbe.cs
  5. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs
  6. 12
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs.hlsl
  7. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  8. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtilities.hlsl
  9. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  10. 13
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs
  11. 9
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ProbeWrapper.cs
  12. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
  13. 10
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkyRenderingContext.cs

7
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


static void Drawer_AdditionalSettings(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor owner)
{
EditorGUILayout.PropertyField(p.dimmer);
EditorGUILayout.PropertyField(p.weight);
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(p.multiplier);
if (EditorGUI.EndChangeCheck())
p.multiplier.floatValue = Mathf.Max(0.0f, p.multiplier.floatValue);
if (p.so.targetObjects.Length == 1)
{

8
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/PlanarReflectionProbeUI.Drawers.cs


static void Drawer_SectionInfluenceSettings(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.dimmer, _.GetContent("Dimmer"));
EditorGUILayout.PropertyField(d.weight, _.GetContent("Weight"));
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(d.multiplier, _.GetContent("Multiplier"));
if (EditorGUI.EndChangeCheck())
d.multiplier.floatValue = Mathf.Max(0.0f, d.multiplier.floatValue);
}
static void Drawer_FieldCaptureType(PlanarReflectionProbeUI s, SerializedPlanarReflectionProbe d, Editor o)

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs


internal SerializedProperty blendNormalDistanceNegative;
internal SerializedProperty boxSideFadePositive;
internal SerializedProperty boxSideFadeNegative;
internal SerializedProperty dimmer;
internal SerializedProperty weight;
internal SerializedProperty multiplier;
internal SerializedProperty proxyVolumeComponent;

boxReprojectionVolumeSize = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeSize);
boxReprojectionVolumeCenter = addso.Find((HDAdditionalReflectionData d) => d.boxReprojectionVolumeCenter);
sphereReprojectionVolumeRadius = addso.Find((HDAdditionalReflectionData d) => d.sphereReprojectionVolumeRadius);
dimmer = addso.Find((HDAdditionalReflectionData d) => d.dimmer);
weight = addso.Find((HDAdditionalReflectionData d) => d.weight);
multiplier = addso.Find((HDAdditionalReflectionData d) => d.multiplier);
blendDistancePositive = addso.Find((HDAdditionalReflectionData d) => d.blendDistancePositive);
blendDistanceNegative = addso.Find((HDAdditionalReflectionData d) => d.blendDistanceNegative);
blendNormalDistancePositive = addso.Find((HDAdditionalReflectionData d) => d.blendNormalDistancePositive);

6
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/SerializedPlanarReflectionProbe.cs


public SerializedProperty capturePositionMode;
public SerializedProperty captureMirrorPlaneLocalPosition;
public SerializedProperty captureMirrorPlaneLocalNormal;
public SerializedProperty dimmer;
public SerializedProperty weight;
public SerializedProperty multiplier;
public SerializedProperty mode;
public SerializedProperty refreshMode;
public SerializedProperty customTexture;

capturePositionMode = serializedObject.Find((PlanarReflectionProbe p) => p.capturePositionMode);
captureMirrorPlaneLocalPosition = serializedObject.Find((PlanarReflectionProbe p) => p.captureMirrorPlaneLocalPosition);
captureMirrorPlaneLocalNormal = serializedObject.Find((PlanarReflectionProbe p) => p.captureMirrorPlaneLocalNormal);
dimmer = serializedObject.Find((PlanarReflectionProbe p) => p.dimmer);
weight = serializedObject.Find((PlanarReflectionProbe p) => p.weight);
multiplier = serializedObject.Find((PlanarReflectionProbe p) => p.multiplier);
mode = serializedObject.Find((PlanarReflectionProbe p) => p.mode);
refreshMode = serializedObject.Find((PlanarReflectionProbe p) => p.refreshMode);
customTexture = serializedObject.Find((PlanarReflectionProbe p) => p.customTexture);

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs


public Vector3 boxSideFadePositive;
public Vector3 boxSideFadeNegative;
public float dimmer;
public float unused01;
public float weight;
public float multiplier;
public Vector3 sampleDirectionDiscardWS;
// Sampling properties

12
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightDefinition.cs.hlsl


float3 blendNormalDistanceNegative;
float3 boxSideFadePositive;
float3 boxSideFadeNegative;
float dimmer;
float unused01;
float weight;
float multiplier;
float3 sampleDirectionDiscardWS;
int envIndex;
};

{
return value.boxSideFadeNegative;
}
float GetDimmer(EnvLightData value)
float GetWeight(EnvLightData value)
return value.dimmer;
return value.weight;
float GetUnused01(EnvLightData value)
float GetMultiplier(EnvLightData value)
return value.unused01;
return value.multiplier;
}
float3 GetSampleDirectionDiscardWS(EnvLightData value)
{

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


envLightData.influenceShapeType = probe.influenceShapeType;
envLightData.dimmer = probe.dimmer;
envLightData.weight = probe.weight;
envLightData.multiplier = probe.multiplier;
envLightData.influenceExtents = probe.influenceExtents;
envLightData.blendNormalDistancePositive = probe.blendNormalDistancePositive;
envLightData.blendNormalDistanceNegative = probe.blendNormalDistanceNegative;

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightUtilities.hlsl


output.influenceRight = float3(1.0, 0.0, 0.0);
output.influencePositionWS = float3(0.0, 0.0, 0.0);
output.dimmer = 1.0;
output.weight = 1.0;
output.multiplier = 1.0;
// proxy
output.proxyForward = float3(0.0, 0.0, 1.0);

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs


using UnityEngine.Experimental.Rendering.HDPipeline;
using UnityEngine.Serialization;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEngine.Experimental.Rendering
{

#pragma warning restore 414
public ShapeType influenceShape;
[Range(0.0f,1.0f)]
public float dimmer = 1.0f;
[FormerlySerializedAsAttribute("dimmer")]
public float multiplier = 1.0f;
[Range(0.0f, 1.0f)]
public float weight = 1.0f;
public float influenceSphereRadius = 3.0f;
public float sphereReprojectionVolumeRadius = 1.0f;
public bool useSeparateProjectionVolume = false;

13
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs


using UnityEngine.Rendering;
using UnityEngine.Serialization;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{

[SerializeField]
Vector3 m_CaptureLocalPosition;
[SerializeField]
[Range(0, 1)]
float m_Dimmer = 1;
[FormerlySerializedAsAttribute("m_Dimmer")]
float m_Multiplier = 1.0f;
[SerializeField]
[Range(0.0f, 1.0f)]
float m_Weight = 1.0f;
[SerializeField]
ReflectionProbeMode m_Mode = ReflectionProbeMode.Baked;
[SerializeField]

}
public Bounds bounds { get { return m_InfluenceVolume.GetBoundsAt(transform); } }
public Vector3 captureLocalPosition { get { return m_CaptureLocalPosition; } set { m_CaptureLocalPosition = value; } }
public float dimmer { get { return m_Dimmer; } }
public float weight { get { return m_Weight; } }
public float multiplier { get { return m_Multiplier; } }
public ReflectionProbeMode mode { get { return m_Mode; } }
public Matrix4x4 influenceToWorld
{

9
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Reflection/ProbeWrapper.cs


public abstract ReflectionProbeMode mode { get; }
public abstract Texture texture { get; }
// Position of the center of the probe in capture space
public abstract float dimmer { get; }
public abstract float weight { get; }
public abstract float multiplier { get; }
public abstract Matrix4x4 influenceToWorld { get; }
public abstract EnvShapeType influenceShapeType { get; }
public abstract Vector3 influenceExtents { get; }

public override Texture texture { get { return probe.texture; } }
public override ReflectionProbeMode mode { get { return probe.probe.mode; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(additional.influenceShape); } }
public override float dimmer { get { return additional.dimmer; } }
public override float weight { get { return additional.weight; } }
public override float multiplier { get { return additional.multiplier; } }
public override Vector3 influenceExtents
{
get

public override Matrix4x4 influenceToWorld { get { return planarReflectionProbe.influenceToWorld; } }
public override Texture texture { get { return planarReflectionProbe.texture; } }
public override EnvShapeType influenceShapeType { get { return ConvertShape(planarReflectionProbe.influenceVolume.shapeType); } }
public override float dimmer { get { return planarReflectionProbe.dimmer; } }
public override float weight { get { return planarReflectionProbe.weight; } }
public override float multiplier { get { return planarReflectionProbe.multiplier; } }
public override Vector3 influenceExtents
{
get

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl


#endif // LIT_DISPLAY_REFERENCE_IBL
weight *= lightData.weight;
envLighting *= weight * lightData.dimmer;
envLighting *= weight * lightData.multiplier;
if (GPUImageBasedLightingType == GPUIMAGEBASEDLIGHTINGTYPE_REFLECTION)
lighting.specularReflected = envLighting;

10
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkyRenderingContext.cs


hash = hash * 23 + light.colorTemperature.GetHashCode();
hash = hash * 23 + light.intensity.GetHashCode();
hash = hash * 23 + light.range.GetHashCode();
if(light.cookie != null)
if (light.cookie != null)
{
hash = hash * 23 + ald.lightDimmer.GetHashCode();
hash = hash * 23 + (int)light.cookie.GetInstanceID();
}
if (ald != null)
{
hash = hash * 23 + ald.lightDimmer.GetHashCode();
}
return hash;
}

正在加载...
取消
保存