浏览代码

Reflection probe capture material (#1700)

Splitted to long HDReflectionProbeEditor.Gizmos.cs into HDReflectionProbeEditor.Gizmos.cs, HDReflectionProbeEditor.Handles.cs and HDReflectionProbeEditor.Skin.cs

Fix HDReflectionProbe's CapturePoint preview material, removing hidden mesh & renderer components

Add PlanarReflectionProbe and Proxy icons
/main
GitHub 6 年前
当前提交
010c21b8
共有 21 个文件被更改,包括 575 次插入311 次删除
  1. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/EditorReflectionSystem.cs
  2. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/EditorReflectionSystemGUI.cs
  3. 196
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Handles.cs
  4. 21
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.ProbeUtility.cs
  5. 14
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.cs
  6. 55
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs
  7. 2
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeUI.Drawers.cs
  8. 4
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs
  9. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/HDAdditionalReflectionData.cs
  10. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs.meta
  11. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs.meta
  12. 8
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons.meta
  13. 188
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs
  14. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs.meta
  15. 39
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Skin.cs
  16. 11
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Skin.cs.meta
  17. 66
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png
  18. 97
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png.meta
  19. 54
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png
  20. 97
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png.meta

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


{
public static class EditorReflectionSystem
{
static int _Cubemap = Shader.PropertyToID("_Cubemap");
const HideFlags k_ReflectionSystemDictionaryHideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.DontSaveInBuild;
public static bool IsCollidingWithOtherProbes(string targetPath, ReflectionProbe targetProbe, out ReflectionProbe collidingProbe)

if (!UnityEditor.Lightmapping.BakeReflectionProbe(probe, path))
Debug.LogError("Failed to bake reflection probe to " + path);
EditorUtility.ClearProgressBar();
}
public static void ResetProbeSceneTextureInMaterial(ReflectionProbe p)
{
var renderer = p.GetComponent<Renderer>();
renderer.sharedMaterial.SetTexture(_Cubemap, p.texture);
}
public static void ResetProbeSceneTextureInMaterial(PlanarReflectionProbe p)
{
}
static MethodInfo k_Lightmapping_BakeReflectionProbeSnapshot = typeof(UnityEditor.Lightmapping).GetMethod("BakeReflectionProbeSnapshot", BindingFlags.Static | BindingFlags.NonPublic);

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/EditorReflectionSystemGUI.cs


if (probe != null)
{
EditorReflectionSystem.BakeCustomReflectionProbe(probe, false);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(probe);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(planarProbe);
}
}
},

{
EditorReflectionSystem.BakeCustomReflectionProbe(probe, true);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(probe);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(planarProbe);
}
GUIUtility.ExitGUI();
}

if (probe != null)
{
EditorReflectionSystem.BakeReflectionProbeSnapshot(probe);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(probe);
EditorReflectionSystem.ResetProbeSceneTextureInMaterial(planarProbe);
}
GUIUtility.ExitGUI();
}

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


Normal
}
internal static Color k_GizmoThemeColorExtent = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorExtentFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f);
internal static Color k_GizmoThemeColorInfluenceBlend = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f);
internal static Color k_GizmoThemeColorInfluenceBlendFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormalBlend = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormalBlendFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f);
internal static Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static readonly Color[][] k_handlesColor = new Color[][]
{
new Color[]
{
Color.red,
Color.green,
Color.blue
},
new Color[]
{
new Color(.5f, 0f, 0f, 1f),
new Color(0f, .5f, 0f, 1f),
new Color(0f, 0f, .5f, 1f)
}
};
void OnSceneGUI()
{
var s = m_UIState;

EditorUtility.SetDirty(p);
s.UpdateOldLocalSpace(p);
}
}
[DrawGizmo(GizmoType.Active)]
static void RenderGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var e = GetEditorFor(reflectionProbe);
if (e == null || !e.sceneViewEditing)
return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
switch (EditMode.editMode)
{
// Influence editing
case EditMode.SceneViewEditMode.ReflectionProbeBox:
Gizmos_Influence(reflectionProbe, reflectionData, e, true);
break;
// Influence fade editing
case EditMode.SceneViewEditMode.GridBox:
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Standard, true);
break;
// Influence normal fade editing
case EditMode.SceneViewEditMode.Collider:
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Normal, true);
break;
}
}
[DrawGizmo(GizmoType.Selected)]
static void DrawSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var e = GetEditorFor(reflectionProbe);
if (e == null || !e.sceneViewEditing)
return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
//Gizmos_Influence(reflectionProbe, reflectionData, e, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Standard, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Normal, false);
DrawVerticalRay(reflectionProbe.transform);
HDReflectionProbeEditorUtility.ChangeVisibility(reflectionProbe, true);
}
[DrawGizmo(GizmoType.NonSelected)]
static void DrawNonSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var e = GetEditorFor(reflectionProbe);
if (e == null || !e.sceneViewEditing)
return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
if (reflectionData != null)
HDReflectionProbeEditorUtility.ChangeVisibility(reflectionProbe, false);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmo6FacesBoxContained box;
Vector3 boxCenterOffset;
Vector3 boxSizeOffset;
float sphereRadiusOffset;
Color color;
switch (type)
{
default:
case InfluenceType.Standard:
{
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
case InfluenceType.Normal:
{
box = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
}
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = color;
if(e != null) // e == null may occure when editor have still not been created at selection while the tool is not used for this part
{
box.DrawHull(isEdit);
}
else
{
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
}
break;
}
case ShapeType.Sphere:
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
}
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit);
break;
}
case ShapeType.Sphere:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
}
static void DrawVerticalRay(Transform transform)
{
Ray ray = new Ray(transform.position, Vector3.down);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
Handles.color = Color.green;
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
Handles.DrawLine(transform.position - Vector3.up * 0.5f, hit.point);
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f);
Handles.color = Color.red;
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.DrawLine(transform.position, hit.point);
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f);
}
}
}

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


{
partial class HDReflectionProbeEditor
{
void ChangeVisibilityOfAllTargets(bool visibility)
{
if (targets.Length == 0) return;
for (var i = 0; i < targets.Length; ++i)
{
if (targets[i] != null)
{
var p = (ReflectionProbe)targets[i];
HDReflectionProbeEditorUtility.ChangeVisibility(p, visibility);
}
}
}
for (var i = 0; i < targets.Length; ++i)
{
var p = (ReflectionProbe)targets[i];
var a = (HDAdditionalReflectionData)m_AdditionalDataSerializedObject.targetObjects[i];
HDReflectionProbeEditorUtility.InitializeProbe(p, a);
}
// For an unknown reason, newly created probes sometype have the type "Quad" (value = 1)
// This type of probe is not supported by Unity since 5.4
// But we need to force it here so it does not bake into a 2D texture but a Cubemap

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


Undo.SetCurrentGroupName("Remove HD Reflection Probe");
Undo.DestroyObjectImmediate(go.GetComponent<ReflectionProbe>());
Undo.DestroyObjectImmediate(go.GetComponent<HDAdditionalReflectionData>());
Undo.DestroyObjectImmediate(go.GetComponent<MeshRenderer>());
Undo.DestroyObjectImmediate(go.GetComponent<MeshFilter>());
}
static Dictionary<ReflectionProbe, HDReflectionProbeEditor> s_ReflectionProbeEditors = new Dictionary<ReflectionProbe, HDReflectionProbeEditor>();

}
InitializeAllTargetProbes();
ChangeVisibilityOfAllTargets(true);
void OnDisable()
{
ChangeVisibilityOfAllTargets(false);
}
public override void OnInspectorGUI()
{

var flags = visible ? HideFlags.None : HideFlags.HideInInspector;
for (var i = 0; i < targets.Length; ++i)
{
var target = targets[i];
var p = (ReflectionProbe)target;
var meshRenderer = p.GetComponent<MeshRenderer>();
var meshFilter = p.GetComponent<MeshFilter>();
meshRenderer.hideFlags = flags;
meshFilter.hideFlags = flags;
}
}

55
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs


{
public static class HDReflectionProbeEditorUtility
{
static int _Cubemap = Shader.PropertyToID("_Cubemap");
static Material s_PreviewMaterial;
static Mesh s_SphereMesh;
[InitializeOnLoadMethod]
static void Initialize()
{
s_SphereMesh = Resources.GetBuiltinResource(typeof(Mesh), "New-Sphere.fbx") as Mesh;
}
public static Matrix4x4 GetLocalSpace(ReflectionProbe probe)
{
var t = probe.transform.position;

return true;
}
public static void ResetProbeSceneTextureInMaterial(ReflectionProbe p)
{
var renderer = p.GetComponent<Renderer>();
renderer.sharedMaterial.SetTexture(_Cubemap, p.texture);
}
public static float CalculateSphereMaxBlendDistance(HDReflectionProbeUI s, SerializedHDReflectionProbe p, Editor o)
{
return p.influenceSphereRadius.floatValue;

{
return p.boxSize.vector3Value * 0.5f;
}
internal static void InitializeProbe(ReflectionProbe p, HDAdditionalReflectionData data)
{
var meshFilter = p.GetComponent<MeshFilter>() ?? p.gameObject.AddComponent<MeshFilter>();
var meshRenderer = p.GetComponent<MeshRenderer>() ?? p.gameObject.AddComponent<MeshRenderer>();
meshFilter.sharedMesh = s_SphereMesh;
// Lazy evaluation attempt to avoid shader compil error issue in Editor (The shader is not found the first time
// we load after deleting Library folder)
if (s_PreviewMaterial == null)
{
s_PreviewMaterial = new Material(Shader.Find("Debug/ReflectionProbePreview"))
{
hideFlags = HideFlags.HideAndDontSave
};
}
var material = meshRenderer.sharedMaterial;
if (material == null
|| material == s_PreviewMaterial
|| material.shader != s_PreviewMaterial.shader)
{
material = Object.Instantiate(s_PreviewMaterial);
material.SetTexture(_Cubemap, p.texture);
material.hideFlags = HideFlags.HideAndDontSave;
meshRenderer.material = material;
}
meshRenderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off;
meshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
meshRenderer.motionVectorGenerationMode = MotionVectorGenerationMode.ForceNoMotion;
}
internal static void ChangeVisibility(ReflectionProbe p, bool visible)
{
var meshRenderer = p.GetComponent<MeshRenderer>() ?? p.gameObject.AddComponent<MeshRenderer>();
meshRenderer.enabled = visible;
}
}
}

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


if (EditorGUI.EndChangeCheck())
{
s.SetModeTarget(p.mode.intValue);
foreach (var targetObject in p.so.targetObjects)
HDReflectionProbeEditorUtility.ResetProbeSceneTextureInMaterial((ReflectionProbe)targetObject);
}
}

4
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/Volume/InfluenceVolumeUI.Drawers.cs


var maxFaceDistance = d.sphereBaseRadius.floatValue;
EditorGUILayout.PropertyField(d.sphereBaseRadius, _.GetContent("Radius"));
//EditorGUILayout.PropertyField(d.sphereBaseOffset, _.GetContent("Offset"));
EditorGUILayout.Slider(d.sphereInfluenceFade, 0, maxFaceDistance, _.GetContent("Influence Fade"));
EditorGUILayout.Slider(d.sphereInfluenceNormalFade, 0, maxFaceDistance, _.GetContent("Influence Normal Fade"));
EditorGUILayout.Slider(d.sphereInfluenceFade, 0, maxFaceDistance, _.GetContent("Blend Distance"));
}
}
}

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


namespace UnityEngine.Experimental.Rendering
{
[RequireComponent(typeof(ReflectionProbe), typeof(MeshFilter), typeof(MeshRenderer))]
[RequireComponent(typeof(ReflectionProbe))]
public class HDAdditionalReflectionData : MonoBehaviour
{
[HideInInspector]

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/PlanarReflectionProbe.cs.meta


serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 3b77af68825357f47ae9f6d0b9d30f2d, type: 3}
userData:
assetBundleName:
assetBundleVariant:

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/Volumes/ReflectionProxyVolumeComponent.cs.meta


serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: a9ddbc20ff7d25948976df9d0f76eaf7, type: 3}
userData:
assetBundleName:
assetBundleVariant:

8
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons.meta


fileFormatVersion: 2
guid: 97dc5286d61263d47b2705992cffe2d9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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


using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering
{
partial class HDReflectionProbeEditor
{
static Mesh sphere;
static Material material;
[DrawGizmo(GizmoType.Active)]
static void RenderGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var e = GetEditorFor(reflectionProbe);
if (e == null || !e.sceneViewEditing)
return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
switch (EditMode.editMode)
{
// Influence editing
case EditMode.SceneViewEditMode.ReflectionProbeBox:
Gizmos_Influence(reflectionProbe, reflectionData, e, true);
break;
// Influence fade editing
case EditMode.SceneViewEditMode.GridBox:
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Standard, true);
break;
// Influence normal fade editing
case EditMode.SceneViewEditMode.Collider:
Gizmos_InfluenceFade(reflectionProbe, reflectionData, e, InfluenceType.Normal, true);
break;
}
}
[DrawGizmo(GizmoType.Selected)]
static void DrawSelectedGizmo(ReflectionProbe reflectionProbe, GizmoType gizmoType)
{
var e = GetEditorFor(reflectionProbe);
if (e == null)
return;
var reflectionData = reflectionProbe.GetComponent<HDAdditionalReflectionData>();
Gizmos_CapturePoint(reflectionProbe, reflectionData, e);
if (!e.sceneViewEditing)
return;
//Gizmos_Influence(reflectionProbe, reflectionData, e, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Standard, false);
Gizmos_InfluenceFade(reflectionProbe, reflectionData, null, InfluenceType.Normal, false);
DrawVerticalRay(reflectionProbe.transform);
}
static void Gizmos_InfluenceFade(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, InfluenceType type, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmo6FacesBoxContained box;
Vector3 boxCenterOffset;
Vector3 boxSizeOffset;
float sphereRadiusOffset;
Color color;
switch (type)
{
default:
case InfluenceType.Standard:
{
box = e != null ? e.m_UIState.alternativeBoxBlendHandle : null;
boxCenterOffset = a.boxBlendCenterOffset;
boxSizeOffset = a.boxBlendSizeOffset;
sphereRadiusOffset = a.sphereBlendRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceBlendFace : k_GizmoThemeColorInfluenceBlend;
break;
}
case InfluenceType.Normal:
{
box = e != null ? e.m_UIState.alternativeBoxBlendNormalHandle : null;
boxCenterOffset = a.boxBlendNormalCenterOffset;
boxSizeOffset = a.boxBlendNormalSizeOffset;
sphereRadiusOffset = a.sphereBlendNormalRadiusOffset;
color = isEdit ? k_GizmoThemeColorInfluenceNormalBlendFace : k_GizmoThemeColorInfluenceNormalBlend;
break;
}
}
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = color;
if (e != null) // e == null may occure when editor have still not been created at selection while the tool is not used for this part
{
box.DrawHull(isEdit);
}
else
{
if (isEdit)
Gizmos.DrawCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
else
Gizmos.DrawWireCube(p.center + boxCenterOffset, p.size + boxSizeOffset);
}
break;
}
case ShapeType.Sphere:
{
Gizmos.color = color;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius + sphereRadiusOffset);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
}
static void Gizmos_Influence(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e, bool isEdit)
{
var col = Gizmos.color;
var mat = Gizmos.matrix;
Gizmos.matrix = HDReflectionProbeEditorUtility.GetLocalSpace(p);
switch (a.influenceShape)
{
case ShapeType.Box:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
e.m_UIState.alternativeBoxInfluenceHandle.DrawHull(isEdit);
break;
}
case ShapeType.Sphere:
{
Gizmos.color = k_GizmoThemeColorExtentFace;
if (isEdit)
Gizmos.DrawSphere(p.center, a.influenceSphereRadius);
else
Gizmos.DrawWireSphere(p.center, a.influenceSphereRadius);
break;
}
}
Gizmos.matrix = mat;
Gizmos.color = col;
}
static void DrawVerticalRay(Transform transform)
{
Ray ray = new Ray(transform.position, Vector3.down);
RaycastHit hit;
if (Physics.Raycast(ray, out hit))
{
Handles.color = Color.green;
Handles.zTest = UnityEngine.Rendering.CompareFunction.LessEqual;
Handles.DrawLine(transform.position - Vector3.up * 0.5f, hit.point);
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f);
Handles.color = Color.red;
Handles.zTest = UnityEngine.Rendering.CompareFunction.Greater;
Handles.DrawLine(transform.position, hit.point);
Handles.DrawWireDisc(hit.point, hit.normal, 0.5f);
}
}
static void Gizmos_CapturePoint(ReflectionProbe p, HDAdditionalReflectionData a, HDReflectionProbeEditor e)
{
if(sphere == null)
{
sphere = Resources.GetBuiltinResource<Mesh>("New-Sphere.fbx");
}
if(material == null)
{
material = new Material(Shader.Find("Debug/ReflectionProbePreview"));
}
material.SetTexture("_Cubemap", p.texture);
material.SetPass(0);
Graphics.DrawMeshNow(sphere, Matrix4x4.TRS(p.transform.position, Quaternion.identity, Vector3.one));
}
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Gizmos.cs.meta


