浏览代码
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop
/Branch_Batching2
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop
/Branch_Batching2
Evgenii Golubev
8 年前
当前提交
672495ee
共有 58 个文件被更改,包括 492 次插入 和 797 次删除
-
2Assets/ScriptableRenderPipeline.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline.meta
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/HDRenderPipelineDebug.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor.meta
-
106Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineInspector.cs
-
70Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipelineMenuItems.cs
-
14Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.asset
-
91Assets/ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass.meta
-
24Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit.meta
-
18Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
48Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Editor/PostProcessingEditor.cs
-
17Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/PostProcessing.Settings.cs
-
151Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/PostProcessing.cs
-
26Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/FinalPass.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky.meta
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Editor/HDRISkyEditor.cs
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkyRenderer.cs
-
26Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkyRenderer.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkySettings.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources.meta
-
38Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyManager.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyRenderer.cs
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettings.cs
-
4Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
-
2Assets/TestScenes/HDTest/GlobalIlluminationTest/TestRealtime.cs
-
64Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs
-
44Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettings.cs.meta
-
81Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/SceneSettingsManager.cs.meta
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkySettings.cs
-
17Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettingsSingleton.cs
-
45Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/HDRenderPipeWindow.cs
-
52Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/Bloom.hlsl
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/Bloom.hlsl.meta
-
9Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/Bloom.shader.meta
-
171Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/Bloom.shader
-
15Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkyParameters.cs
-
17Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkyParametersSingleton.cs
-
20Assets/TestScenes/HDTest/CascadedShadowsTest/HDRISkyParameters_Cascaded.asset
-
9Assets/TestScenes/HDTest/CascadedShadowsTest/HDRISkyParameters_Cascaded.asset.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Editor/SceneSettingsManagementWindow.cs.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/HDRISkySettings.cs.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkySettings.cs.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/ProceduralSkySettings.cs
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettingsSingleton.cs.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettings.cs.meta
-
0/Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/SkySettings.cs
|
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SceneSettingsManagementWindow : EditorWindow |
|||
{ |
|||
[MenuItem("HDRenderPipeline/Scene Settings Management")] |
|||
static void SceneSettingsManagement() |
|||
{ |
|||
GetWindow<SceneSettingsManagementWindow>().Show(); |
|||
} |
|||
|
|||
static private string m_LastCreationPath = "Assets"; |
|||
|
|||
void CreateAsset<AssetType>(string assetName) where AssetType : ScriptableObject |
|||
{ |
|||
string assetPath = EditorUtility.SaveFilePanel("Create new Asset", m_LastCreationPath, assetName, "asset"); |
|||
if (!string.IsNullOrEmpty(assetPath)) |
|||
{ |
|||
assetPath = assetPath.Substring(assetPath.LastIndexOf("Assets")); |
|||
m_LastCreationPath = System.IO.Path.GetDirectoryName(assetPath); |
|||
var instance = CreateInstance<AssetType>(); |
|||
AssetDatabase.CreateAsset(instance, assetPath); |
|||
} |
|||
} |
|||
|
|||
void OnGUI() |
|||
{ |
|||
// Keep it there temporarily until it's back to an "engine" setting in the HDRenderPipeline asset.
|
|||
SubsurfaceScatteringSettings.overrideSettings = (SubsurfaceScatteringParameters)EditorGUILayout.ObjectField(new GUIContent("SSS Settings"), SubsurfaceScatteringSettings.overrideSettings, typeof(SubsurfaceScatteringParameters), false); |
|||
EditorGUILayout.Space(); |
|||
|
|||
if (GUILayout.Button("Create new Common Settings")) |
|||
{ |
|||
CreateAsset<CommonSettings>("NewCommonSettings"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new HDRI sky params")) |
|||
{ |
|||
CreateAsset<HDRISkySettings>("NewHDRISkySettings"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new Procedural sky params")) |
|||
{ |
|||
CreateAsset<ProceduralSkySettings>("NewProceduralSkyParameters"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new SSS params")) |
|||
{ |
|||
CreateAsset<SubsurfaceScatteringParameters>("NewSssParameters"); |
|||
} |
|||
|
|||
EditorGUILayout.Space(); |
|||
|
|||
if (GUILayout.Button("Create Scene Settings")) |
|||
{ |
|||
var manager = new GameObject(); |
|||
manager.name = "Scene Settings"; |
|||
manager.AddComponent<SceneSettings>(); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[ExecuteInEditMode] |
|||
public class SceneSettings : MonoBehaviour |
|||
{ |
|||
public CommonSettings commonSettings |
|||
{ |
|||
get { return m_CommonSettings; } |
|||
} |
|||
|
|||
public SkySettings skySettings |
|||
{ |
|||
get { return m_SkySettings; } |
|||
} |
|||
|
|||
[SerializeField] private CommonSettings m_CommonSettings; |
|||
[SerializeField] private SkySettings m_SkySettings; |
|||
|
|||
// Use this for initialization
|
|||
void OnEnable() |
|||
{ |
|||
SceneSettingsManager.instance.AddSceneSettings(this); |
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
SceneSettingsManager.instance.RemoveSceneSettings(this); |
|||
} |
|||
|
|||
void OnValidate() |
|||
{ |
|||
// If the setting is already the one currently used we need to tell the manager to reapply it.
|
|||
if(SceneSettingsManager.instance.GetCurrentSceneSetting()) |
|||
{ |
|||
SceneSettingsManager.instance.UpdateCurrentSceneSetting(); |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0e34c98127e05d340ba44a1d4a734454 |
|||
timeCreated: 1487175385 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
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 |
|||
{ |
|||
public class SceneSettingsManager |
|||
{ |
|||
static private SceneSettingsManager s_Instance = null; |
|||
static public SceneSettingsManager instance |
|||
{ |
|||
get |
|||
{ |
|||
if(s_Instance == null) |
|||
s_Instance = new SceneSettingsManager(); |
|||
|
|||
return s_Instance; |
|||
} |
|||
} |
|||
|
|||
private List<SceneSettings> m_SceneSettingsList = new List<SceneSettings>(); |
|||
|
|||
void OnEnable() |
|||
{ |
|||
|
|||
} |
|||
|
|||
void OnDisable() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public SceneSettings GetCurrentSceneSetting() |
|||
{ |
|||
if (m_SceneSettingsList.Count == 0) |
|||
return null; |
|||
else |
|||
return m_SceneSettingsList[m_SceneSettingsList.Count - 1]; |
|||
} |
|||
|
|||
// This can be needed in the editor in case the current setting is being changed. In this case we need to reapply it.
|
|||
public void UpdateCurrentSceneSetting() |
|||
{ |
|||
if (m_SceneSettingsList.Count != 0) |
|||
ApplySettings(GetCurrentSceneSetting()); |
|||
} |
|||
|
|||
public void AddSceneSettings(SceneSettings settings) |
|||
{ |
|||
m_SceneSettingsList.Add(settings); |
|||
ApplySettings(settings); |
|||
} |
|||
|
|||
public void RemoveSceneSettings(SceneSettings settings) |
|||
{ |
|||
m_SceneSettingsList.Remove(settings); |
|||
|
|||
// Always reapply the settings at the top of the list
|
|||
// (this way if the setting being removed was the active one we switch to the next one)
|
|||
ApplySettings(GetCurrentSceneSetting()); |
|||
} |
|||
|
|||
private void ApplySettings(SceneSettings settings) |
|||
{ |
|||
if(settings) |
|||
{ |
|||
if (settings.commonSettings != null) |
|||
CommonSettingsSingleton.overrideSettings = settings.commonSettings; |
|||
|
|||
if (settings.skySettings != null) |
|||
SkySettingsSingleton.overrideSettings = settings.skySettings; |
|||
} |
|||
else |
|||
{ |
|||
CommonSettingsSingleton.overrideSettings = null; |
|||
SkySettingsSingleton.overrideSettings = null; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: f31f023dee834de44993536e71ee27ac |
|||
timeCreated: 1487241314 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
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); |
|||
} |
|||
} |
|||
} |
|
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SkySettingsSingleton : Singleton<SkySettingsSingleton> |
|||
{ |
|||
private SkySettings settings { get; set; } |
|||
|
|||
public static SkySettings overrideSettings |
|||
{ |
|||
get { return instance.settings; } |
|||
set { instance.settings = value; } |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine.Experimental.Rendering.HDPipeline; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class HDRenderPipeWindow : EditorWindow |
|||
{ |
|||
[MenuItem("HDRenderPipeline/Configure Overrides")] |
|||
static void ConfigureOverrides() |
|||
{ |
|||
GetWindow<HDRenderPipeWindow>().Show(); |
|||
} |
|||
|
|||
void OnGUI() |
|||
{ |
|||
CommonSettingsSingleton.overrideSettings = (CommonSettings)EditorGUILayout.ObjectField(new GUIContent("Common Settings"), CommonSettingsSingleton.overrideSettings, typeof(CommonSettings), false); |
|||
SkyParametersSingleton.overrideSettings = (SkyParameters)EditorGUILayout.ObjectField(new GUIContent("Sky Settings"), SkyParametersSingleton.overrideSettings, typeof(SkyParameters), false); |
|||
SubsurfaceScatteringSettings.overrideSettings = (SubsurfaceScatteringParameters)EditorGUILayout.ObjectField(new GUIContent("Subsurface Scattering Settings"), SubsurfaceScatteringSettings.overrideSettings, typeof(SubsurfaceScatteringParameters), false); |
|||
|
|||
if (GUILayout.Button("Create new common settings")) |
|||
{ |
|||
var instance = CreateInstance<CommonSettings>(); |
|||
AssetDatabase.CreateAsset(instance, "Assets/NewCommonSettings.asset"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new HDRI sky params")) |
|||
{ |
|||
var instance = CreateInstance<HDRISkyParameters>(); |
|||
AssetDatabase.CreateAsset(instance, "Assets/NewHDRISkyParameters.asset"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new Procedural sky params")) |
|||
{ |
|||
var instance = CreateInstance<ProceduralSkyParameters>(); |
|||
AssetDatabase.CreateAsset(instance, "Assets/NewProceduralSkyParameters.asset"); |
|||
} |
|||
|
|||
if (GUILayout.Button("Create new SSS params")) |
|||
{ |
|||
var instance = CreateInstance<SubsurfaceScatteringParameters>(); |
|||
AssetDatabase.CreateAsset(instance, "Assets/NewSssParameters.asset"); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
#ifndef UNITY_BLOOM |
|||
#define UNITY_BLOOM |
|||
|
|||
// Downsample with a 4x4 box filter |
|||
float3 DownsampleFilter(TEXTURE2D_ARGS(tex, texSampler), float2 uv, float2 texelSize) |
|||
{ |
|||
float4 d = texelSize.xyxy * float4(-1.0, -1.0, 1.0, 1.0); |
|||
|
|||
float3 s; |
|||
s = SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xw).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zw).rgb; |
|||
|
|||
return s * (1.0 / 4.0); |
|||
} |
|||
|
|||
float3 UpsampleFilter(TEXTURE2D_ARGS(tex, texSampler), float2 uv, float2 texelSize, float sampleScale) |
|||
{ |
|||
#if 0 |
|||
// 4-tap bilinear upsampler |
|||
float4 d = texelSize.xyxy * float4(-1.0, -1.0, 1.0, 1.0) * (sampleScale * 0.5); |
|||
|
|||
float3 s; |
|||
s = SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xw).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zw).rgb; |
|||
|
|||
return s * (1.0 / 4.0); |
|||
#else |
|||
// 9-tap bilinear upsampler (tent filter) |
|||
float4 d = texelSize.xyxy * float4(1.0, 1.0, -1.0, 0.0) * sampleScale; |
|||
|
|||
float3 s; |
|||
s = SAMPLE_TEXTURE2D(tex, texSampler, uv - d.xy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv - d.wy).rgb * 2.0; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv - d.zy).rgb; |
|||
|
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zw).rgb * 2.0; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv).rgb * 4.0; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xw).rgb * 2.0; |
|||
|
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.zy).rgb; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.wy).rgb * 2.0; |
|||
s += SAMPLE_TEXTURE2D(tex, texSampler, uv + d.xy).rgb; |
|||
|
|||
return s * (1.0 / 16.0); |
|||
#endif |
|||
} |
|||
|
|||
#endif // UNITY_BLOOM |
|
|||
fileFormatVersion: 2 |
|||
guid: 41784642d71cc4a46acbaa1c81d71109 |
|||
timeCreated: 1486047545 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0e58ecfc4bcd918478485f7b80aae431 |
|||
timeCreated: 1486047504 |
|||
licenseType: Pro |
|||
ShaderImporter: |
|||
defaultTextures: [] |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
Shader "Hidden/HDRenderPipeline/Bloom" |
|||
{ |
|||
Properties |
|||
{ |
|||
_MainTex ("", 2D) = "" {} |
|||
_BaseTex ("", 2D) = "" {} |
|||
_AutoExposure ("", 2D) = "" {} |
|||
} |
|||
|
|||
HLSLINCLUDE |
|||
|
|||
#pragma target 4.5 |
|||
#include "ShaderLibrary/Common.hlsl" |
|||
#include "HDRenderPipeline/ShaderVariables.hlsl" |
|||
#include "Bloom.hlsl" |
|||
|
|||
TEXTURE2D(_MainTex); |
|||
SAMPLER2D(sampler_MainTex); |
|||
float4 _MainTex_TexelSize; |
|||
|
|||
TEXTURE2D(_BaseTex); |
|||
SAMPLER2D(sampler_BaseTex); |
|||
float4 _BaseTex_TexelSize; |
|||
|
|||
TEXTURE2D(_AutoExposure); |
|||
SAMPLER2D(sampler_AutoExposure); |
|||
|
|||
float _Threshold; |
|||
float3 _Curve; |
|||
float _SampleScale; |
|||
|
|||
struct Attributes |
|||
{ |
|||
float3 vertex : POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
struct Varyings |
|||
{ |
|||
float4 vertex : SV_POSITION; |
|||
float2 texcoord : TEXCOORD0; |
|||
}; |
|||
|
|||
struct VaryingsMultitex |
|||
{ |
|||
float4 vertex : SV_POSITION; |
|||
float2 texcoordMain : TEXCOORD0; |
|||
float2 texcoordBase : TEXCOORD1; |
|||
}; |
|||
|
|||
Varyings Vert(Attributes input) |
|||
{ |
|||
Varyings output; |
|||
output.vertex = TransformWorldToHClip(input.vertex); |
|||
output.texcoord = input.texcoord.xy; |
|||
return output; |
|||
} |
|||
|
|||
VaryingsMultitex VertMultitex(Attributes input) |
|||
{ |
|||
VaryingsMultitex o; |
|||
o.vertex = TransformWorldToHClip(input.vertex); |
|||
o.texcoordMain = input.texcoord.xy; |
|||
o.texcoordBase = o.texcoordMain; |
|||
|
|||
#if UNITY_UV_STARTS_AT_TOP |
|||
if (_BaseTex_TexelSize.y < 0.0) |
|||
o.texcoordMain.y = 1.0 - o.texcoordMain.y; |
|||
#endif |
|||
|
|||
return o; |
|||
} |
|||
|
|||
float4 FetchAutoExposed(TEXTURE2D_ARGS(tex, texSampler), float2 uv) |
|||
{ |
|||
float autoExposure = 1.0; |
|||
|
|||
#if EYE_ADAPTATION |
|||
autoExposure = SAMPLE_TEXTURE2D(_AutoExposure, sampler_AutoExposure, uv).r; |
|||
#endif |
|||
|
|||
return SAMPLE_TEXTURE2D(tex, texSampler, uv) * autoExposure; |
|||
} |
|||
|
|||
float4 FragPrefilter(Varyings i) : SV_Target |
|||
{ |
|||
float2 uv = i.texcoord; |
|||
|
|||
float4 s0 = min(65504.0, FetchAutoExposed(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), uv)); |
|||
float3 m = s0.rgb; |
|||
|
|||
// Pixel brightness |
|||
float br = max(m.r, max(m.g, m.r)); |
|||
|
|||
// Under-threshold part: quadratic curve |
|||
float rq = clamp(br - _Curve.x, 0.0, _Curve.y); |
|||
rq = _Curve.z * rq * rq; |
|||
|
|||
// Combine and apply the brightness response curve. |
|||
m *= max(rq, br - _Threshold) / max(br, 1e-5); |
|||
|
|||
return float4(m, 0.0); |
|||
} |
|||
|
|||
float4 FragDownsample1(Varyings i) : SV_Target |
|||
{ |
|||
return float4(DownsampleFilter(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoord, _MainTex_TexelSize.xy), 0.0); |
|||
} |
|||
|
|||
float4 FragDownsample2(Varyings i) : SV_Target |
|||
{ |
|||
return float4(DownsampleFilter(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoord, _MainTex_TexelSize.xy), 0.0); |
|||
} |
|||
|
|||
float4 FragUpsample(VaryingsMultitex i) : SV_Target |
|||
{ |
|||
float3 base = SAMPLE_TEXTURE2D(_BaseTex, sampler_BaseTex, i.texcoordBase).rgb; |
|||
float3 blur = UpsampleFilter(TEXTURE2D_PARAM(_MainTex, sampler_MainTex), i.texcoordMain, _MainTex_TexelSize.xy, _SampleScale); |
|||
return float4(base + blur, 0.0); |
|||
} |
|||
|
|||
ENDHLSL |
|||
|
|||
SubShader |
|||
{ |
|||
Cull Off ZWrite Off ZTest Always |
|||
|
|||
Pass |
|||
{ |
|||
HLSLPROGRAM |
|||
|
|||
#pragma multi_compile __ EYE_ADAPTATION |
|||
#pragma vertex Vert |
|||
#pragma fragment FragPrefilter |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
HLSLPROGRAM |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment FragDownsample1 |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
HLSLPROGRAM |
|||
|
|||
#pragma vertex Vert |
|||
#pragma fragment FragDownsample2 |
|||
|
|||
ENDHLSL |
|||
} |
|||
|
|||
Pass |
|||
{ |
|||
HLSLPROGRAM |
|||
|
|||
#pragma vertex VertMultitex |
|||
#pragma fragment FragUpsample |
|||
|
|||
ENDHLSL |
|||
} |
|||
} |
|||
|
|||
Fallback Off |
|||
} |
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
[DisallowMultipleComponent] |
|||
public class HDRISkyParameters |
|||
: SkyParameters |
|||
{ |
|||
public Cubemap skyHDRI; |
|||
|
|||
|
|||
public override SkyRenderer GetRenderer() |
|||
{ |
|||
return new HDRISkyRenderer(this); |
|||
} |
|||
} |
|||
} |
|
|||
#if UNITY_EDITOR
|
|||
using UnityEditor; |
|||
#endif
|
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SkyParametersSingleton : Singleton<SkyParametersSingleton> |
|||
{ |
|||
private SkyParameters settings { get; set; } |
|||
|
|||
public static SkyParameters overrideSettings |
|||
{ |
|||
get { return instance.settings; } |
|||
set { instance.settings = value; } |
|||
} |
|||
} |
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_PrefabParentObject: {fileID: 0} |
|||
m_PrefabInternal: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} |
|||
m_Name: HDRISkyParameters_Cascaded |
|||
m_EditorClassIdentifier: |
|||
rotation: 0 |
|||
exposure: 0 |
|||
multiplier: 1 |
|||
resolution: 256 |
|||
updateMode: 0 |
|||
updatePeriod: 0 |
|||
skyHDRI: {fileID: 8900000, guid: 9b513842339ef704ca63ef696691bc34, type: 3} |
|
|||
fileFormatVersion: 2 |
|||
guid: e87251404948e274ab006302af9b80f8 |
|||
timeCreated: 1486126252 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue