浏览代码

Merge pull request #1796 from Unity-Technologies/HDRP/fix/coupling-reflectionProbe-reset

Hdrp/fix/coupling reflection probe reset
/main
GitHub 6 年前
当前提交
257931a3
共有 7 个文件被更改,包括 90 次插入11 次删除
  1. 1
      com.unity.render-pipelines.high-definition/CHANGELOG.md
  2. 29
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  3. 11
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  4. 4
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs
  5. 40
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs
  6. 5
      com.unity.render-pipelines.high-definition/HDRP/AssemblyInfo.cs
  7. 11
      com.unity.render-pipelines.high-definition/HDRP/AssemblyInfo.cs.meta

1
com.unity.render-pipelines.high-definition/CHANGELOG.md


### Added
- Added support for RendererPriority on Renderer. This allow to control order of transparent rendering manually. HDRP have now two stage of sorting for transparent in addition to bact to front. Material have a priority then Renderer have a priority.
- Add Coupling of (HD)Camera and HDAdditionalCameraData for reset and remove in inspector contextual menu of Camera
- Add Coupling of (HD)ReflectionProbe and HDAdditionalReflectionData for reset and remove in inspector contextual menu of ReflectoinProbe
- Add macro to forbid unity_ObjectToWorld/unity_WorldToObject to be use as it doesn't handle camera relative rendering
- Add opacity control on contact shadow

29
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs


[CanEditMultipleObjects]
partial class HDReflectionProbeEditor : Editor
{
[MenuItem("CONTEXT/ReflectionProbe/Remove HD Reflection Probe", false, 0)]
static void RemoveLight(MenuCommand menuCommand)
[MenuItem("CONTEXT/ReflectionProbe/Remove Component", false, 0)]
static void RemoveReflectionProbe(MenuCommand menuCommand)
{
GameObject go = ((ReflectionProbe)menuCommand.context).gameObject;

Undo.DestroyObjectImmediate(go.GetComponent<ReflectionProbe>());
Undo.DestroyObjectImmediate(go.GetComponent<HDAdditionalReflectionData>());
}
[MenuItem("CONTEXT/ReflectionProbe/Reset", false, 0)]
static void ResetReflectionProbe(MenuCommand menuCommand)
{
GameObject go = ((ReflectionProbe)menuCommand.context).gameObject;
Assert.IsNotNull(go);
ReflectionProbe reflectionProbe = go.GetComponent<ReflectionProbe>();
HDAdditionalReflectionData reflectionProbeAdditionalData = go.GetComponent<HDAdditionalReflectionData>();
Assert.IsNotNull(reflectionProbe);
Assert.IsNotNull(reflectionProbeAdditionalData);
Undo.SetCurrentGroupName("Reset HD Reflection Probe");
Undo.RecordObjects(new UnityEngine.Object[] { reflectionProbe, reflectionProbeAdditionalData }, "Reset HD Reflection Probe");
reflectionProbe.Reset();
// To avoid duplicating init code we copy default settings to Reset additional data
// Note: we can't call this code inside the HDAdditionalReflectionData, thus why we don't wrap it in Reset() function
if(HDUtils.s_DefaultHDAdditionalReflectionData.influenceVolume == null)
{
HDUtils.s_DefaultHDAdditionalReflectionData.Awake();
}
HDUtils.s_DefaultHDAdditionalReflectionData.CopyTo(reflectionProbeAdditionalData);
}
static Dictionary<ReflectionProbe, HDReflectionProbeEditor> s_ReflectionProbeEditors = new Dictionary<ReflectionProbe, HDReflectionProbeEditor>();

11
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs


bool needMigrateToHDProbeChild = false;
bool needMigrateToUseInfluenceVolume = false;
public void CopyTo(HDAdditionalReflectionData data)
{
influenceVolume.CopyTo(data.influenceVolume);
data.influenceVolume.shape = influenceVolume.shape; //force the legacy probe to refresh its size
data.mode = mode;
data.refreshMode = refreshMode;
data.multiplier = multiplier;
data.weight = weight;
}
public void OnBeforeSerialize()
{
}

4
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs


public InfluenceVolume influenceVolume { get { return m_InfluenceVolume; } private set { m_InfluenceVolume = value; } }
/// <summary>Multiplier factor of reflection (non PBR parameter).</summary>
public float multiplier { get { return m_Multiplier; } }
public float multiplier { get { return m_Multiplier; } protected set { m_Multiplier = value; } }
public float weight { get { return m_Weight; } }
public float weight { get { return m_Weight; } protected set { m_Weight = value; } }
/// <summary>The capture mode.</summary>
public virtual ReflectionProbeMode mode

40
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/InfluenceVolume.cs


[Serializable]
public class InfluenceVolume
{
HDProbe probe;
HDProbe m_Probe;
[SerializeField, FormerlySerializedAs("m_ShapeType")]
InfluenceShape m_Shape = InfluenceShape.Box;

[SerializeField, FormerlySerializedAs("m_SphereInfluenceNormalFade")]
float m_SphereBlendNormalDistance;
internal void CopyTo(InfluenceVolume data)
{
//keep the m_Probe as it is used to reset the probe
data.m_Shape = m_Shape;
data.m_Offset = m_Offset;
data.m_BoxSize = m_BoxSize;
data.m_BoxBlendDistancePositive = m_BoxBlendDistancePositive;
data.m_BoxBlendDistanceNegative = m_BoxBlendDistanceNegative;
data.m_BoxBlendNormalDistancePositive = m_BoxBlendNormalDistancePositive;
data.m_BoxBlendNormalDistanceNegative = m_BoxBlendNormalDistanceNegative;
data.m_BoxSideFadePositive = m_BoxSideFadePositive;
data.m_BoxSideFadeNegative = m_BoxSideFadeNegative;
data.m_SphereRadius = m_SphereRadius;
data.m_SphereBlendDistance = m_SphereBlendDistance;
data.m_SphereBlendNormalDistance = m_SphereBlendNormalDistance;
data.m_EditorAdvancedModeBlendDistancePositive = m_EditorAdvancedModeBlendDistancePositive;
data.m_EditorAdvancedModeBlendDistanceNegative = m_EditorAdvancedModeBlendDistanceNegative;
data.m_EditorSimplifiedModeBlendDistance = m_EditorSimplifiedModeBlendDistance;
data.m_EditorAdvancedModeBlendNormalDistancePositive = m_EditorAdvancedModeBlendNormalDistancePositive;
data.m_EditorAdvancedModeBlendNormalDistanceNegative = m_EditorAdvancedModeBlendNormalDistanceNegative;
data.m_EditorSimplifiedModeBlendNormalDistance = m_EditorSimplifiedModeBlendNormalDistance;
data.m_EditorAdvancedModeEnabled = m_EditorAdvancedModeEnabled;
}
/// <summary>Shape of this InfluenceVolume.</summary>
public InfluenceShape shape
{

switch (m_Shape)
{
case InfluenceShape.Box:
probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
m_Probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
m_Probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
break;
}
}

set
{
m_BoxSize = value;
probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
m_Probe.UpdatedInfluenceVolumeShape(m_BoxSize, offset);
}
}

set
{
m_SphereRadius = value;
probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
m_Probe.UpdatedInfluenceVolumeShape(Vector3.one * (2 * m_SphereRadius), offset);
}
}
/// <summary>

/// Value between 0 (on InfluenceVolume hull) and sphereRadius (fade sub volume reduced to a point).
/// </summary>
public float sphereBlendNormalDistance { get { return m_SphereBlendNormalDistance; } set { m_SphereBlendNormalDistance = value; } }
this.probe = probe;
this.m_Probe = probe;
}
internal BoundingSphere GetBoundingSphereAt(Transform probeTransform)

5
com.unity.render-pipelines.high-definition/HDRP/AssemblyInfo.cs


using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor")]
[assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Tests")]

11
com.unity.render-pipelines.high-definition/HDRP/AssemblyInfo.cs.meta


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