fileFormatVersion: 2
guid: f0521a8f59de2c548bc5a6796cd32be9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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


using System;
using UnityEditor.IMGUI.Controls;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Experimental.Rendering.HDPipeline;
namespace UnityEditor.Experimental.Rendering
{
partial class HDReflectionProbeEditor
{
internal static Color k_GizmoThemeColorExtent = new Color(255f / 255f, 229f / 255f, 148f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorExtentFace = new Color(255f / 255f, 229f / 255f, 148f / 255f, 45f / 255f);
internal static Color k_GizmoThemeColorInfluenceBlend = new Color(83f / 255f, 255f / 255f, 95f / 255f, 75f / 255f);
internal static Color k_GizmoThemeColorInfluenceBlendFace = new Color(83f / 255f, 255f / 255f, 95f / 255f, 17f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormalBlend = new Color(0f / 255f, 229f / 255f, 255f / 255f, 80f / 255f);
internal static Color k_GizmoThemeColorInfluenceNormalBlendFace = new Color(0f / 255f, 229f / 255f, 255f / 255f, 36f / 255f);
internal static Color k_GizmoThemeColorProjection = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorProjectionFace = new Color(0x00 / 255f, 0xE5 / 255f, 0xFF / 255f, 0x20 / 255f);
internal static Color k_GizmoThemeColorDisabled = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static Color k_GizmoThemeColorDisabledFace = new Color(0x99 / 255f, 0x89 / 255f, 0x59 / 255f, 0x10 / 255f);
internal static readonly Color[][] k_handlesColor = new Color[][]
{
new Color[]
{
Color.red,
Color.green,
Color.blue
},
new Color[]
{
new Color(.5f, 0f, 0f, 1f),
new Color(0f, .5f, 0f, 1f),
new Color(0f, 0f, .5f, 1f)
}
};
}
}

11
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditor.Skin.cs.meta


fileFormatVersion: 2
guid: 4bdc573336d075b419133b489a094c6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

66
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png

之前 之后
宽度: 256  |  高度: 256  |  大小: 18 KiB

97
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/PlanarReflection.png.meta


fileFormatVersion: 2
guid: 3b77af68825357f47ae9f6d0b9d30f2d
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

54
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png

之前 之后
宽度: 256  |  高度: 256  |  大小: 16 KiB

97
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Icons/Proxy.png.meta


fileFormatVersion: 2
guid: a9ddbc20ff7d25948976df9d0f76eaf7
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 6
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2ff1115d37a2ce24f910473fc18b2af2
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存