浏览代码
Merge pull request #765 from Unity-Technologies/Branch_FixBakingSky
Merge pull request #765 from Unity-Technologies/Branch_FixBakingSky
Fixed baking sky after last interpolation volume upgrade/main
GitHub
7 年前
当前提交
af279262
共有 39 个文件被更改,包括 3242 次插入 和 2600 次删除
-
83SampleScenes/HDTest/AnimTest.unity
-
87SampleScenes/HDTest/AnimTest2.unity
-
93SampleScenes/HDTest/BasicProfiling.unity
-
719SampleScenes/HDTest/DistortionTest.unity
-
69SampleScenes/HDTest/GIParityTest.unity
-
85SampleScenes/HDTest/GIParityTest/LightingData.asset
-
3SampleScenes/HDTest/GIParityTest/LightingData.asset.meta
-
65SampleScenes/HDTest/GIParityTest/Lightmap-0_comp_dir.png
-
1001SampleScenes/HDTest/GIParityTest/Lightmap-0_comp_light.exr
-
1001SampleScenes/HDTest/GIParityTest/ReflectionProbe-0.exr
-
58SampleScenes/HDTest/GammaTest.unity
-
77SampleScenes/HDTest/GlobalIlluminationTest.unity
-
686SampleScenes/HDTest/LayeredLitTest.unity
-
37SampleScenes/HDTest/MultipleShadowsTest.unity
-
61SampleScenes/HDTest/SSSProfiling.unity
-
73SampleScenes/HDTest/ShadowsTest.unity
-
81SampleScenes/HDTest/SkyFogTest.unity
-
62SampleScenes/HDTest/Volume Profiles/Procedural Sky Scene Settings.asset
-
88SampleScenes/HDTest/WindTest.unity
-
10ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/SkySettingsEditor.cs
-
33ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkyManager.cs
-
48ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkySettings.cs
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Black_Sky_Shadow50.prefab
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Default_Sky.prefab
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Default_Sky_2.prefab
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Default_Sky_3.prefab
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Default_Sky_4.prefab
-
14Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Linear_Fog.prefab
-
51Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/CommonAssets/HDRP_Test_Camera.prefab
-
942Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1212_Lit_Emission.unity
-
2Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1212_Lit_Emission.unity.meta
-
9Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1212_Lit_Emission/Lit_Emissive.mat
-
90ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/BakingSkyEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Sky/BakingSkyEditor.cs.meta
-
122ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/BakingSky.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/BakingSky.cs.meta
719
SampleScenes/HDTest/DistortionTest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
85
SampleScenes/HDTest/GIParityTest/LightingData.asset
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 080b950fe4787dd49ad5ab1c32a27b13 |
|||
timeCreated: 1494364989 |
|||
licenseType: Pro |
|||
externalObjects: {} |
|||
mainObjectFileID: 25800000 |
|||
userData: |
|||
assetBundleName: |
1001
SampleScenes/HDTest/GIParityTest/Lightmap-0_comp_light.exr
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
1001
SampleScenes/HDTest/GIParityTest/ReflectionProbe-0.exr
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
686
SampleScenes/HDTest/LayeredLitTest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
942
Tests/GraphicsTests/RenderPipeline/HDRenderPipeline/Scenes/1xxx_Materials/1212_Lit_Emission.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 8111f2ef86fe26945987ad505853d04c |
|||
guid: f465136a9ac4cb1429a4a1761d07c3c3 |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[CustomEditor(typeof(BakingSky))] |
|||
[DisallowMultipleComponent] |
|||
public class BakingSkyEditor : Editor |
|||
{ |
|||
SerializedProperty m_VolumeProfile; |
|||
SerializedProperty m_SkyUniqueID; |
|||
|
|||
List<GUIContent> m_SkyClassNames = null; |
|||
List<int> m_SkyUniqueIDs = null; |
|||
|
|||
void InitializeProperties() |
|||
{ |
|||
m_VolumeProfile = serializedObject.FindProperty("m_Profile"); |
|||
m_SkyUniqueID = serializedObject.FindProperty("m_BakingSkyUniqueID"); |
|||
|
|||
} |
|||
|
|||
void UpdateSkyIntPopupData(bool reset = false) |
|||
{ |
|||
if (m_SkyClassNames == null) |
|||
{ |
|||
m_SkyClassNames = new List<GUIContent>(); |
|||
m_SkyUniqueIDs = new List<int>(); |
|||
} |
|||
|
|||
// We always reinit because the content can change depending on the volume and we are not always notified when this happens (like for undo/redo for example)
|
|||
m_SkyClassNames.Clear(); |
|||
m_SkyUniqueIDs.Clear(); |
|||
|
|||
// Add special "None" case.
|
|||
m_SkyClassNames.Add(new GUIContent("None")); |
|||
m_SkyUniqueIDs.Add(0); |
|||
|
|||
VolumeProfile profile = m_VolumeProfile.objectReferenceValue as VolumeProfile; |
|||
if(profile != null) |
|||
{ |
|||
var skyTypesDict = SkyManager.skyTypesDict; |
|||
|
|||
foreach (KeyValuePair<int, Type> kvp in skyTypesDict) |
|||
{ |
|||
if (profile.Has(kvp.Value)) |
|||
{ |
|||
m_SkyClassNames.Add(new GUIContent(kvp.Value.Name.ToString())); |
|||
m_SkyUniqueIDs.Add(kvp.Key); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
protected void OnEnable() |
|||
{ |
|||
InitializeProperties(); |
|||
|
|||
if(m_VolumeProfile.objectReferenceValue == null) |
|||
{ |
|||
BakingSky bakingSky = (BakingSky)target; |
|||
Volume volume = bakingSky.GetComponent<Volume>(); |
|||
if(volume != null) |
|||
{ |
|||
bakingSky.profile = volume.sharedProfile; |
|||
} |
|||
} |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
serializedObject.Update(); |
|||
|
|||
// Lazy init because domain reload, undo/redo, etc...
|
|||
UpdateSkyIntPopupData(); |
|||
|
|||
EditorGUILayout.PropertyField(m_VolumeProfile); |
|||
using (new EditorGUI.DisabledScope(m_SkyClassNames.Count == 1)) // Only "None"
|
|||
{ |
|||
EditorGUILayout.IntPopup(m_SkyUniqueID, m_SkyClassNames.ToArray(), m_SkyUniqueIDs.ToArray(), CoreEditorUtils.GetContent("Baking Sky|Specify which kind of sky you want to use for baking in the referenced profile.")); |
|||
} |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 339e06d3db9385b45938eeec10558268 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[ExecuteInEditMode] |
|||
public class BakingSky : MonoBehaviour |
|||
{ |
|||
[SerializeField] |
|||
VolumeProfile m_Profile; |
|||
[SerializeField] |
|||
int m_BakingSkyUniqueID = 0; |
|||
|
|||
// We need to keep a reference in order to unregister it upon change.
|
|||
SkySettings m_BakingSky = null; |
|||
|
|||
List<SkySettings> m_VolumeSkyList = new List<SkySettings>(); |
|||
|
|||
|
|||
public VolumeProfile profile |
|||
{ |
|||
get |
|||
{ |
|||
return m_Profile; |
|||
} |
|||
set |
|||
{ |
|||
// Changing the volume is considered a destructive operation => reset the baking sky.
|
|||
if (value != m_Profile) |
|||
{ |
|||
m_BakingSkyUniqueID = 0; |
|||
} |
|||
|
|||
m_Profile = value; |
|||
} |
|||
} |
|||
|
|||
public int bakingSkyUniqueID |
|||
{ |
|||
get |
|||
{ |
|||
return m_BakingSkyUniqueID; |
|||
} |
|||
set |
|||
{ |
|||
m_BakingSkyUniqueID = value; |
|||
UpdateCurrentBakingSky(); |
|||
} |
|||
} |
|||
|
|||
void UpdateCurrentBakingSky() |
|||
{ |
|||
SkySettings newBakingSky = GetSkyFromIDAndVolume(m_BakingSkyUniqueID, m_Profile); |
|||
|
|||
if(newBakingSky != m_BakingSky) |
|||
{ |
|||
SkyManager.UnRegisterBakingSky(m_BakingSky); |
|||
if (newBakingSky != null) |
|||
SkyManager.RegisterBakingSky(newBakingSky); |
|||
|
|||
m_BakingSky = newBakingSky; |
|||
} |
|||
} |
|||
|
|||
SkySettings GetSkyFromIDAndVolume(int skyUniqueID, VolumeProfile profile) |
|||
{ |
|||
if(profile != null && skyUniqueID != 0) |
|||
{ |
|||
m_VolumeSkyList.Clear(); |
|||
if (m_Profile.TryGetAllSubclassOf<SkySettings>(typeof(SkySettings), m_VolumeSkyList)) |
|||
{ |
|||
foreach(var sky in m_VolumeSkyList) |
|||
{ |
|||
if(skyUniqueID == SkySettings.GetUniqueID(sky.GetType())) |
|||
{ |
|||
return sky; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
// All actions done in this method are because Editor won't go through setters so we need to manually check consistency of our data.
|
|||
void OnValidate() |
|||
{ |
|||
if (!isActiveAndEnabled) |
|||
return; |
|||
|
|||
// If we detect that the profile has been removed we need to reset the baking sky.
|
|||
if(m_Profile == null) |
|||
{ |
|||
m_BakingSkyUniqueID = 0; |
|||
} |
|||
|
|||
// If we detect that the profile has changed, we need to reset the baking sky.
|
|||
// We have to do that manually because PropertyField won't go through setters.
|
|||
if(profile != null && m_BakingSky != null) |
|||
{ |
|||
if(!profile.components.Find(x => x == m_BakingSky)) |
|||
{ |
|||
m_BakingSkyUniqueID = 0; |
|||
} |
|||
} |
|||
|
|||
UpdateCurrentBakingSky(); |
|||
} |
|||
|
|||
void OnEnable() |
|||
{ |
|||
UpdateCurrentBakingSky(); |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
SkyManager.UnRegisterBakingSky(m_BakingSky); |
|||
m_BakingSky = null; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 441482e8936e35048a1dffac814e3ef8 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue