当前提交
10007208
共有 36 个文件被更改,包括 512 次插入 和 439 次删除
-
7SampleScenes/HDTest/GlobalIlluminationTest/TestRealtime.cs
-
19ScriptableRenderPipeline/Core/CoreUtils.cs
-
17ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
-
31ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs
-
59ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.hlsl
-
112ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/AtmosphericScatteringEditor.cs
-
4ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/AtmosphericScatteringEditor.cs.meta
-
77ScriptableRenderPipeline/HDRenderPipeline/Sky/Editor/SkySettingsEditor.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/Sky/Editor/SkySettingsEditor.cs.meta
-
36ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Editor/HDRISkyEditor.cs
-
3ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Editor/HDRISkyEditor.cs.meta
-
4ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkyRenderer.cs
-
68ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Editor/ProceduralSkyEditor.cs
-
4ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs
-
89ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
-
38ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettings.cs
-
28ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/ExponentialFogEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/ExponentialFogEditor.cs.meta
-
32ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/LinearFogEditor.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/Editor/LinearFogEditor.cs.meta
-
25ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/ExponentialFog.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/ExponentialFog.cs.meta
-
26ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/LinearFog.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/LinearFog.cs.meta
-
26ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISky.cs
-
36ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSky.cs
-
51ScriptableRenderPipeline/HDRenderPipeline/Sky/VisualEnvironment.cs
-
11ScriptableRenderPipeline/HDRenderPipeline/Sky/VisualEnvironment.cs.meta
-
25ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkySettings.cs
-
39ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkySettings.cs
-
12ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettingsSingleton.cs.meta
-
13ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettingsSingleton.cs
-
0/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISky.cs.meta
-
0/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSky.cs.meta
|
|||
using System.Collections; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
public abstract class SkySettingsEditor |
|||
: Editor |
|||
public abstract class SkySettingsEditor : VolumeComponentEditor |
|||
static protected class SkySettingsStyles |
|||
{ |
|||
public static readonly GUIContent skyResolution = new GUIContent("Resolution", "Resolution of the environment lighting generated from the sky."); |
|||
public static readonly GUIContent skyExposure = new GUIContent("Exposure", "Exposure of the sky in EV."); |
|||
public static readonly GUIContent skyRotation = new GUIContent("Rotation", "Rotation of the sky."); |
|||
public static readonly GUIContent skyMultiplier = new GUIContent("Multiplier", "Intensity multiplier for the sky."); |
|||
public static readonly GUIContent environmentUpdateMode = new GUIContent("Environment Update Mode", "Specify how the environment lighting should be updated."); |
|||
public static readonly GUIContent environmentUpdatePeriod = new GUIContent("Environment Update Period", "If environment update is set to realtime, period in seconds at which it is updated (0.0 means every frame)."); |
|||
public static readonly GUIContent lightingOverride = new GUIContent("Lighting Override", "If a lighting override cubemap is provided, this cubemap will be used to compute lighting instead of the result from the visible sky."); |
|||
} |
|||
SerializedDataParameter m_SkyResolution; |
|||
SerializedDataParameter m_SkyExposure; |
|||
SerializedDataParameter m_SkyMultiplier; |
|||
SerializedDataParameter m_SkyRotation; |
|||
SerializedDataParameter m_EnvUpdateMode; |
|||
SerializedDataParameter m_EnvUpdatePeriod; |
|||
SerializedDataParameter m_LightingOverride; |
|||
private SerializedProperty m_SkyResolution; |
|||
private SerializedProperty m_SkyExposure; |
|||
private SerializedProperty m_SkyMultiplier; |
|||
private SerializedProperty m_SkyRotation; |
|||
private SerializedProperty m_EnvUpdateMode; |
|||
private SerializedProperty m_EnvUpdatePeriod; |
|||
private SerializedProperty m_LightingOverride; |
|||
|
|||
private AtmosphericScatteringEditor m_AtmosphericScatteringEditor = new AtmosphericScatteringEditor(); |
|||
|
|||
void OnEnable() |
|||
public override void OnEnable() |
|||
InitializeProperties(); |
|||
} |
|||
var o = new PropertyFetcher<SkySettings>(serializedObject); |
|||
virtual protected void InitializeProperties() |
|||
{ |
|||
m_SkyResolution = serializedObject.FindProperty("resolution"); |
|||
m_SkyExposure = serializedObject.FindProperty("exposure"); |
|||
m_SkyMultiplier = serializedObject.FindProperty("multiplier"); |
|||
m_SkyRotation = serializedObject.FindProperty("rotation"); |
|||
m_EnvUpdateMode = serializedObject.FindProperty("updateMode"); |
|||
m_EnvUpdatePeriod = serializedObject.FindProperty("updatePeriod"); |
|||
m_LightingOverride = serializedObject.FindProperty("lightingOverride"); |
|||
|
|||
SerializedProperty atmosphericScattering = serializedObject.FindProperty("atmosphericScatteringSettings"); |
|||
m_AtmosphericScatteringEditor.OnEnable(atmosphericScattering); |
|||
m_SkyResolution = Unpack(o.Find(x => x.resolution)); |
|||
m_SkyExposure = Unpack(o.Find(x => x.exposure)); |
|||
m_SkyMultiplier = Unpack(o.Find(x => x.multiplier)); |
|||
m_SkyRotation = Unpack(o.Find(x => x.rotation)); |
|||
m_EnvUpdateMode = Unpack(o.Find(x => x.updateMode)); |
|||
m_EnvUpdatePeriod = Unpack(o.Find(x => x.updatePeriod)); |
|||
m_LightingOverride = Unpack(o.Find(x => x.lightingOverride)); |
|||
EditorGUILayout.PropertyField(m_SkyResolution, SkySettingsStyles.skyResolution); |
|||
EditorGUILayout.PropertyField(m_SkyExposure, SkySettingsStyles.skyExposure); |
|||
EditorGUILayout.PropertyField(m_SkyMultiplier, SkySettingsStyles.skyMultiplier); |
|||
EditorGUILayout.PropertyField(m_SkyRotation, SkySettingsStyles.skyRotation); |
|||
PropertyField(m_SkyResolution); |
|||
PropertyField(m_SkyExposure); |
|||
PropertyField(m_SkyMultiplier); |
|||
PropertyField(m_SkyRotation); |
|||
EditorGUILayout.PropertyField(m_EnvUpdateMode, SkySettingsStyles.environmentUpdateMode); |
|||
if (!m_EnvUpdateMode.hasMultipleDifferentValues && m_EnvUpdateMode.intValue == (int)EnvironementUpdateMode.Realtime) |
|||
PropertyField(m_EnvUpdateMode); |
|||
if (!m_EnvUpdateMode.value.hasMultipleDifferentValues && m_EnvUpdateMode.value.intValue == (int)EnvironementUpdateMode.Realtime) |
|||
EditorGUILayout.PropertyField(m_EnvUpdatePeriod, SkySettingsStyles.environmentUpdatePeriod); |
|||
EditorGUI.indentLevel++; |
|||
PropertyField(m_EnvUpdatePeriod); |
|||
EditorGUI.indentLevel--; |
|||
EditorGUILayout.PropertyField(m_LightingOverride, SkySettingsStyles.lightingOverride); |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
m_AtmosphericScatteringEditor.OnGUI(); |
|||
PropertyField(m_LightingOverride); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
[CustomEditor(typeof(HDRISkySettings))] |
|||
public class HDRISkySettingsEditor |
|||
[VolumeComponentEditor(typeof(HDRISky))] |
|||
public class HDRISkyEditor |
|||
private class Styles |
|||
{ |
|||
public readonly GUIContent skyHDRI = new GUIContent("HDRI", "Cubemap used to render the sky."); |
|||
} |
|||
|
|||
private static Styles s_Styles = null; |
|||
private static Styles styles |
|||
{ |
|||
get |
|||
{ |
|||
if (s_Styles == null) |
|||
s_Styles = new Styles(); |
|||
return s_Styles; |
|||
} |
|||
} |
|||
SerializedDataParameter m_SkyHDRI; |
|||
private SerializedProperty m_SkyHDRI; |
|||
|
|||
protected override void InitializeProperties() |
|||
public override void OnEnable() |
|||
base.InitializeProperties(); |
|||
base.OnEnable(); |
|||
m_SkyHDRI = serializedObject.FindProperty("skyHDRI"); |
|||
var o = new PropertyFetcher<HDRISky>(serializedObject); |
|||
m_SkyHDRI = Unpack(o.Find(x => x.skyHDRI)); |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUILayout.PropertyField(m_SkyHDRI, styles.skyHDRI); |
|||
PropertyField(m_SkyHDRI); |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
[CustomEditor(typeof(ProceduralSkySettings))] |
|||
[VolumeComponentEditor(typeof(ProceduralSky))] |
|||
private class Styles |
|||
{ |
|||
public readonly GUIContent sunSize = new GUIContent("Sun Size"); |
|||
public readonly GUIContent sunSizeConvergence = new GUIContent("Sun Size Convergence"); |
|||
public readonly GUIContent atmosphereThickness = new GUIContent("Atmosphere Thickness"); |
|||
public readonly GUIContent skyTint = new GUIContent("SkyTint"); |
|||
public readonly GUIContent groundColor = new GUIContent("Ground Color"); |
|||
public readonly GUIContent enableSunDisk = new GUIContent("Enable Sun Disk"); |
|||
} |
|||
SerializedDataParameter m_SunSize; |
|||
SerializedDataParameter m_SunSizeConvergence; |
|||
SerializedDataParameter m_AtmosphericThickness; |
|||
SerializedDataParameter m_SkyTint; |
|||
SerializedDataParameter m_GroundColor; |
|||
SerializedDataParameter m_EnableSunDisk; |
|||
private static Styles s_Styles = null; |
|||
private static Styles styles |
|||
public override void OnEnable() |
|||
get |
|||
{ |
|||
if (s_Styles == null) |
|||
s_Styles = new Styles(); |
|||
return s_Styles; |
|||
} |
|||
} |
|||
|
|||
private SerializedProperty m_SunSize; |
|||
private SerializedProperty m_SunSizeConvergence; |
|||
private SerializedProperty m_AtmosphericThickness; |
|||
private SerializedProperty m_SkyTint; |
|||
private SerializedProperty m_GroundColor; |
|||
private SerializedProperty m_EnableSunDisk; |
|||
base.OnEnable(); |
|||
protected override void InitializeProperties() |
|||
{ |
|||
base.InitializeProperties(); |
|||
var o = new PropertyFetcher<ProceduralSky>(serializedObject); |
|||
m_SunSize = serializedObject.FindProperty("sunSize"); |
|||
m_SunSizeConvergence = serializedObject.FindProperty("sunSizeConvergence"); |
|||
m_AtmosphericThickness = serializedObject.FindProperty("atmosphereThickness"); |
|||
m_SkyTint = serializedObject.FindProperty("skyTint"); |
|||
m_GroundColor = serializedObject.FindProperty("groundColor"); |
|||
m_EnableSunDisk = serializedObject.FindProperty("enableSunDisk"); |
|||
m_SunSize = Unpack(o.Find(x => x.sunSize)); |
|||
m_SunSizeConvergence = Unpack(o.Find(x => x.sunSizeConvergence)); |
|||
m_AtmosphericThickness = Unpack(o.Find(x => x.atmosphereThickness)); |
|||
m_SkyTint = Unpack(o.Find(x => x.skyTint)); |
|||
m_GroundColor = Unpack(o.Find(x => x.groundColor)); |
|||
m_EnableSunDisk = Unpack(o.Find(x => x.enableSunDisk)); |
|||
serializedObject.Update(); |
|||
|
|||
EditorGUILayout.PropertyField(m_EnableSunDisk, styles.enableSunDisk); |
|||
EditorGUILayout.PropertyField(m_SunSize, styles.sunSize); |
|||
EditorGUILayout.PropertyField(m_SunSizeConvergence, styles.sunSizeConvergence); |
|||
EditorGUILayout.PropertyField(m_AtmosphericThickness, styles.atmosphereThickness); |
|||
EditorGUILayout.PropertyField(m_SkyTint, styles.skyTint); |
|||
EditorGUILayout.PropertyField(m_GroundColor, styles.groundColor); |
|||
PropertyField(m_EnableSunDisk); |
|||
PropertyField(m_SunSize); |
|||
PropertyField(m_SunSizeConvergence); |
|||
PropertyField(m_AtmosphericThickness); |
|||
PropertyField(m_SkyTint); |
|||
PropertyField(m_GroundColor); |
|||
|
|||
serializedObject.ApplyModifiedProperties(); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[VolumeComponentEditor(typeof(ExponentialFog))] |
|||
public class ExponentialFogEditor : AtmosphericScatteringEditor |
|||
{ |
|||
private SerializedDataParameter m_FogDistance; |
|||
|
|||
public override void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
var o = new PropertyFetcher<ExponentialFog>(serializedObject); |
|||
|
|||
m_FogDistance = Unpack(o.Find(x => x.fogDistance)); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
base.OnInspectorGUI(); |
|||
PropertyField(m_FogDistance); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e551cbe9c454e5847ab25b6476285bdc |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEditor.Experimental.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[VolumeComponentEditor(typeof(LinearFog))] |
|||
public class LinearFogEditor : AtmosphericScatteringEditor |
|||
{ |
|||
private SerializedDataParameter m_FogStart; |
|||
private SerializedDataParameter m_FogEnd; |
|||
|
|||
public override void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
var o = new PropertyFetcher<LinearFog>(serializedObject); |
|||
|
|||
m_FogStart = Unpack(o.Find(x => x.fogStart)); |
|||
m_FogEnd = Unpack(o.Find(x => x.fogEnd)); |
|||
} |
|||
|
|||
public override void OnInspectorGUI() |
|||
{ |
|||
base.OnInspectorGUI(); |
|||
|
|||
PropertyField(m_FogStart); |
|||
PropertyField(m_FogEnd); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 54c746d584e88ea46b46b03ad311c0ac |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class ExponentialFog : AtmosphericScattering |
|||
{ |
|||
// Exp Fog
|
|||
private readonly static int m_ExpFogParam = Shader.PropertyToID("_ExpFogParameters"); |
|||
|
|||
// Exponential fog
|
|||
public ClampedFloatParameter fogDistance = new ClampedFloatParameter { value = 100.0f, min = 0.0f, clampMode = ParameterClampMode.Min }; |
|||
|
|||
public override void PushShaderParameters(CommandBuffer cmd, RenderingDebugSettings renderingDebug) |
|||
{ |
|||
PushShaderParametersCommon(cmd, FogType.Exponential, renderingDebug); |
|||
|
|||
cmd.SetGlobalVector(m_ExpFogParam, new Vector4(Mathf.Max(0.0f, fogDistance), 0.0f, 0.0f, 0.0f)); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 2150ee00179b2f4418ea8b21a7e98eea |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class LinearFog : AtmosphericScattering |
|||
{ |
|||
private readonly static int m_LinearFogParam = Shader.PropertyToID("_LinearFogParameters"); |
|||
|
|||
// Linear Fog
|
|||
public ClampedFloatParameter fogStart = new ClampedFloatParameter { value = 500.0f, min = 0.0f, clampMode = ParameterClampMode.Min }; |
|||
public ClampedFloatParameter fogEnd = new ClampedFloatParameter { value = 1000.0f, min = 0.0f, clampMode = ParameterClampMode.Min }; |
|||
|
|||
public override void PushShaderParameters(CommandBuffer cmd, RenderingDebugSettings renderingDebug) |
|||
{ |
|||
PushShaderParametersCommon(cmd, FogType.Linear, renderingDebug); |
|||
|
|||
// Linear Fog
|
|||
cmd.SetGlobalVector(m_LinearFogParam, new Vector4(fogStart, fogEnd, 1.0f / (fogEnd - fogStart), 0.0f)); |
|||
} |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: eb673446a9a2dfa408924fe9a56322e0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[DisallowMultipleComponent] |
|||
public class HDRISky : SkySettings |
|||
{ |
|||
[Tooltip("Cubemap used to render the sky.")] |
|||
public CubemapParameter skyHDRI = new CubemapParameter { value = null }; |
|||
|
|||
public override SkyRenderer GetRenderer() |
|||
{ |
|||
return new HDRISkyRenderer(this); |
|||
} |
|||
|
|||
public override int GetHashCode() |
|||
{ |
|||
int hash = base.GetHashCode(); |
|||
|
|||
unchecked |
|||
{ |
|||
hash = skyHDRI.value != null ? hash * 23 + skyHDRI.GetHashCode() : hash; |
|||
} |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[DisallowMultipleComponent] |
|||
public class ProceduralSky : SkySettings |
|||
{ |
|||
public ClampedFloatParameter sunSize = new ClampedFloatParameter { value = 0.04f, min = 0.0f, max = 1.0f }; |
|||
public ClampedFloatParameter sunSizeConvergence = new ClampedFloatParameter { value = 5.0f, min = 1.0f, max = 10.0f }; |
|||
public ClampedFloatParameter atmosphereThickness = new ClampedFloatParameter { value = 1.0f, min = 0.0f, max = 5.0f }; |
|||
public ColorParameter skyTint = new ColorParameter { value = new Color(0.5f, 0.5f, 0.5f, 1.0f) }; |
|||
public ColorParameter groundColor = new ColorParameter { value = new Color(0.369f, 0.349f, 0.341f, 1.0f) }; |
|||
public BoolParameter enableSunDisk = new BoolParameter { value = true }; |
|||
|
|||
public override SkyRenderer GetRenderer() |
|||
{ |
|||
return new ProceduralSkyRenderer(this); |
|||
} |
|||
|
|||
public override int GetHashCode() |
|||
{ |
|||
int hash = base.GetHashCode(); |
|||
|
|||
unchecked |
|||
{ |
|||
hash = hash * 23 + sunSize.GetHashCode(); |
|||
hash = hash * 23 + sunSizeConvergence.GetHashCode(); |
|||
hash = hash * 23 + atmosphereThickness.GetHashCode(); |
|||
hash = hash * 23 + skyTint.GetHashCode(); |
|||
hash = hash * 23 + groundColor.GetHashCode(); |
|||
hash = hash * 23 + multiplier.GetHashCode(); |
|||
hash = hash * 23 + enableSunDisk.GetHashCode(); |
|||
} |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Rendering; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
// TODO instead of hardcoing this, we need to generate the information from the existing sky currently implemented.
|
|||
public enum SkyType |
|||
{ |
|||
None, |
|||
HDRISky, |
|||
ProceduralSky |
|||
} |
|||
|
|||
[Serializable] |
|||
public sealed class SkyTypeParameter : VolumeParameter<SkyType> { } |
|||
|
|||
|
|||
[Serializable] |
|||
public sealed class VisualEnvironment : VolumeComponent |
|||
{ |
|||
public SkyTypeParameter skyType = new SkyTypeParameter { value = SkyType.ProceduralSky }; |
|||
public AtmosphericScattering.FogTypeParameter fogType = new AtmosphericScattering.FogTypeParameter { value = AtmosphericScattering.FogType.None }; |
|||
|
|||
public void PushFogShaderParameters(CommandBuffer cmd, RenderingDebugSettings renderingDebug) |
|||
{ |
|||
switch(fogType.value) |
|||
{ |
|||
case AtmosphericScattering.FogType.None: |
|||
{ |
|||
AtmosphericScattering.PushNeutralShaderParameters(cmd); |
|||
break; |
|||
} |
|||
case AtmosphericScattering.FogType.Linear: |
|||
{ |
|||
var fogSettings = VolumeManager.instance.GetComponent<LinearFog>(); |
|||
fogSettings.PushShaderParameters(cmd, renderingDebug); |
|||
break; |
|||
} |
|||
case AtmosphericScattering.FogType.Exponential: |
|||
{ |
|||
var fogSettings = VolumeManager.instance.GetComponent<ExponentialFog>(); |
|||
fogSettings.PushShaderParameters(cmd, renderingDebug); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0d7593b3a9277ac4696b20006c21dde2 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[DisallowMultipleComponent] |
|||
public class HDRISkySettings : SkySettings |
|||
{ |
|||
public Cubemap skyHDRI; |
|||
|
|||
public override SkyRenderer GetRenderer() |
|||
{ |
|||
return new HDRISkyRenderer(this); |
|||
} |
|||
|
|||
public override int GetHashCode() |
|||
{ |
|||
int hash = base.GetHashCode(); |
|||
|
|||
unchecked |
|||
{ |
|||
hash = skyHDRI != null ? hash * 23 + skyHDRI.GetHashCode() : hash; |
|||
} |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[DisallowMultipleComponent] |
|||
public class ProceduralSkySettings : SkySettings |
|||
{ |
|||
[Range(0.0f,1.0f)] |
|||
public float sunSize = 0.04f; |
|||
[Range(1.0f,10.0f)] |
|||
public float sunSizeConvergence = 5.0f; |
|||
[Range(0.0f,5.0f)] |
|||
public float atmosphereThickness = 1.0f; |
|||
public Color skyTint = new Color(0.5f, 0.5f, 0.5f, 1.0f); |
|||
public Color groundColor = new Color(0.369f, 0.349f, 0.341f, 1.0f); |
|||
public bool enableSunDisk = true; |
|||
|
|||
public override SkyRenderer GetRenderer() |
|||
{ |
|||
return new ProceduralSkyRenderer(this); |
|||
} |
|||
|
|||
public override int GetHashCode() |
|||
{ |
|||
int hash = base.GetHashCode(); |
|||
|
|||
unchecked |
|||
{ |
|||
hash = hash * 23 + sunSize.GetHashCode(); |
|||
hash = hash * 23 + sunSizeConvergence.GetHashCode(); |
|||
hash = hash * 23 + atmosphereThickness.GetHashCode(); |
|||
hash = hash * 23 + skyTint.GetHashCode(); |
|||
hash = hash * 23 + groundColor.GetHashCode(); |
|||
hash = hash * 23 + multiplier.GetHashCode(); |
|||
hash = hash * 23 + enableSunDisk.GetHashCode(); |
|||
} |
|||
|
|||
return hash; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 6b9acc7ad27501c4bbcd5d6d5a7fb218 |
|||
timeCreated: 1485096567 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SkySettingsSingleton : Singleton<SkySettingsSingleton> |
|||
{ |
|||
SkySettings m_Settings { get; set; } |
|||
|
|||
public static SkySettings overrideSettings |
|||
{ |
|||
get { return instance.m_Settings; } |
|||
set { instance.m_Settings = value; } |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue