浏览代码

Added box projection field

/feature-ReflectionProbeFit
Frédéric Vauchelles 7 年前
当前提交
af7f7a25
共有 6 个文件被更改,包括 60 次插入1060 次删除
  1. 97
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDCubemapInspector.cs
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Data.cs
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Drawers.cs
  4. 8
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  5. 1001
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs
  6. 11
      ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs.meta

97
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDCubemapInspector.cs


Rotating = 2
}
static GUIContent s_MipMapLow, s_MipMapHigh, s_CurveKeyframeSelected, s_CurveKeyframeSemiSelectedOverlay, s_RGBMIcon;
static GUIStyle s_PreButton, s_PreSlider, s_PreSliderThumb, s_PreLabel;
static Mesh sphereMesh
{
get { return s_SphereMesh ?? (s_SphereMesh = Resources.GetBuiltinResource(typeof(Mesh), "New-Sphere.fbx") as Mesh); }
}
public float m_PreviewExposure = 0f;
public float m_MipLevelPreview = 0f;
static GUIContent s_MipMapLow, s_MipMapHigh, s_CurveKeyframeSelected, s_CurveKeyframeSemiSelectedOverlay, s_RGBMIcon;
static GUIStyle s_PreButton, s_PreSlider, s_PreSliderThumb, s_PreLabel;
public float previewExposure = 0f;
public float mipLevelPreview = 0f;
void Awake()
{
m_ReflectiveMaterial = new Material(Shader.Find("Debug/ReflectionProbePreview"))
{
hideFlags = HideFlags.HideAndDontSave
};
InitIcons();
}
{
InitIcons();
}
m_ReflectiveMaterial = new Material(Shader.Find("Debug/ReflectionProbePreview"));
m_ReflectiveMaterial.hideFlags = HideFlags.HideAndDontSave;
}
void OnDisable()

}
static Mesh sphereMesh
{
get { return s_SphereMesh ?? (s_SphereMesh = Resources.GetBuiltinResource(typeof(Mesh), "New-Sphere.fbx") as Mesh); }
}
public override bool HasPreviewGUI()
{
return true;

{
if(m_ReflectiveMaterial != null)
{
m_ReflectiveMaterial.SetFloat("_Exposure", m_PreviewExposure);
m_ReflectiveMaterial.SetFloat("_MipLevel", m_MipLevelPreview);
m_ReflectiveMaterial.SetFloat("_Exposure", previewExposure);
m_ReflectiveMaterial.SetFloat("_MipLevel", mipLevelPreview);
}
if(m_PreviewUtility == null)

}
}
void InitPreview()
{
m_PreviewUtility = new PreviewRenderUtility(false, true);
m_PreviewUtility.cameraFieldOfView = 50.0f;
m_PreviewUtility.camera.nearClipPlane = 0.01f;
m_PreviewUtility.camera.farClipPlane = 20.0f;
m_PreviewUtility.camera.transform.position = new Vector3(0, 0, 2);
m_PreviewUtility.camera.transform.LookAt(Vector3.zero);
//m_PreviewUtility.camera.clearFlags = CameraClearFlags.Skybox;
}
static void InitIcons()
{
s_MipMapLow = EditorGUIUtility.IconContent("PreTextureMipMapLow");
s_MipMapHigh = EditorGUIUtility.IconContent("PreTextureMipMapHigh");
s_CurveKeyframeSelected = EditorGUIUtility.IconContent("d_curvekeyframeselected");
s_CurveKeyframeSemiSelectedOverlay = EditorGUIUtility.IconContent("d_curvekeyframesemiselectedoverlay");
s_RGBMIcon = EditorGUIUtility.IconContent("PreMatLight1"); // TODO: proper icon for RGBM preview mode
s_PreButton = "preButton";
s_PreSlider = "preSlider";
s_PreSliderThumb = "preSliderThumb";
s_PreLabel = "preLabel";
}
public override void OnPreviewSettings()
{
GUI.enabled = true;

m_MipLevelPreview = GUILayout.HorizontalSlider(m_MipLevelPreview, 0, ((Cubemap)target).mipmapCount, GUILayout.MaxWidth(80));
mipLevelPreview = GUILayout.HorizontalSlider(mipLevelPreview, 0, ((Cubemap)target).mipmapCount, GUILayout.MaxWidth(80));
GUILayout.Box(s_CurveKeyframeSemiSelectedOverlay, s_PreLabel,GUILayout.MaxWidth(20));
GUILayout.Box(s_CurveKeyframeSemiSelectedOverlay, s_PreLabel, GUILayout.MaxWidth(20));
m_PreviewExposure = GUILayout.HorizontalSlider(m_PreviewExposure, -10f, 10f, GUILayout.MaxWidth(80));
previewExposure = GUILayout.HorizontalSlider(previewExposure, -10f, 10f, GUILayout.MaxWidth(80));
public bool HandleMouse(Rect Viewport)
void InitPreview()
{
m_PreviewUtility = new PreviewRenderUtility(false, true);
m_PreviewUtility.cameraFieldOfView = 50.0f;
m_PreviewUtility.camera.nearClipPlane = 0.01f;
m_PreviewUtility.camera.farClipPlane = 20.0f;
m_PreviewUtility.camera.transform.position = new Vector3(0, 0, 2);
m_PreviewUtility.camera.transform.LookAt(Vector3.zero);
//m_PreviewUtility.camera.clearFlags = CameraClearFlags.Skybox;
}
bool HandleMouse(Rect Viewport)
{
var result = false;

return result;
}
private void UpdateCamera()
void UpdateCamera()
}
static void InitIcons()
{
s_MipMapLow = EditorGUIUtility.IconContent("PreTextureMipMapLow");
s_MipMapHigh = EditorGUIUtility.IconContent("PreTextureMipMapHigh");
s_CurveKeyframeSelected = EditorGUIUtility.IconContent("d_curvekeyframeselected");
s_CurveKeyframeSemiSelectedOverlay = EditorGUIUtility.IconContent("d_curvekeyframesemiselectedoverlay");
s_RGBMIcon = EditorGUIUtility.IconContent("PreMatLight1"); // TODO: proper icon for RGBM preview mode
s_PreButton = "preButton";
s_PreSlider = "preSlider";
s_PreSliderThumb = "preSliderThumb";
s_PreLabel = "preLabel";
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditor.Data.cs


internal SerializedProperty useOcclusionCulling;
internal SerializedProperty nearClip;
internal SerializedProperty farClip;
internal SerializedProperty boxProjection;
internal SerializedProperty influenceShape;
internal SerializedProperty influenceSphereRadius;

useOcclusionCulling = so.FindProperty("m_UseOcclusionCulling");
nearClip = so.FindProperty("m_NearClip");
farClip = so.FindProperty("m_FarClip");
boxProjection = so.FindProperty("m_BoxProjection");
influenceShape = addso.Find((HDAdditionalReflectionData d) => d.influenceShape);
influenceSphereRadius = addso.Find((HDAdditionalReflectionData d) => d.influenceSphereRadius);

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


EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(p.boxSize, CoreEditorUtils.GetContent("Box Size|The size of the box in which the reflections will be applied to objects. The value is not affected by the Transform of the Game Object."));
EditorGUILayout.PropertyField(p.boxOffset, CoreEditorUtils.GetContent("Box Offset|The center of the box in which the reflections will be applied to objects. The value is relative to the position of the Game Object."));
EditorGUILayout.PropertyField(p.boxProjection, CoreEditorUtils.GetContent("Box Projection|Box projection 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 box projection 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"));
if (EditorGUI.EndChangeCheck())
{

8
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


envLightData.minProjectionDistance = 0;
switch (additionalData.influenceShape)
{
case ReflectionInfluenceShape.Box: envLightData.envShapeType = EnvShapeType.Box; break;
case ReflectionInfluenceShape.Box:
{
envLightData.envShapeType = EnvShapeType.Box;
if (probe.boxProjection != 0)
envLightData.minProjectionDistance = 65504.0f;
break;
}
case ReflectionInfluenceShape.Sphere: envLightData.envShapeType = EnvShapeType.Sphere; break;
}
}

1001
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs
文件差异内容过多而无法显示
查看文件

11
ScriptableRenderPipeline/HDRenderPipeline/Editor/Lighting/HDReflectionProbeEditorOld.cs.meta


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