浏览代码

update infinite projection usage v2

/main
RSlysz 6 年前
当前提交
4f00656c
共有 7 个文件被更改,包括 37 次插入30 次删除
  1. 9
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs
  2. 7
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs
  3. 22
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  4. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDProbe.cs
  5. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs
  6. 17
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  7. 8
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDProbe.cs

9
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs


protected static void Drawer_SectionProxySettings(HDProbeUI s, SerializedHDProbe d, Editor o)
{
EditorGUILayout.PropertyField(d.proxyVolumeReference, _.GetContent("Reference"));
EditorGUILayout.PropertyField(d.proxyVolumeReference, proxyVolumeContent);
if (d.target.proxyVolume == null)
{
EditorGUILayout.PropertyField(d.infiniteProjection, useInfiniteProjectionContent);
}
if (d.proxyVolumeReference.objectReferenceValue != null)
{

else
{
EditorGUILayout.HelpBox(
noProxyHelpBoxText,
d.infiniteProjection.boolValue ? noProxyInfiniteHelpBoxText : noProxyHelpBoxText,
MessageType.Info,
true
);

7
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDProbeUI.Skin.cs


static readonly GUIContent bakeTypeContent = CoreEditorUtils.GetContent("Type|'Baked Cubemap' uses the 'Auto Baking' mode from the Lighting window. If it is enabled then baking is automatic otherwise manual bake is needed (use the bake button below). \n'Custom' can be used if a custom cubemap is wanted. \n'Realtime' can be used to dynamically re-render the cubemap during runtime (via scripting).");
static readonly GUIContent proxyVolumeContent = CoreEditorUtils.GetContent("Proxy Volume");
protected static readonly GUIContent paralaxCorrectionContent = CoreEditorUtils.GetContent("Parallax Correction|Parallax Correction causes reflections to appear to change based on the object's position within the probe's box, while still using a single probe as the source of the reflection. This works well for reflections on objects that are moving through enclosed spaces such as corridors and rooms. Setting Parallax Correction to False and the cubemap reflection will be treated as coming from infinitely far away. Note that this feature can be globally disabled from Graphics Settings -> Tier Settings");
protected static readonly GUIContent useInfiniteProjectionContent = CoreEditorUtils.GetContent("Same As Influence Volume|If enabled, parallax correction will occure, causing reflections to appear to change based on the object's position within the probe's box, while still using a single probe as the source of the reflection. This works well for reflections on objects that are moving through enclosed spaces such as corridors and rooms. When disabled, the cubemap reflection will be treated as coming from infinitely far away. Note that this feature can be globally disabled from Graphics Settings -> Tier Settings");
static readonly GUIContent normalModeContent = CoreEditorUtils.GetContent("Normal|Normal parameters mode (only change for box shape).");
static readonly GUIContent advancedModeContent = CoreEditorUtils.GetContent("Advanced|Advanced parameters mode (only change for box shape).");

const string mimapHelpBoxText = "No mipmaps in the cubemap, Smoothness value in Standard shader will be ignored.";
const string noProxyHelpBoxText = "When no Proxy setted, Influence shape will be used as Proxy shape too.";
const string noProxyHelpBoxText = "Influence shape will be used as Projection shape too.";
const string noProxyInfiniteHelpBoxText = "Projection will be at infinite.";
const string proxySettingsHeader = "Proxy Volume";
const string proxySettingsHeader = "Projection Settings";
//influenceVolume have its own header
const string captureSettingsHeader = "Capture Settings";
const string additionnalSettingsHeader = "Custom Settings";

22
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs


{
SectionPrimarySettings,
ProxyVolumeSettings,
AdditionalProxyVolumeSettings,
CED.Select(
(s, d, o) => s.influenceVolume,
(s, d, o) => d.influenceVolume,

FoldoutOption.Indent,
CED.Action(Drawer_CaptureSettings)
);
static readonly CED.IDrawer AdditionalProxyVolumeSettings = CED.Action(Drawer_AdditionalProxyVolumeSettings);
static void Drawer_AdditionalProxyVolumeSettings(HDProbeUI s, SerializedHDProbe p, Editor owner)
{
HDReflectionProbeUI ui = ((HDReflectionProbeEditor)owner).m_UIState;
if (p.target.proxyVolume == null && ui.isSectionExpendedProxyVolume.value)
{
SerializedHDReflectionProbe serialized = (SerializedHDReflectionProbe)p;
EditorGUI.BeginChangeCheck();
++EditorGUI.indentLevel;
EditorGUILayout.PropertyField(serialized.boxProjection, paralaxCorrectionContent);
--EditorGUI.indentLevel;
if (EditorGUI.EndChangeCheck())
{
serialized.Apply();
}
}
}
static void Drawer_CaptureSettings(HDProbeUI s, SerializedHDProbe p, Editor owner)
{
var renderPipelineAsset = (HDRenderPipelineAsset)GraphicsSettings.renderPipelineAsset;

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDProbe.cs


internal SerializedReflectionProxyVolumeComponent proxyVolumeComponent;
internal SerializedProperty proxyVolumeReference;
internal SerializedProperty infiniteProjection;
internal SerializedInfluenceVolume influenceVolume;

proxyVolumeReference = serializedObject.Find((HDProbe p) => p.proxyVolume);
influenceVolume = new SerializedInfluenceVolume(serializedObject.Find((HDProbe p) => p.influenceVolume));
infiniteProjection = serializedObject.Find((HDProbe p) => p.infiniteProjection);
frameSettings = new SerializedFrameSettings(serializedObject.Find((HDProbe p) => p.frameSettings));

2
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/SerializedHDReflectionProbe.cs


internal SerializedProperty legacyBlendDistance;
internal SerializedProperty boxSize;
internal SerializedProperty boxOffset;
internal SerializedProperty boxProjection;
internal new HDAdditionalReflectionData target { get { return serializedObject.targetObject as HDAdditionalReflectionData; } }
internal ReflectionProbe targetLegacy { get { return serializedLegacyObject.targetObject as ReflectionProbe; } }

useOcclusionCulling = legacyProbe.FindProperty("m_UseOcclusionCulling");
nearClip = legacyProbe.FindProperty("m_NearClip");
farClip = legacyProbe.FindProperty("m_FarClip");
boxProjection = legacyProbe.FindProperty("m_BoxProjection");
legacyBlendDistance = legacyProbe.FindProperty("m_BlendDistance");
}

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


Second,
HDProbeChild,
UseInfluenceVolume,
IntroduceFrameSettings,
MergeEditors,
// Add new version here and they will automatically be the Current one
Max,
Current = Max - 1

bool needMigrateToHDProbeChild = false;
bool needMigrateToUseInfluenceVolume = false;
bool needMigrateToMergeEditors = false;
public void CopyTo(HDAdditionalReflectionData data)
{

{
needMigrateToUseInfluenceVolume = true;
}
else if (m_Version < (int)Version.MergeEditors)
{
needMigrateToMergeEditors = true;
}
else
{
// Add here data migration code that do not use other component

MigrateToHDProbeChild();
if (needMigrateToUseInfluenceVolume)
MigrateToUseInfluenceVolume();
if (needMigrateToMergeEditors)
MigrateToMergeEditors();
}
void MigrateToHDProbeChild()

//Note: former editor parameters will be recreated as if non existent.
//User will lose parameters corresponding to non used mode between simplified and advanced
}
void MigrateToMergeEditors()
{
infiniteProjection = !reflectionProbe.boxProjection;
m_Version = (int)Version.MergeEditors;
needMigrateToMergeEditors = false;
OnAfterDeserialize(); //continue migrating if needed
}
public override ReflectionProbeMode mode

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


{
[SerializeField, FormerlySerializedAs("proxyVolumeComponent"), FormerlySerializedAs("m_ProxyVolumeReference")]
ReflectionProxyVolumeComponent m_ProxyVolume = null;
[SerializeField]
bool m_InfiniteProjection = true; //usable when no proxy set
[SerializeField]
InfluenceVolume m_InfluenceVolume;

{
get
{
return proxyVolume != null && proxyVolume.proxyVolume.shape == ProxyShape.Infinite;
return proxyVolume != null && proxyVolume.proxyVolume.shape == ProxyShape.Infinite || m_InfiniteProjection;
}
set
{
m_InfiniteProjection = value;
}
}

正在加载...
取消
保存