From d443e61deb3cc370ba6eb31ad9e89949b5d3e7f2 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 26 Mar 2020 12:30:15 +0100 Subject: [PATCH 01/44] Added uv distorsion for HDRISky cubemap --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 17 ++++++- .../RenderPipeline/HDStringConstants.cs | 3 ++ .../Runtime/Sky/HDRISky/HDRISky.cs | 18 ++++++++ .../Runtime/Sky/HDRISky/HDRISky.shader | 39 ++++++++++++++++ .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 46 +++++++++++-------- 5 files changed, 104 insertions(+), 19 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index 92e452cebe9..e8b5829469b 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -13,6 +13,9 @@ class HDRISkyEditor SerializedDataParameter m_hdriSky; SerializedDataParameter m_UpperHemisphereLuxValue; SerializedDataParameter m_UpperHemisphereLuxColor; + SerializedDataParameter m_flowmap; + SerializedDataParameter m_flowSpeed; + SerializedDataParameter m_flowStrength; SerializedDataParameter m_EnableBackplate; SerializedDataParameter m_BackplateType; SerializedDataParameter m_GroundLevel; @@ -46,6 +49,10 @@ public override void OnEnable() m_UpperHemisphereLuxValue = Unpack(o.Find(x => x.upperHemisphereLuxValue)); m_UpperHemisphereLuxColor = Unpack(o.Find(x => x.upperHemisphereLuxColor)); + m_flowmap = Unpack(o.Find(x => x.flowmap)); + m_flowSpeed = Unpack(o.Find(x => x.flowSpeed)); + m_flowStrength = Unpack(o.Find(x => x.flowStrength)); + m_EnableBackplate = Unpack(o.Find(x => x.enableBackplate)); m_BackplateType = Unpack(o.Find(x => x.backplateType)); m_GroundLevel = Unpack(o.Find(x => x.groundLevel)); @@ -108,7 +115,6 @@ public override void OnInspectorGUI() EditorGUI.BeginChangeCheck(); { PropertyField(m_hdriSky); - base.CommonSkySettingsGUI(); } bool updateDefaultShadowTint = false; if (EditorGUI.EndChangeCheck()) @@ -117,6 +123,15 @@ public override void OnInspectorGUI() updateDefaultShadowTint = true; } + PropertyField(m_flowmap); + { + EditorGUI.indentLevel++; + PropertyField(m_flowSpeed); + PropertyField(m_flowStrength); + EditorGUI.indentLevel--; + } + base.CommonSkySettingsGUI(); + if (isInAdvancedMode) { PropertyField(m_EnableBackplate, new GUIContent("Backplate", "Enable the projection of the bottom of the CubeMap on a plane with a given shape ('Disc', 'Rectangle', 'Ellispe', 'Infinite')")); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index 71f1ed110e8..992f955d914 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -468,6 +468,9 @@ static class HDShaderIDs public static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap"); public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap"); + public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); + public static readonly int _FlowSpeed = Shader.PropertyToID("_FlowSpeed"); + public static readonly int _FlowStrength = Shader.PropertyToID("_FlowStrength"); public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP"); public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam"); public static readonly int _BackplateParameters0 = Shader.PropertyToID("_BackplateParameters0"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 6c597ae1872..c38caaf0f61 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -13,6 +13,15 @@ public class HDRISky : SkySettings /// Cubemap used to render the HDRI sky. [Tooltip("Specify the cubemap HDRP uses to render the sky.")] public CubemapParameter hdriSky = new CubemapParameter(null); + /// Cubemap used to distort the uv for the HDRI sky. + [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] + public CubemapParameter flowmap = new CubemapParameter(null); + /// Cubemap used to distort the uv for the HDRI sky. + [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] + public FloatParameter flowSpeed = new FloatParameter(1.0f); + /// Cubemap used to distort the uv for the HDRI sky. + [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] + public FloatParameter flowStrength = new FloatParameter(1.0f); /// Enable Backplate to have it visible. [Tooltip("Enable or disable the backplate.")] public BoolParameter enableBackplate = new BoolParameter(false); @@ -65,6 +74,9 @@ public override int GetHashCode() { #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; + hash = hash * 23 + flowSpeed.value.GetHashCode(); + hash = hash * 23 + flowStrength.value.GetHashCode(); hash = hash * 23 + enableBackplate.value.GetHashCode(); hash = hash * 23 + backplateType.value.GetHashCode(); hash = hash * 23 + groundLevel.value.GetHashCode(); @@ -80,6 +92,9 @@ public override int GetHashCode() hash = hash * 23 + rectLightShadow.value.GetHashCode(); hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; + hash = hash * 23 + flowSpeed.overrideState.GetHashCode(); + hash = hash * 23 + flowStrength.overrideState.GetHashCode(); hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); hash = hash * 23 + backplateType.overrideState.GetHashCode(); hash = hash * 23 + groundLevel.overrideState.GetHashCode(); @@ -95,6 +110,9 @@ public override int GetHashCode() hash = hash * 23 + rectLightShadow.overrideState.GetHashCode(); #else hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; + hash = hash * 23 + flowSpeed.GetHashCode(); + hash = hash * 23 + flowStrength.GetHashCode(); hash = hash * 23 + enableBackplate.GetHashCode(); hash = hash * 23 + backplateType.GetHashCode(); hash = hash * 23 + groundLevel.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 71d91824264..b5ad5efb2b8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -10,6 +10,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER + #pragma shader_feature_local USE_FLOWMAP + #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH @@ -46,12 +48,17 @@ Shader "Hidden/HDRP/Sky/HDRISky" TEXTURECUBE(_Cubemap); SAMPLER(sampler_Cubemap); + + TEXTURECUBE(_Flowmap); + SAMPLER(sampler_Flowmap); float4 _SkyParam; // x exposure, y multiplier, zw rotation (cosPhi and sinPhi) float4 _BackplateParameters0; // xy: scale, z: groundLevel, w: projectionDistance float4 _BackplateParameters1; // x: BackplateType, y: BlendAmount, zw: backplate rotation (cosPhi_plate, sinPhi_plate) float4 _BackplateParameters2; // xy: BackplateTextureRotation (cos/sin), zw: Backplate Texture Offset float3 _BackplateShadowTint; // xyz: ShadowTint + float _FlowSpeed; + float _FlowStrength; uint _BackplateShadowFilter; #define _Intensity _SkyParam.x @@ -173,7 +180,39 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 GetSkyColor(float3 dir) { +#ifdef USE_FLOWMAP + // Find cube normal at sample point + float3 absdir = abs(dir); + float absmax = max(max(absdir.x, absdir.y), absdir.z); + float3 normal = float3( + (absmax == absdir.x) * sign(dir.x), + (absmax == absdir.y) * sign(dir.y), + (absmax == absdir.z) * sign(dir.z) + ); + + // Compute distortion directions on the cube + float3 tangent = (absmax == absdir.y) ? float3(0.0, 0.0, 1.0) : float3(0.0, 1.0, 0.0); + float3 bitangent = cross(normal, tangent); + + // Compute flow factor + float2 flow = SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; + float time = _Time.y * _FlowSpeed; + float2 alpha = frac(float2(time, time + 0.5)) - 0.5; + float2 uv1 = alpha.x * flow; + float2 uv2 = alpha.y * flow; + + // Sample twice + float3 dir1 = dir + uv1.x * tangent + uv1.y * bitangent; + float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir1, 0).rgb; + + float3 dir2 = dir + uv2.x * tangent + uv2.y * bitangent; + float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir2, 0).rgb; + + // Blend color samples + return lerp(color1, color2, abs(2.0 * alpha.x)); +#else return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; +#endif } float4 GetColorWithRotation(float3 dir, float exposure, float2 cos_sin) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index e0a24492356..8c43621a60b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -129,24 +129,34 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo passID = m_RenderFullscreenSkyWithBackplateID; } - m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); - m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); - m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters0, GetBackplateParameters0(hdriSky)); - m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters1, GetBackplateParameters1(backplatePhi, hdriSky)); - m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters2, GetBackplateParameters2(hdriSky)); - m_SkyHDRIMaterial.SetColor(HDShaderIDs._BackplateShadowTint, hdriSky.shadowTint.value); - uint shadowFilter = 0u; - if (hdriSky.pointLightShadow.value) - shadowFilter |= unchecked((uint)LightFeatureFlags.Punctual); - if (hdriSky.dirLightShadow.value) - shadowFilter |= unchecked((uint)LightFeatureFlags.Directional); - if (hdriSky.rectLightShadow.value) - shadowFilter |= unchecked((uint)LightFeatureFlags.Area); - m_SkyHDRIMaterial.SetInt(HDShaderIDs._BackplateShadowFilter, unchecked((int)shadowFilter)); - - // This matrix needs to be updated at the draw call frequency. - m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); - CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, passID); + if (hdriSky.flowmap.overrideState) + { + m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); + m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); + m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, hdriSky.flowSpeed.value); + m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowStrength, hdriSky.flowStrength.value); } + else + m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); + + m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); + m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); + m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters0, GetBackplateParameters0(hdriSky)); + m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters1, GetBackplateParameters1(backplatePhi, hdriSky)); + m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters2, GetBackplateParameters2(hdriSky)); + m_SkyHDRIMaterial.SetColor(HDShaderIDs._BackplateShadowTint, hdriSky.shadowTint.value); + uint shadowFilter = 0u; + if (hdriSky.pointLightShadow.value) + shadowFilter |= unchecked((uint)LightFeatureFlags.Punctual); + if (hdriSky.dirLightShadow.value) + shadowFilter |= unchecked((uint)LightFeatureFlags.Directional); + if (hdriSky.rectLightShadow.value) + shadowFilter |= unchecked((uint)LightFeatureFlags.Area); + m_SkyHDRIMaterial.SetInt(HDShaderIDs._BackplateShadowFilter, unchecked((int)shadowFilter)); + + // This matrix needs to be updated at the draw call frequency. + m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); + CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, passID); } } +} From a1a8f2ca53c4ea2b4deb8dbe1936977014fd9da9 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 26 Mar 2020 16:36:46 +0100 Subject: [PATCH 02/44] Editable flow strength --- .../Runtime/Sky/HDRISky/HDRISky.shader | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index b5ad5efb2b8..7cb7d085caf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -184,11 +184,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" // Find cube normal at sample point float3 absdir = abs(dir); float absmax = max(max(absdir.x, absdir.y), absdir.z); - float3 normal = float3( - (absmax == absdir.x) * sign(dir.x), - (absmax == absdir.y) * sign(dir.y), - (absmax == absdir.z) * sign(dir.z) - ); + float3 normal = (absmax == absdir) * sign(dir); // Compute distortion directions on the cube float3 tangent = (absmax == absdir.y) ? float3(0.0, 0.0, 1.0) : float3(0.0, 1.0, 0.0); @@ -198,8 +194,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" float2 flow = SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; float time = _Time.y * _FlowSpeed; float2 alpha = frac(float2(time, time + 0.5)) - 0.5; - float2 uv1 = alpha.x * flow; - float2 uv2 = alpha.y * flow; + float2 uv1 = alpha.x * _FlowStrength * flow; + float2 uv2 = alpha.y * _FlowStrength * flow; // Sample twice float3 dir1 = dir + uv1.x * tangent + uv1.y * bitangent; From 8841be0317b2718e182d15f51739733d7305f27c Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Fri, 27 Mar 2020 10:39:28 +0100 Subject: [PATCH 03/44] Better parameter name. Smooth flow on cube edges --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 6 +++--- .../Runtime/Sky/HDRISky/HDRISky.cs | 20 +++++++++---------- .../Runtime/Sky/HDRISky/HDRISky.shader | 9 ++------- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 2 +- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index e8b5829469b..87d7ec94bd1 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -14,7 +14,7 @@ class HDRISkyEditor SerializedDataParameter m_UpperHemisphereLuxValue; SerializedDataParameter m_UpperHemisphereLuxColor; SerializedDataParameter m_flowmap; - SerializedDataParameter m_flowSpeed; + SerializedDataParameter m_flowCycle; SerializedDataParameter m_flowStrength; SerializedDataParameter m_EnableBackplate; SerializedDataParameter m_BackplateType; @@ -50,7 +50,7 @@ public override void OnEnable() m_UpperHemisphereLuxColor = Unpack(o.Find(x => x.upperHemisphereLuxColor)); m_flowmap = Unpack(o.Find(x => x.flowmap)); - m_flowSpeed = Unpack(o.Find(x => x.flowSpeed)); + m_flowCycle = Unpack(o.Find(x => x.flowCycle)); m_flowStrength = Unpack(o.Find(x => x.flowStrength)); m_EnableBackplate = Unpack(o.Find(x => x.enableBackplate)); @@ -126,7 +126,7 @@ public override void OnInspectorGUI() PropertyField(m_flowmap); { EditorGUI.indentLevel++; - PropertyField(m_flowSpeed); + PropertyField(m_flowCycle); PropertyField(m_flowStrength); EditorGUI.indentLevel--; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index c38caaf0f61..9b27c6167ce 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -14,14 +14,14 @@ public class HDRISky : SkySettings [Tooltip("Specify the cubemap HDRP uses to render the sky.")] public CubemapParameter hdriSky = new CubemapParameter(null); /// Cubemap used to distort the uv for the HDRI sky. - [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] + [Tooltip("Specify the cubemap HDRP uses to distort sky uvs.")] public CubemapParameter flowmap = new CubemapParameter(null); - /// Cubemap used to distort the uv for the HDRI sky. - [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] - public FloatParameter flowSpeed = new FloatParameter(1.0f); - /// Cubemap used to distort the uv for the HDRI sky. - [Tooltip("Specify the cubemap HDRP uses to distort uvs.")] - public FloatParameter flowStrength = new FloatParameter(1.0f); + /// Time to do a full loop. + [Tooltip("Specify the loop time for uv distortion.")] + public FloatParameter flowCycle = new FloatParameter(1.0f); + /// Multiplier for HDRI sky uv distortion. + [Tooltip("Specify the factor by which HDRP multiplies flow value.")] + public FloatParameter flowStrength = new FloatParameter(1.0f); /// Enable Backplate to have it visible. [Tooltip("Enable or disable the backplate.")] public BoolParameter enableBackplate = new BoolParameter(false); @@ -75,7 +75,7 @@ public override int GetHashCode() #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; - hash = hash * 23 + flowSpeed.value.GetHashCode(); + hash = hash * 23 + flowCycle.value.GetHashCode(); hash = hash * 23 + flowStrength.value.GetHashCode(); hash = hash * 23 + enableBackplate.value.GetHashCode(); hash = hash * 23 + backplateType.value.GetHashCode(); @@ -93,7 +93,7 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; - hash = hash * 23 + flowSpeed.overrideState.GetHashCode(); + hash = hash * 23 + flowCycle.overrideState.GetHashCode(); hash = hash * 23 + flowStrength.overrideState.GetHashCode(); hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); hash = hash * 23 + backplateType.overrideState.GetHashCode(); @@ -111,7 +111,7 @@ public override int GetHashCode() #else hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; - hash = hash * 23 + flowSpeed.GetHashCode(); + hash = hash * 23 + flowCycle.GetHashCode(); hash = hash * 23 + flowStrength.GetHashCode(); hash = hash * 23 + enableBackplate.GetHashCode(); hash = hash * 23 + backplateType.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 7cb7d085caf..a4e921ea3ca 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -181,14 +181,9 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 GetSkyColor(float3 dir) { #ifdef USE_FLOWMAP - // Find cube normal at sample point - float3 absdir = abs(dir); - float absmax = max(max(absdir.x, absdir.y), absdir.z); - float3 normal = (absmax == absdir) * sign(dir); - // Compute distortion directions on the cube - float3 tangent = (absmax == absdir.y) ? float3(0.0, 0.0, 1.0) : float3(0.0, 1.0, 0.0); - float3 bitangent = cross(normal, tangent); + float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); + float3 bitangent = cross(dir, tangent); // Compute flow factor float2 flow = SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 8c43621a60b..093cc13ecca 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -133,7 +133,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo { m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); - m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, hdriSky.flowSpeed.value); + m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, 0.5f / hdriSky.flowCycle.value); m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowStrength, hdriSky.flowStrength.value); } else From 0735c12c476880ae766ae47cf56131a7b69813b6 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 30 Mar 2020 12:45:20 +0200 Subject: [PATCH 04/44] Added a graphic test. Updated Changelog --- .../5x_SkyAndFog/5009_HDRI_Sky_Flow.meta | 8 + .../5x_SkyAndFog/5009_HDRI_Sky_Flow.unity | 314 ++++++++++++++++++ .../5009_HDRI_Sky_Flow.unity.meta | 7 + .../Scene Settings Profile.asset | 263 +++++++++++++++ .../Scene Settings Profile.asset.meta | 8 + .../5009_HDRI_Sky_Flow/kirby_flow.png | 3 + .../5009_HDRI_Sky_Flow/kirby_flow.png.meta | 106 ++++++ .../CHANGELOG.md | 1 + 8 files changed, 710 insertions(+) create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.meta new file mode 100644 index 00000000000..0d10d914fcb --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 12b4ffaa2f56ee74889590fbaef4208e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity new file mode 100644 index 00000000000..be066be277f --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity @@ -0,0 +1,314 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 1149913020} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &840375756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 840375759} + - component: {fileID: 840375758} + m_Layer: 0 + m_Name: Scene Settings + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &840375758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 840375756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: fa883fad47da47c4a84f7eb07a1c22a2, type: 2} +--- !u!4 &840375759 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 840375756} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!850595691 &1149913020 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 2 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRRussianRouletteStartBounce: 2 + m_PVREnvironmentMIS: 1 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 +--- !u!1001 &1428852875 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_Name + value: HDRP_Test_Camera + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -8.21 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -125.97 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.y + value: -0.8886021 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.w + value: 0.45305854 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.x + value: -0.032515403 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.z + value: -0.06377378 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: field of view + value: 38.4 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: clearColorMode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_Version + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 + value: 70005818916701 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: ImageComparisonSettings.TargetHeight + value: 640 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: renderPipelineAsset + value: + objectReference: {fileID: 11400000, guid: ea1589d4340c02946897a7c2f9ade2f0, + type: 2} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity.meta new file mode 100644 index 00000000000..d52eb31c5ef --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f2fd7a28087b7634e94c49cb78704e74 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset new file mode 100644 index 00000000000..d5e0702f5e3 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset @@ -0,0 +1,263 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: Scene Settings Profile + m_EditorClassIdentifier: + components: + - {fileID: 4399605326884683900} + - {fileID: 2465355488662737187} +--- !u!114 &2465355488662737187 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} + m_Name: HDRISky + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 1 + m_Value: -1.3 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 2.422326 + min: 0 + upperHemisphereLuxColor: + m_OverrideState: 0 + m_Value: {x: 0.3747885, y: 0.42397934, z: 0.5} + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + hdriSky: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 5fb993a599e7e9b4b825e1a28e6d2c07, type: 3} + flowmap: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 6ec129c61e856c8418af7e35f6f557d0, type: 3} + flowCycle: + m_OverrideState: 0 + m_Value: 1 + flowStrength: + m_OverrideState: 1 + m_Value: 0.2 + enableBackplate: + m_OverrideState: 0 + m_Value: 0 + backplateType: + m_OverrideState: 0 + m_Value: 0 + groundLevel: + m_OverrideState: 0 + m_Value: 0 + scale: + m_OverrideState: 0 + m_Value: {x: 32, y: 32} + projectionDistance: + m_OverrideState: 0 + m_Value: 16 + min: 0.0000001 + plateRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexOffset: + m_OverrideState: 0 + m_Value: {x: 0, y: 0} + blendAmount: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 100 + shadowTint: + m_OverrideState: 0 + m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + pointLightShadow: + m_OverrideState: 0 + m_Value: 0 + dirLightShadow: + m_OverrideState: 0 + m_Value: 0 + rectLightShadow: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &4399605326884683900 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d7593b3a9277ac4696b20006c21dde2, type: 3} + m_Name: + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + skyType: + m_OverrideState: 1 + m_Value: 1 + skyAmbientMode: + m_OverrideState: 0 + m_Value: 0 + fogType: + m_OverrideState: 1 + m_Value: 0 +--- !u!114 &4845244889253265832 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6d31fa107c795994496a3089be99149a, type: 3} + m_Name: PhysicallyBasedSkySettings + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 0 + m_Value: 0 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 1 + min: 0 + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + planetaryRadius: + m_OverrideState: 0 + m_Value: 6378.759 + min: 0 + planetCenterPosition: + m_OverrideState: 0 + m_Value: {x: 0, y: -6378.759, z: 0} + airAttenuationDistance: + m_OverrideState: 0 + m_Value: {r: 0.17241378, g: 0.074074075, b: 0.030211482, a: 1} + hdr: 1 + showAlpha: 0 + showEyeDropper: 0 + airAlbedo: + m_OverrideState: 0 + m_Value: {r: 0.9, g: 0.9, b: 1, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 0 + airMaxAltitude: + m_OverrideState: 0 + m_Value: 58.3 + min: 0 + aerosolAttenuationDistance: + m_OverrideState: 0 + m_Value: 0.5 + min: 0 + aerosolAlbedo: + m_OverrideState: 0 + m_Value: 0.9 + min: 0 + max: 1 + aerosolMaxAltitude: + m_OverrideState: 0 + m_Value: 8.3 + min: 0 + aerosolAnisotropy: + m_OverrideState: 0 + m_Value: 0 + min: -1 + max: 1 + numBounces: + m_OverrideState: 0 + m_Value: 8 + min: 1 + max: 10 + groundColor: + m_OverrideState: 1 + m_Value: {r: 0.17254902, g: 0.227451, b: 0.3137255, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 0 + groundAlbedoTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 703a4570dfe8b8e41aff24d2320bd405, type: 3} + groundEmissionTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: ec98521838f4e7f4a839280309cb08ab, type: 3} + planetRotation: + m_OverrideState: 1 + m_Value: {x: 180, y: -50, z: 170} + spaceEmissionTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: b0c5cbf24c773cd449436a2060083b10, type: 3} + spaceRotation: + m_OverrideState: 1 + m_Value: {x: 15, y: 30, z: 45} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset.meta new file mode 100644 index 00000000000..6e2d8a53345 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fa883fad47da47c4a84f7eb07a1c22a2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png new file mode 100644 index 00000000000..abc36ebed55 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a02cb766ccc271813c210ca621cc42014c28876182e5e31c81de69e99f978f3 +size 285835 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta new file mode 100644 index 00000000000..e7ae147067b --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta @@ -0,0 +1,106 @@ +fileFormatVersion: 2 +guid: 6ec129c61e856c8418af7e35f6f557d0 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 0 + 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 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 1 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + 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: 0 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 2 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index a8f184c368b..bbdc910d6ac 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -92,6 +92,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added API to enable proper recording of path traced scenes (with the Unity recorder or other tools). - Added support for fog in Recursive rendering, ray traced reflections and ray traced indirect diffuse. - Added an alpha blend option for recursive rendering +- Added a flow map parameter to HDRI Sky ### Fixed - Fix when rescale probe all direction below zero (1219246) From 5d7870d0c26bb877254a6be872680c165e50bf84 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 30 Mar 2020 14:25:17 +0200 Subject: [PATCH 05/44] Updated documentation --- .../Direct3D11/None/5009_HDRI_Sky_Flow.png | 3 + .../None/5009_HDRI_Sky_Flow.png.meta | 94 +++++++++++++++++++ .../ProjectSettings/EditorBuildSettings.asset | 3 + .../Documentation~/Override-HDRI-Sky.md | 3 + 4 files changed, 103 insertions(+) create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png new file mode 100644 index 00000000000..e318c40244b --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0a0ac479e74a330c06a253c6687881f0169c7cc8f377111b2af2d9f6b2af7ce +size 120487 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta new file mode 100644 index 00000000000..b1703d38fc7 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: d34605053b58d0f49a57b95db95c613e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset index b4b128cb7c7..458d9943bec 100644 --- a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset @@ -455,6 +455,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/GraphicTests/Scenes/5x_SkyAndFog/5008_FogFiltering.unity guid: f5cb4917223ead34abb31c1dc1013fb2 + - enabled: 1 + path: Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity + guid: f2fd7a28087b7634e94c49cb78704e74 - enabled: 1 path: Assets/GraphicTests/Scenes/8x_ShaderGraph/8101_Opaque.unity guid: 3f9e911b4dbc9464e85add595c37cb89 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md index 04fd3300767..42d8cdcd114 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md @@ -22,6 +22,9 @@ After you add an **HDRI Sky** override, you must set the Volume to use **HDRI Sk | Property | Description | | -------------------------------- | ------------------------------------------------------------ | | **HDRI Sky** | Assign a HDRI Texture that HDRP uses to render the sky. | +| **Flowmap** | Assign a flowmap that HDRP uses to distort uvs when rendering the sky. | +| - **Flow Cycle** | Set the period (in seconds) of the animation loop cycle. | +| - **Flow Strength** | Set the multiplier HDRP applies to values from the flowmap. | | **Intensity Mode** | Use the drop-down to select the method that HDRP uses to calculate the sky intensity.
• **Exposure**: HDRP calculates intensity from an exposure value in EV100.
• **Multiplier**: HDRP calculates intensity from a flat multiplier.
• **Lux**: HDRP calculates intensity in terms of a target Lux value. | | - **Exposure** | Set the amount of light per unit area that HDRP applies to the HDRI Sky cubemap.
This property only appears when you select **Exposure** from the **Intensity Mode** drop-down. | | - **Multiplier** | Set the multiplier for HDRP to apply to the Scene as environmental light. HDRP multiplies the environment light in your Scene by this value.
This property only appears when you select **Multiplier** from the **Intensity Mode** drop-down. | From 4bea91efbd21ff2d4e9b460b2811b722df70b40f Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 30 Mar 2020 17:33:34 +0200 Subject: [PATCH 06/44] Added screenshots --- .../Metal/None/5009_HDRI_Sky_Flow.png | 3 + .../Metal/None/5009_HDRI_Sky_Flow.png.meta | 94 +++++++++++++++++++ .../Direct3D11/None/5009_HDRI_Sky_Flow.png | 3 + .../None/5009_HDRI_Sky_Flow.png.meta | 94 +++++++++++++++++++ .../Vulkan/None/5009_HDRI_Sky_Flow.png | 3 + .../Vulkan/None/5009_HDRI_Sky_Flow.png.meta | 94 +++++++++++++++++++ .../Direct3D11/None/5009_HDRI_Sky_Flow.png | 4 +- 7 files changed, 293 insertions(+), 2 deletions(-) create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png new file mode 100644 index 00000000000..2644d6d2099 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:385d3653f0cfd25d0f170e2b90d9c57b0092d8313a499de2ec722f65500d546d +size 457941 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png.meta new file mode 100644 index 00000000000..df5351d6033 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: 807b3eb58c49f3146b7f9c243448804b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png new file mode 100644 index 00000000000..2644d6d2099 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:385d3653f0cfd25d0f170e2b90d9c57b0092d8313a499de2ec722f65500d546d +size 457941 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta new file mode 100644 index 00000000000..6c0e9d82bc9 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: afa4d49c3de21944d802bb119b1f7464 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png new file mode 100644 index 00000000000..2644d6d2099 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:385d3653f0cfd25d0f170e2b90d9c57b0092d8313a499de2ec722f65500d546d +size 457941 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png.meta new file mode 100644 index 00000000000..c0b1d4b1ea7 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: 544fa0ac4fa5a1a4a821054ad52cd869 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png index e318c40244b..2644d6d2099 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a0a0ac479e74a330c06a253c6687881f0169c7cc8f377111b2af2d9f6b2af7ce -size 120487 +oid sha256:385d3653f0cfd25d0f170e2b90d9c57b0092d8313a499de2ec722f65500d546d +size 457941 From d3b8dfa507959664cc11d7d971f72d9a0e238238 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 31 Mar 2020 09:56:11 +0200 Subject: [PATCH 07/44] Wait frames for test --- .../Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity index be066be277f..78e579430b2 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity @@ -310,5 +310,15 @@ PrefabInstance: value: objectReference: {fileID: 11400000, guid: ea1589d4340c02946897a7c2f9ade2f0, type: 2} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: captureFramerate + value: 60 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: waitFrames + value: 10 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} From 493f2ddad5af42193f6d222f3c0b433169208421 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 31 Mar 2020 11:51:54 +0200 Subject: [PATCH 08/44] Wait more --- .../Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity | 5 ----- .../5009_HDRI_Sky_Flow/Scene Settings Profile.asset | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity index 78e579430b2..ea1adcf233c 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity @@ -299,11 +299,6 @@ PrefabInstance: propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 value: 70005818916701 objectReference: {fileID: 0} - - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: ImageComparisonSettings.TargetHeight - value: 640 - objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: renderPipelineAsset diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset index d5e0702f5e3..07ac0929b9f 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset @@ -71,11 +71,11 @@ MonoBehaviour: m_OverrideState: 1 m_Value: {fileID: 8900000, guid: 6ec129c61e856c8418af7e35f6f557d0, type: 3} flowCycle: - m_OverrideState: 0 - m_Value: 1 + m_OverrideState: 1 + m_Value: 0.3 flowStrength: m_OverrideState: 1 - m_Value: 0.2 + m_Value: 2 enableBackplate: m_OverrideState: 0 m_Value: 0 From aa4ea583566098a9bf43e84d71a9f9f74b5ef259 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 31 Mar 2020 15:29:19 +0200 Subject: [PATCH 09/44] Update screenshots again... --- .../Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png index 88fc49430e7..d1f60d66f85 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42ca4e2d189fd7fb21189ee3970c7c1d7a1258ccf923b3bd52b7796524d53d16 -size 285326 +oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e +size 289134 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png index 88fc49430e7..d1f60d66f85 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42ca4e2d189fd7fb21189ee3970c7c1d7a1258ccf923b3bd52b7796524d53d16 -size 285326 +oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e +size 289134 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png index 88fc49430e7..d1f60d66f85 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42ca4e2d189fd7fb21189ee3970c7c1d7a1258ccf923b3bd52b7796524d53d16 -size 285326 +oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e +size 289134 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png index 88fc49430e7..d1f60d66f85 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42ca4e2d189fd7fb21189ee3970c7c1d7a1258ccf923b3bd52b7796524d53d16 -size 285326 +oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e +size 289134 From df9ef313b5de04522441664a19bb0309305d7b0b Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 31 Mar 2020 18:34:27 +0200 Subject: [PATCH 10/44] Static test --- .../5x_SkyAndFog/5009_HDRI_Sky_Flow.unity | 40 +------ .../Scene Settings Profile.asset | 8 +- .../5009_HDRI_Sky_Flow/kirby_flow.png | 3 - .../5009_HDRI_Sky_Flow/kirby_flow.png.meta | 106 ------------------ 4 files changed, 9 insertions(+), 148 deletions(-) delete mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png delete mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity index ea1adcf233c..790cabb29f8 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity @@ -259,36 +259,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_LocalRotation.y - value: -0.8886021 - objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_LocalRotation.w - value: 0.45305854 - objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_LocalRotation.x - value: -0.032515403 - objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_LocalRotation.z - value: -0.06377378 - objectReference: {fileID: 0} - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: field of view value: 38.4 objectReference: {fileID: 0} - - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: clearColorMode - value: 0 - objectReference: {fileID: 0} - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: m_Version @@ -299,21 +274,16 @@ PrefabInstance: propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 value: 70005818916701 objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: clearColorMode + value: 0 + objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: renderPipelineAsset value: objectReference: {fileID: 11400000, guid: ea1589d4340c02946897a7c2f9ade2f0, type: 2} - - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: captureFramerate - value: 60 - objectReference: {fileID: 0} - - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: waitFrames - value: 10 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset index 07ac0929b9f..eb195883681 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset @@ -69,13 +69,13 @@ MonoBehaviour: m_Value: {fileID: 8900000, guid: 5fb993a599e7e9b4b825e1a28e6d2c07, type: 3} flowmap: m_OverrideState: 1 - m_Value: {fileID: 8900000, guid: 6ec129c61e856c8418af7e35f6f557d0, type: 3} + m_Value: {fileID: 0} flowCycle: - m_OverrideState: 1 - m_Value: 0.3 + m_OverrideState: 0 + m_Value: 1 flowStrength: m_OverrideState: 1 - m_Value: 2 + m_Value: 0 enableBackplate: m_OverrideState: 0 m_Value: 0 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png deleted file mode 100644 index abc36ebed55..00000000000 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6a02cb766ccc271813c210ca621cc42014c28876182e5e31c81de69e99f978f3 -size 285835 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta deleted file mode 100644 index e7ae147067b..00000000000 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/kirby_flow.png.meta +++ /dev/null @@ -1,106 +0,0 @@ -fileFormatVersion: 2 -guid: 6ec129c61e856c8418af7e35f6f557d0 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - 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 - vTOnly: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 1 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: -1 - wrapV: -1 - wrapW: -1 - nPOTScale: 1 - 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: 0 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 2 - singleChannelComponent: 0 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: From bf26b3070b0c92531b50f59337a228345a298b46 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 31 Mar 2020 21:08:57 +0200 Subject: [PATCH 11/44] Static screenshots --- .../Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png | 4 ++-- .../WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png index d1f60d66f85..a9ee0e176ac 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e -size 289134 +oid sha256:b0b1037e0fc33f99ab3bff8bcf06711145617d1c1043c55007dad088686916a9 +size 281564 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png index d1f60d66f85..a9ee0e176ac 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e -size 289134 +oid sha256:b0b1037e0fc33f99ab3bff8bcf06711145617d1c1043c55007dad088686916a9 +size 281564 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png index d1f60d66f85..a9ee0e176ac 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e -size 289134 +oid sha256:b0b1037e0fc33f99ab3bff8bcf06711145617d1c1043c55007dad088686916a9 +size 281564 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png index d1f60d66f85..a9ee0e176ac 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5009_HDRI_Sky_Flow.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fda196f8d28cb51fae7694f390e25732d8fdbb7251e99d55411494d650c37b9e -size 289134 +oid sha256:b0b1037e0fc33f99ab3bff8bcf06711145617d1c1043c55007dad088686916a9 +size 281564 From a1c6e4e627932832114ba82e6da12a826b1cb69d Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 7 Apr 2020 11:07:06 +0200 Subject: [PATCH 12/44] use multi_compile --- .../Runtime/Sky/HDRISky/HDRISky.shader | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index e898fb193b6..444a2f25425 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -10,8 +10,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER - #pragma shader_feature_local USE_FLOWMAP - + #pragma multi_compile _ USE_FLOWMAP #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH From 25dd6274db9925e9c86eb18c2634548c9c15b4db Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 14 Apr 2020 15:23:19 +0200 Subject: [PATCH 13/44] Renamed all parameters --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 22 +++++++++------ .../Runtime/Sky/HDRISky/HDRISky.cs | 28 +++++++++++-------- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 6 ++-- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index 87d7ec94bd1..d9ae192b5f3 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -13,9 +13,10 @@ class HDRISkyEditor SerializedDataParameter m_hdriSky; SerializedDataParameter m_UpperHemisphereLuxValue; SerializedDataParameter m_UpperHemisphereLuxColor; - SerializedDataParameter m_flowmap; - SerializedDataParameter m_flowCycle; - SerializedDataParameter m_flowStrength; + SerializedDataParameter m_EnableDistortion; + SerializedDataParameter m_Flowmap; + SerializedDataParameter m_LoopTime; + SerializedDataParameter m_Amplitude; SerializedDataParameter m_EnableBackplate; SerializedDataParameter m_BackplateType; SerializedDataParameter m_GroundLevel; @@ -49,9 +50,10 @@ public override void OnEnable() m_UpperHemisphereLuxValue = Unpack(o.Find(x => x.upperHemisphereLuxValue)); m_UpperHemisphereLuxColor = Unpack(o.Find(x => x.upperHemisphereLuxColor)); - m_flowmap = Unpack(o.Find(x => x.flowmap)); - m_flowCycle = Unpack(o.Find(x => x.flowCycle)); - m_flowStrength = Unpack(o.Find(x => x.flowStrength)); + m_EnableDistortion = Unpack(o.Find(x => x.enableDistortion)); + m_Flowmap = Unpack(o.Find(x => x.flowmap)); + m_LoopTime = Unpack(o.Find(x => x.loopTime)); + m_Amplitude = Unpack(o.Find(x => x.amplitude)); m_EnableBackplate = Unpack(o.Find(x => x.enableBackplate)); m_BackplateType = Unpack(o.Find(x => x.backplateType)); @@ -123,11 +125,13 @@ public override void OnInspectorGUI() updateDefaultShadowTint = true; } - PropertyField(m_flowmap); + PropertyField(m_EnableDistortion, new GUIContent("Distortion")); + if (m_EnableDistortion.value.boolValue) { EditorGUI.indentLevel++; - PropertyField(m_flowCycle); - PropertyField(m_flowStrength); + PropertyField(m_Flowmap); + PropertyField(m_LoopTime); + PropertyField(m_Amplitude); EditorGUI.indentLevel--; } base.CommonSkySettingsGUI(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 9b27c6167ce..6afb8e27d27 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -13,15 +13,18 @@ public class HDRISky : SkySettings /// Cubemap used to render the HDRI sky. [Tooltip("Specify the cubemap HDRP uses to render the sky.")] public CubemapParameter hdriSky = new CubemapParameter(null); + /// Enable Flowmap to have distorsion. + [Tooltip("Enable or disable UV distortion.")] + public BoolParameter enableDistortion = new BoolParameter(false); /// Cubemap used to distort the uv for the HDRI sky. - [Tooltip("Specify the cubemap HDRP uses to distort sky uvs.")] + [Tooltip("Specify the cubemap HDRP uses for UV distortion.")] public CubemapParameter flowmap = new CubemapParameter(null); /// Time to do a full loop. - [Tooltip("Specify the loop time for uv distortion.")] - public FloatParameter flowCycle = new FloatParameter(1.0f); + [Tooltip("Time in seconds to loop animation.")] + public FloatParameter loopTime = new FloatParameter(1.0f); /// Multiplier for HDRI sky uv distortion. - [Tooltip("Specify the factor by which HDRP multiplies flow value.")] - public FloatParameter flowStrength = new FloatParameter(1.0f); + [Tooltip("Amplitude of the distorsion.")] + public FloatParameter amplitude = new FloatParameter(1.0f); /// Enable Backplate to have it visible. [Tooltip("Enable or disable the backplate.")] public BoolParameter enableBackplate = new BoolParameter(false); @@ -75,8 +78,9 @@ public override int GetHashCode() #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; - hash = hash * 23 + flowCycle.value.GetHashCode(); - hash = hash * 23 + flowStrength.value.GetHashCode(); + hash = hash * 23 + enableDistortion.value.GetHashCode(); + hash = hash * 23 + loopTime.value.GetHashCode(); + hash = hash * 23 + amplitude.value.GetHashCode(); hash = hash * 23 + enableBackplate.value.GetHashCode(); hash = hash * 23 + backplateType.value.GetHashCode(); hash = hash * 23 + groundLevel.value.GetHashCode(); @@ -93,8 +97,9 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; - hash = hash * 23 + flowCycle.overrideState.GetHashCode(); - hash = hash * 23 + flowStrength.overrideState.GetHashCode(); + hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); + hash = hash * 23 + loopTime.overrideState.GetHashCode(); + hash = hash * 23 + amplitude.overrideState.GetHashCode(); hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); hash = hash * 23 + backplateType.overrideState.GetHashCode(); hash = hash * 23 + groundLevel.overrideState.GetHashCode(); @@ -111,8 +116,9 @@ public override int GetHashCode() #else hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; - hash = hash * 23 + flowCycle.GetHashCode(); - hash = hash * 23 + flowStrength.GetHashCode(); + hash = hash * 23 + enableDistortion.GetHashCode(); + hash = hash * 23 + loopTime.GetHashCode(); + hash = hash * 23 + amplitude.GetHashCode(); hash = hash * 23 + enableBackplate.GetHashCode(); hash = hash * 23 + backplateType.GetHashCode(); hash = hash * 23 + groundLevel.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 093cc13ecca..d57568e0059 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -129,12 +129,12 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo passID = m_RenderFullscreenSkyWithBackplateID; } - if (hdriSky.flowmap.overrideState) + if (hdriSky.enableDistortion.value == true) { m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); - m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, 0.5f / hdriSky.flowCycle.value); - m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowStrength, hdriSky.flowStrength.value); + m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, 0.5f / hdriSky.loopTime.value); + m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowStrength, hdriSky.amplitude.value); } else m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); From a100d3350b78e53454c906973d6617631fb5bc8c Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 15 Apr 2020 11:23:00 +0200 Subject: [PATCH 14/44] Procedural distortion --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 13 +++++- .../RenderPipeline/HDStringConstants.cs | 3 +- .../Runtime/Sky/HDRISky/HDRISky.cs | 12 ++++++ .../Runtime/Sky/HDRISky/HDRISky.shader | 41 ++++++++++++++----- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 19 ++++++--- 5 files changed, 69 insertions(+), 19 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index d9ae192b5f3..d96e3281339 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -14,7 +14,9 @@ class HDRISkyEditor SerializedDataParameter m_UpperHemisphereLuxValue; SerializedDataParameter m_UpperHemisphereLuxColor; SerializedDataParameter m_EnableDistortion; + SerializedDataParameter m_Procedural; SerializedDataParameter m_Flowmap; + SerializedDataParameter m_RotationDistortion; SerializedDataParameter m_LoopTime; SerializedDataParameter m_Amplitude; SerializedDataParameter m_EnableBackplate; @@ -51,7 +53,9 @@ public override void OnEnable() m_UpperHemisphereLuxColor = Unpack(o.Find(x => x.upperHemisphereLuxColor)); m_EnableDistortion = Unpack(o.Find(x => x.enableDistortion)); + m_Procedural = Unpack(o.Find(x => x.procedural)); m_Flowmap = Unpack(o.Find(x => x.flowmap)); + m_RotationDistortion = Unpack(o.Find(x => x.rotationDistortion)); m_LoopTime = Unpack(o.Find(x => x.loopTime)); m_Amplitude = Unpack(o.Find(x => x.amplitude)); @@ -129,7 +133,14 @@ public override void OnInspectorGUI() if (m_EnableDistortion.value.boolValue) { EditorGUI.indentLevel++; - PropertyField(m_Flowmap); + PropertyField(m_Procedural, new GUIContent("Procedural")); + if (!m_Procedural.value.boolValue) + { + EditorGUI.indentLevel++; + PropertyField(m_Flowmap); + EditorGUI.indentLevel--; + } + PropertyField(m_RotationDistortion, new GUIContent("Distortion Rotation")); PropertyField(m_LoopTime); PropertyField(m_Amplitude); EditorGUI.indentLevel--; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index afc64c5feb8..c7b239528d4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -478,9 +478,8 @@ static class HDShaderIDs public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap"); public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); - public static readonly int _FlowSpeed = Shader.PropertyToID("_FlowSpeed"); - public static readonly int _FlowStrength = Shader.PropertyToID("_FlowStrength"); public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP"); + public static readonly int _DistortionParam = Shader.PropertyToID("_DistortionParam"); public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam"); public static readonly int _BackplateParameters0 = Shader.PropertyToID("_BackplateParameters0"); public static readonly int _BackplateParameters1 = Shader.PropertyToID("_BackplateParameters1"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 6afb8e27d27..7d116031080 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -16,9 +16,15 @@ public class HDRISky : SkySettings /// Enable Flowmap to have distorsion. [Tooltip("Enable or disable UV distortion.")] public BoolParameter enableDistortion = new BoolParameter(false); + /// Enable Flowmap to have distorsion. + [Tooltip("Enable or disable procedural distorsion.")] + public BoolParameter procedural = new BoolParameter(true); /// Cubemap used to distort the uv for the HDRI sky. [Tooltip("Specify the cubemap HDRP uses for UV distortion.")] public CubemapParameter flowmap = new CubemapParameter(null); + /// Rotation of the distortion. + [Tooltip("Sets the rotation of the distortion.")] + public ClampedFloatParameter rotationDistortion = new ClampedFloatParameter(0.0f, 0.0f, 360.0f); /// Time to do a full loop. [Tooltip("Time in seconds to loop animation.")] public FloatParameter loopTime = new FloatParameter(1.0f); @@ -79,6 +85,8 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; hash = hash * 23 + enableDistortion.value.GetHashCode(); + hash = hash * 23 + procedural.value.GetHashCode(); + hash = hash * 23 + rotationDistortion.value.GetHashCode(); hash = hash * 23 + loopTime.value.GetHashCode(); hash = hash * 23 + amplitude.value.GetHashCode(); hash = hash * 23 + enableBackplate.value.GetHashCode(); @@ -98,6 +106,8 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); + hash = hash * 23 + procedural.overrideState.GetHashCode(); + hash = hash * 23 + rotationDistortion.overrideState.GetHashCode(); hash = hash * 23 + loopTime.overrideState.GetHashCode(); hash = hash * 23 + amplitude.overrideState.GetHashCode(); hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); @@ -117,6 +127,8 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; hash = hash * 23 + enableDistortion.GetHashCode(); + hash = hash * 23 + procedural.GetHashCode(); + hash = hash * 23 + rotationDistortion.GetHashCode(); hash = hash * 23 + loopTime.GetHashCode(); hash = hash * 23 + amplitude.GetHashCode(); hash = hash * 23 + enableBackplate.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 444a2f25425..eff5f547650 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -10,7 +10,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER - #pragma multi_compile _ USE_FLOWMAP + #pragma multi_compile_local NO_DISTORTION USE_FLOWMAP PROCEDURAL + #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH @@ -51,13 +52,12 @@ Shader "Hidden/HDRP/Sky/HDRISky" TEXTURECUBE(_Flowmap); SAMPLER(sampler_Flowmap); + float4 _DistortionParam; // x time, y amplitude, zw rotation (cosPhi and sinPhi) float4 _SkyParam; // x exposure, y multiplier, zw rotation (cosPhi and sinPhi) float4 _BackplateParameters0; // xy: scale, z: groundLevel, w: projectionDistance float4 _BackplateParameters1; // x: BackplateType, y: BlendAmount, zw: backplate rotation (cosPhi_plate, sinPhi_plate) float4 _BackplateParameters2; // xy: BackplateTextureRotation (cos/sin), zw: Backplate Texture Offset float3 _BackplateShadowTint; // xyz: ShadowTint - float _FlowSpeed; - float _FlowStrength; uint _BackplateShadowFilter; #define _Intensity _SkyParam.x @@ -82,6 +82,9 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define _OffsetTex _BackplateParameters2.zw #define _ShadowTint _BackplateShadowTint.rgb #define _ShadowFilter _BackplateShadowFilter + #define _FlowTime _DistortionParam.x + #define _FlowAmplitude _DistortionParam.y + #define _FlowCosSin _DistortionParam.zw struct Attributes { @@ -177,19 +180,36 @@ Shader "Hidden/HDRP/Sky/HDRISky" return IsHit(sdf, dir.y); } - float3 GetSkyColor(float3 dir) + float2 GetFlow(float3 dir) { + dir = RotationUp(dir, _FlowCosSin); #ifdef USE_FLOWMAP + return SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; +#elif PROCEDURAL + // source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic + float3 d = float3(0, 1, 0) - dir; + return normalize(d - dot(d, dir) * dir).zx; +#else + return float2(0.0, 0.0); +#endif + } + + float3 GetSkyColor(float3 dir) + { +#ifdef NO_DISTORTION + return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; +#else // Compute distortion directions on the cube float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); - float3 bitangent = cross(dir, tangent); + float3 bitangent = cross(tangent, dir); // Compute flow factor - float2 flow = SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; - float time = _Time.y * _FlowSpeed; + float2 flow = GetFlow(dir); + + float time = _Time.y * _FlowTime; float2 alpha = frac(float2(time, time + 0.5)) - 0.5; - float2 uv1 = alpha.x * _FlowStrength * flow; - float2 uv2 = alpha.y * _FlowStrength * flow; + float2 uv1 = alpha.x * _FlowAmplitude * flow; + float2 uv2 = alpha.y * _FlowAmplitude * flow; // Sample twice float3 dir1 = dir + uv1.x * tangent + uv1.y * bitangent; @@ -199,9 +219,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir2, 0).rgb; // Blend color samples + //return float3(flow*0.5+0.5, 0); return lerp(color1, color2, abs(2.0 * alpha.x)); -#else - return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; #endif } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index d57568e0059..55759e106f4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -131,13 +131,22 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo if (hdriSky.enableDistortion.value == true) { - m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); - m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); - m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowSpeed, 0.5f / hdriSky.loopTime.value); - m_SkyHDRIMaterial.SetFloat(HDShaderIDs._FlowStrength, hdriSky.amplitude.value); + if (hdriSky.procedural.value == true) + { + m_SkyHDRIMaterial.EnableKeyword("PROCEDURAL"); + m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); + } + else + { + m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); + m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); + } + float rot = -Mathf.Deg2Rad*hdriSky.rotationDistortion.value; + Vector4 distortion = new Vector4(0.5f / hdriSky.loopTime.value, hdriSky.amplitude.value, Mathf.Cos(rot), Mathf.Sin(rot)); + m_SkyHDRIMaterial.SetVector(HDShaderIDs._DistortionParam, distortion); } else - m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); + m_SkyHDRIMaterial.EnableKeyword("NO_DISTORTION"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); From 112a8f5258439d317d6b02083ecc1c41efec6b46 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 15 Apr 2020 11:39:00 +0200 Subject: [PATCH 15/44] Update doc --- .../Documentation~/Override-HDRI-Sky.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md index 42d8cdcd114..5d6369546af 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md @@ -22,9 +22,12 @@ After you add an **HDRI Sky** override, you must set the Volume to use **HDRI Sk | Property | Description | | -------------------------------- | ------------------------------------------------------------ | | **HDRI Sky** | Assign a HDRI Texture that HDRP uses to render the sky. | -| **Flowmap** | Assign a flowmap that HDRP uses to distort uvs when rendering the sky. | -| - **Flow Cycle** | Set the period (in seconds) of the animation loop cycle. | -| - **Flow Strength** | Set the multiplier HDRP applies to values from the flowmap. | +| **Distortion* | Enable or disable UV distortion. | +| - **Procedural* | Check the box to enable procedural distortion. | +| -- **Flowmap* | Assign a flowmap that HDRP uses to distort uvs when rendering the sky. Only available if **Procedural is unchecked. | +| - **Distortion Rotation** | Use the slider to set the angle to rotate the distortion, in degrees. | +| - **Loop Time** | Set the period of the distortion loop, in seconds. | +| - **Amplitude** | Set the amplitude of the distortion. | | **Intensity Mode** | Use the drop-down to select the method that HDRP uses to calculate the sky intensity.
• **Exposure**: HDRP calculates intensity from an exposure value in EV100.
• **Multiplier**: HDRP calculates intensity from a flat multiplier.
• **Lux**: HDRP calculates intensity in terms of a target Lux value. | | - **Exposure** | Set the amount of light per unit area that HDRP applies to the HDRI Sky cubemap.
This property only appears when you select **Exposure** from the **Intensity Mode** drop-down. | | - **Multiplier** | Set the multiplier for HDRP to apply to the Scene as environmental light. HDRP multiplies the environment light in your Scene by this value.
This property only appears when you select **Multiplier** from the **Intensity Mode** drop-down. | From d880e05adee15749caaf2914950690beb9d0c26e Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 15 Apr 2020 14:30:36 +0200 Subject: [PATCH 16/44] Set all keywords --- .../Runtime/Sky/HDRISky/HDRISky.shader | 3 ++- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index eff5f547650..7d7f93b7a57 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -183,12 +183,13 @@ Shader "Hidden/HDRP/Sky/HDRISky" float2 GetFlow(float3 dir) { dir = RotationUp(dir, _FlowCosSin); + #ifdef USE_FLOWMAP return SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; #elif PROCEDURAL // source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic float3 d = float3(0, 1, 0) - dir; - return normalize(d - dot(d, dir) * dir).zx; + return (dir.y > 0) * normalize(d - dot(d, dir) * dir).zx; #else return float2(0.0, 0.0); #endif diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 55759e106f4..ec73196af80 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -131,6 +131,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo if (hdriSky.enableDistortion.value == true) { + m_SkyHDRIMaterial.DisableKeyword("NO_DISTORTION"); if (hdriSky.procedural.value == true) { m_SkyHDRIMaterial.EnableKeyword("PROCEDURAL"); @@ -138,6 +139,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo } else { + m_SkyHDRIMaterial.DisableKeyword("PROCEDURAL"); m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); } From b3c0fc6b2b9157dfb31305b2ec3e7bc030436408 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 10:51:02 +0200 Subject: [PATCH 17/44] Revert to old behaviour --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 32 ++++---- .../RenderPipeline/HDStringConstants.cs | 4 +- .../Runtime/Sky/HDRISky/HDRISky.cs | 59 ++++++++------- .../Runtime/Sky/HDRISky/HDRISky.shader | 73 +++++++++---------- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 27 ++++--- .../Runtime/Sky/SkyUtils.hlsl | 17 +++++ 6 files changed, 121 insertions(+), 91 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index d96e3281339..698e0fcc48a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -13,12 +13,14 @@ class HDRISkyEditor SerializedDataParameter m_hdriSky; SerializedDataParameter m_UpperHemisphereLuxValue; SerializedDataParameter m_UpperHemisphereLuxColor; - SerializedDataParameter m_EnableDistortion; + + SerializedDataParameter m_EnableCloudMotion; SerializedDataParameter m_Procedural; SerializedDataParameter m_Flowmap; - SerializedDataParameter m_RotationDistortion; - SerializedDataParameter m_LoopTime; - SerializedDataParameter m_Amplitude; + SerializedDataParameter m_UpperHemisphereOnly; + SerializedDataParameter m_ScrollDirection; + SerializedDataParameter m_ScrollSpeed; + SerializedDataParameter m_EnableBackplate; SerializedDataParameter m_BackplateType; SerializedDataParameter m_GroundLevel; @@ -52,12 +54,12 @@ public override void OnEnable() m_UpperHemisphereLuxValue = Unpack(o.Find(x => x.upperHemisphereLuxValue)); m_UpperHemisphereLuxColor = Unpack(o.Find(x => x.upperHemisphereLuxColor)); - m_EnableDistortion = Unpack(o.Find(x => x.enableDistortion)); + m_EnableCloudMotion = Unpack(o.Find(x => x.enableDistortion)); m_Procedural = Unpack(o.Find(x => x.procedural)); m_Flowmap = Unpack(o.Find(x => x.flowmap)); - m_RotationDistortion = Unpack(o.Find(x => x.rotationDistortion)); - m_LoopTime = Unpack(o.Find(x => x.loopTime)); - m_Amplitude = Unpack(o.Find(x => x.amplitude)); + m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); + m_ScrollDirection = Unpack(o.Find(x => x.scrollDirection)); + m_ScrollSpeed = Unpack(o.Find(x => x.scrollSpeed)); m_EnableBackplate = Unpack(o.Find(x => x.enableBackplate)); m_BackplateType = Unpack(o.Find(x => x.backplateType)); @@ -129,20 +131,22 @@ public override void OnInspectorGUI() updateDefaultShadowTint = true; } - PropertyField(m_EnableDistortion, new GUIContent("Distortion")); - if (m_EnableDistortion.value.boolValue) + PropertyField(m_EnableCloudMotion); + if (m_EnableCloudMotion.value.boolValue) { EditorGUI.indentLevel++; - PropertyField(m_Procedural, new GUIContent("Procedural")); + + PropertyField(m_Procedural, new GUIContent("Procedural distortion")); if (!m_Procedural.value.boolValue) { EditorGUI.indentLevel++; PropertyField(m_Flowmap); + PropertyField(m_UpperHemisphereOnly); EditorGUI.indentLevel--; } - PropertyField(m_RotationDistortion, new GUIContent("Distortion Rotation")); - PropertyField(m_LoopTime); - PropertyField(m_Amplitude); + + PropertyField(m_ScrollDirection); + PropertyField(m_ScrollSpeed); EditorGUI.indentLevel--; } base.CommonSkySettingsGUI(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index c7b239528d4..68a401e5370 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -477,7 +477,6 @@ static class HDShaderIDs public static readonly int _ThicknessRemap = Shader.PropertyToID("_ThicknessRemap"); public static readonly int _Cubemap = Shader.PropertyToID("_Cubemap"); - public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); public static readonly int _InvOmegaP = Shader.PropertyToID("_InvOmegaP"); public static readonly int _DistortionParam = Shader.PropertyToID("_DistortionParam"); public static readonly int _SkyParam = Shader.PropertyToID("_SkyParam"); @@ -489,6 +488,9 @@ static class HDShaderIDs public static readonly int _SkyIntensity = Shader.PropertyToID("_SkyIntensity"); public static readonly int _PixelCoordToViewDirWS = Shader.PropertyToID("_PixelCoordToViewDirWS"); + public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); + public static readonly int _FlowmapParam = Shader.PropertyToID("_FlowmapParam"); + public static readonly int _Size = Shader.PropertyToID("_Size"); public static readonly int _Source = Shader.PropertyToID("_Source"); public static readonly int _Destination = Shader.PropertyToID("_Destination"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 7d116031080..e8530f679fd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -13,24 +13,26 @@ public class HDRISky : SkySettings /// Cubemap used to render the HDRI sky. [Tooltip("Specify the cubemap HDRP uses to render the sky.")] public CubemapParameter hdriSky = new CubemapParameter(null); - /// Enable Flowmap to have distorsion. - [Tooltip("Enable or disable UV distortion.")] + + /// Enable to have sky distortion. + [Tooltip("Enable or disable sky distortion.")] public BoolParameter enableDistortion = new BoolParameter(false); - /// Enable Flowmap to have distorsion. - [Tooltip("Enable or disable procedural distorsion.")] + /// Enable to have a simple, procedural distorsion. + [Tooltip("If enabled, the sky will be distorted by a constant wind.")] public BoolParameter procedural = new BoolParameter(true); - /// Cubemap used to distort the uv for the HDRI sky. - [Tooltip("Specify the cubemap HDRP uses for UV distortion.")] - public CubemapParameter flowmap = new CubemapParameter(null); - /// Rotation of the distortion. - [Tooltip("Sets the rotation of the distortion.")] - public ClampedFloatParameter rotationDistortion = new ClampedFloatParameter(0.0f, 0.0f, 360.0f); - /// Time to do a full loop. - [Tooltip("Time in seconds to loop animation.")] - public FloatParameter loopTime = new FloatParameter(1.0f); - /// Multiplier for HDRI sky uv distortion. - [Tooltip("Amplitude of the distorsion.")] - public FloatParameter amplitude = new FloatParameter(1.0f); + /// Texture used to distort the uv for the HDRI sky. + [Tooltip("Specify the flowmap HDRP uses for sky distortion (in Latlong format).")] + public TextureParameter flowmap = new TextureParameter(null); + /// Enable to affect only the upper part of the sky. + [Tooltip("Enabled if the flowmap covers only the upper part of the sky.")] + public BoolParameter upperHemisphereOnly = new BoolParameter(true); + /// Direction of the wind. + [Tooltip("Sets the rotation of the distortion (in degrees).")] + public ClampedFloatParameter scrollDirection = new ClampedFloatParameter(0.0f, 0.0f, 360.0f); + /// Force of the wind. + [Tooltip("Sets the cloud movement speed. The higher the value, the faster the clouds will move.")] + public MinFloatParameter scrollSpeed = new MinFloatParameter(2.0f, 0.0f); + /// Enable Backplate to have it visible. [Tooltip("Enable or disable the backplate.")] public BoolParameter enableBackplate = new BoolParameter(false); @@ -84,11 +86,12 @@ public override int GetHashCode() #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; - hash = hash * 23 + enableDistortion.value.GetHashCode(); + hash = hash * 23 + enableCloudMotion.value.GetHashCode(); hash = hash * 23 + procedural.value.GetHashCode(); - hash = hash * 23 + rotationDistortion.value.GetHashCode(); - hash = hash * 23 + loopTime.value.GetHashCode(); - hash = hash * 23 + amplitude.value.GetHashCode(); + hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); + hash = hash * 23 + windDirection.value.GetHashCode(); + hash = hash * 23 + windForce.value.GetHashCode(); + hash = hash * 23 + enableBackplate.value.GetHashCode(); hash = hash * 23 + backplateType.value.GetHashCode(); hash = hash * 23 + groundLevel.value.GetHashCode(); @@ -105,11 +108,12 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; - hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); + hash = hash * 23 + enableCloudMotion.overrideState.GetHashCode(); hash = hash * 23 + procedural.overrideState.GetHashCode(); - hash = hash * 23 + rotationDistortion.overrideState.GetHashCode(); - hash = hash * 23 + loopTime.overrideState.GetHashCode(); - hash = hash * 23 + amplitude.overrideState.GetHashCode(); + hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); + hash = hash * 23 + windDirection.overrideState.GetHashCode(); + hash = hash * 23 + windForce.overrideState.GetHashCode(); + hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); hash = hash * 23 + backplateType.overrideState.GetHashCode(); hash = hash * 23 + groundLevel.overrideState.GetHashCode(); @@ -128,9 +132,10 @@ public override int GetHashCode() hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; hash = hash * 23 + enableDistortion.GetHashCode(); hash = hash * 23 + procedural.GetHashCode(); - hash = hash * 23 + rotationDistortion.GetHashCode(); - hash = hash * 23 + loopTime.GetHashCode(); - hash = hash * 23 + amplitude.GetHashCode(); + hash = hash * 23 + upperHemisphereOnly.GetHashCode(); + hash = hash * 23 + scrollDirection.GetHashCode(); + hash = hash * 23 + scrollSpeed.GetHashCode(); + hash = hash * 23 + enableBackplate.GetHashCode(); hash = hash * 23 + backplateType.GetHashCode(); hash = hash * 23 + groundLevel.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 7d7f93b7a57..1eebd4edf7c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -10,7 +10,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define LIGHTLOOP_DISABLE_TILE_AND_CLUSTER - #pragma multi_compile_local NO_DISTORTION USE_FLOWMAP PROCEDURAL + #pragma multi_compile_local _ SKY_MOTION + #pragma multi_compile_local _ USE_FLOWMAP #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH @@ -49,7 +50,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" TEXTURECUBE(_Cubemap); SAMPLER(sampler_Cubemap); - TEXTURECUBE(_Flowmap); + TEXTURE2D(_Flowmap); SAMPLER(sampler_Flowmap); float4 _DistortionParam; // x time, y amplitude, zw rotation (cosPhi and sinPhi) @@ -60,6 +61,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 _BackplateShadowTint; // xyz: ShadowTint uint _BackplateShadowFilter; + float4 _FlowmapParam; // x upper hemisphere only, y scroll speed, zw scroll direction (cosPhi and sinPhi) + #define _Intensity _SkyParam.x #define _CosPhi _SkyParam.z #define _SinPhi _SkyParam.w @@ -82,9 +85,9 @@ Shader "Hidden/HDRP/Sky/HDRISky" #define _OffsetTex _BackplateParameters2.zw #define _ShadowTint _BackplateShadowTint.rgb #define _ShadowFilter _BackplateShadowFilter - #define _FlowTime _DistortionParam.x - #define _FlowAmplitude _DistortionParam.y - #define _FlowCosSin _DistortionParam.zw + #define _UpperHemisphere _FlowmapParam.x + #define _ScrollFactor _FlowmapParam.y + #define _ScrollDirection _FlowmapParam.zw struct Attributes { @@ -180,49 +183,45 @@ Shader "Hidden/HDRP/Sky/HDRISky" return IsHit(sdf, dir.y); } - float2 GetFlow(float3 dir) + float3 GetDistordedSkyColor(float3 dir) { - dir = RotationUp(dir, _FlowCosSin); +#if SKY_MOTION + if (dir.y >= 0 || !_UpperHemisphere) + { + float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); + float3 bitangent = cross(tangent, dir); + // Compute flow factor + float3 windDir = RotationUp(dir, _ScrollDirection); #ifdef USE_FLOWMAP - return SAMPLE_TEXTURECUBE_LOD(_Flowmap, sampler_Flowmap, dir, 0).rg * 2.0 - 1.0; -#elif PROCEDURAL - // source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic - float3 d = float3(0, 1, 0) - dir; - return (dir.y > 0) * normalize(d - dot(d, dir) * dir).zx; + float2 flow = SAMPLE_TEXTURE2D_LOD(_Flowmap, sampler_Flowmap, GetLatLongCoords(windDir, _UpperHemisphere), 0).rg * 2.0 - 1.0; #else - return float2(0.0, 0.0); + float2 flow = GenerateFlow(windDir); #endif - } - - float3 GetSkyColor(float3 dir) - { -#ifdef NO_DISTORTION - return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; -#else - // Compute distortion directions on the cube - float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); - float3 bitangent = cross(tangent, dir); - // Compute flow factor - float2 flow = GetFlow(dir); + float2 alpha = frac(float2(_ScrollFactor, _ScrollFactor + 0.5)) - 0.5; - float time = _Time.y * _FlowTime; - float2 alpha = frac(float2(time, time + 0.5)) - 0.5; - float2 uv1 = alpha.x * _FlowAmplitude * flow; - float2 uv2 = alpha.y * _FlowAmplitude * flow; + float2 uv1 = alpha.x * flow; + float2 uv2 = alpha.y * flow; - // Sample twice - float3 dir1 = dir + uv1.x * tangent + uv1.y * bitangent; - float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir1, 0).rgb; + float3 dd1 = uv1.x * tangent + uv1.y * bitangent; //dd1.y = abs(dd1.y); + float3 dd2 = uv2.x * tangent + uv2.y * bitangent; //dd2.y = abs(dd2.y); - float3 dir2 = dir + uv2.x * tangent + uv2.y * bitangent; - float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir2, 0).rgb; + // Sample twice + float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd1, 0).rgb; + float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd2, 0).rgb; - // Blend color samples - //return float3(flow*0.5+0.5, 0); - return lerp(color1, color2, abs(2.0 * alpha.x)); + // Blend color samples + return lerp(color1, color2, abs(2.0 * alpha.x)); + } #endif + + return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; + } + + float3 GetSkyColor(float3 dir) + { + return GetDistordedSkyColor(dir); } float4 GetColorWithRotation(float3 dir, float exposure, float2 cos_sin) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index ec73196af80..8d451cafbfc 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -5,6 +5,8 @@ class HDRISkyRenderer : SkyRenderer Material m_SkyHDRIMaterial; // Renders a cubemap into a render texture (can be cube or 2D) MaterialPropertyBlock m_PropertyBlock = new MaterialPropertyBlock(); + float scrollFactor = 0.0f, lastTime = 0.0f; + private static int m_RenderCubemapID = 0; // FragBaking private static int m_RenderFullscreenSkyID = 1; // FragRender private static int m_RenderCubemapWithBackplateID = 2; // FragBakingBackplate @@ -131,24 +133,25 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo if (hdriSky.enableDistortion.value == true) { - m_SkyHDRIMaterial.DisableKeyword("NO_DISTORTION"); - if (hdriSky.procedural.value == true) - { - m_SkyHDRIMaterial.EnableKeyword("PROCEDURAL"); - m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); - } - else + m_SkyHDRIMaterial.EnableKeyword("SKY_MOTION"); + if (hdriSky.procedural.value == false) { - m_SkyHDRIMaterial.DisableKeyword("PROCEDURAL"); m_SkyHDRIMaterial.EnableKeyword("USE_FLOWMAP"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Flowmap, hdriSky.flowmap.value); } - float rot = -Mathf.Deg2Rad*hdriSky.rotationDistortion.value; - Vector4 distortion = new Vector4(0.5f / hdriSky.loopTime.value, hdriSky.amplitude.value, Mathf.Cos(rot), Mathf.Sin(rot)); - m_SkyHDRIMaterial.SetVector(HDShaderIDs._DistortionParam, distortion); + else + m_SkyHDRIMaterial.DisableKeyword("USE_FLOWMAP"); + + float rot = -Mathf.Deg2Rad*hdriSky.scrollDirection.value; + Vector4 flowmapParam = new Vector4(hdriSky.upperHemisphereOnly.value ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); + + m_SkyHDRIMaterial.SetVector(HDShaderIDs._FlowmapParam, flowmapParam); + + scrollFactor += hdriSky.scrollSpeed.value * (Time.time - lastTime) * 0.01f; + lastTime = Time.time; } else - m_SkyHDRIMaterial.EnableKeyword("NO_DISTORTION"); + m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index ba0a7bd6290..eddc6a562e6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -17,4 +17,21 @@ float3 GetSkyViewDirWS(float2 positionCS) return normalize(viewDirWS.xyz); } +// Returns latlong coords from view direction +float2 GetLatLongCoords(float3 dir, int upperHemisphereOnly) +{ + float angle = atan2(dir.z, dir.x)/(2.0*PI) + 0.5; + float height = lerp(dir.y * 0.5 + 0.5, dir.y, upperHemisphereOnly); + + return float2(angle, height); +} + +// Generates a flow for a constant wind in the z direction +// source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic +float2 GenerateFlow(float3 dir) +{ + float3 d = float3(0, 1, 0) - dir; + return (dir.y > 0) * normalize(d - dot(d, dir) * dir).zx; +} + #endif // __SKYUTILS_H__ From 4dd9c9180e58e5a3480a211a80c519b14fdf22f7 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 11:26:04 +0200 Subject: [PATCH 18/44] doc --- .../Documentation~/Override-HDRI-Sky.md | 12 ++++++------ .../Runtime/Sky/HDRISky/HDRISky.cs | 4 ++-- .../Runtime/Sky/SkyUtils.hlsl | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md index 5d6369546af..8eb35bf7380 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md @@ -22,12 +22,12 @@ After you add an **HDRI Sky** override, you must set the Volume to use **HDRI Sk | Property | Description | | -------------------------------- | ------------------------------------------------------------ | | **HDRI Sky** | Assign a HDRI Texture that HDRP uses to render the sky. | -| **Distortion* | Enable or disable UV distortion. | -| - **Procedural* | Check the box to enable procedural distortion. | -| -- **Flowmap* | Assign a flowmap that HDRP uses to distort uvs when rendering the sky. Only available if **Procedural is unchecked. | -| - **Distortion Rotation** | Use the slider to set the angle to rotate the distortion, in degrees. | -| - **Loop Time** | Set the period of the distortion loop, in seconds. | -| - **Amplitude** | Set the amplitude of the distortion. | +| **Enable Distortion** | Enable or disable UV distortion. | +| - **Procedural distortion** | Check the box to distort the sky using a uniform wind direction. | +| -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the sky. Only available if **Procedural is unchecked. | +| -- **Upper Hemisphere Only** | Check the box if the flowmap contains distortion for the sky above the horizon only. Only available if **Procedural is unchecked. | +| - **Scroll direction** | Use the slider to set the scrolling directio for the distortion, in degrees. | +| - **Scroll speed** | Modify the speed at which HDRP scrolls the distortion texture. | | **Intensity Mode** | Use the drop-down to select the method that HDRP uses to calculate the sky intensity.
• **Exposure**: HDRP calculates intensity from an exposure value in EV100.
• **Multiplier**: HDRP calculates intensity from a flat multiplier.
• **Lux**: HDRP calculates intensity in terms of a target Lux value. | | - **Exposure** | Set the amount of light per unit area that HDRP applies to the HDRI Sky cubemap.
This property only appears when you select **Exposure** from the **Intensity Mode** drop-down. | | - **Multiplier** | Set the multiplier for HDRP to apply to the Scene as environmental light. HDRP multiplies the environment light in your Scene by this value.
This property only appears when you select **Multiplier** from the **Intensity Mode** drop-down. | diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index e8530f679fd..6ec47441e17 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -21,10 +21,10 @@ public class HDRISky : SkySettings [Tooltip("If enabled, the sky will be distorted by a constant wind.")] public BoolParameter procedural = new BoolParameter(true); /// Texture used to distort the uv for the HDRI sky. - [Tooltip("Specify the flowmap HDRP uses for sky distortion (in Latlong format).")] + [Tooltip("Specify the flowmap HDRP uses for sky distortion (in LatLong layout).")] public TextureParameter flowmap = new TextureParameter(null); /// Enable to affect only the upper part of the sky. - [Tooltip("Enabled if the flowmap covers only the upper part of the sky.")] + [Tooltip("Check this box if the flowmap covers only the upper part of the sky.")] public BoolParameter upperHemisphereOnly = new BoolParameter(true); /// Direction of the wind. [Tooltip("Sets the rotation of the distortion (in degrees).")] diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index eddc6a562e6..471ed627a6a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -18,7 +18,7 @@ float3 GetSkyViewDirWS(float2 positionCS) } // Returns latlong coords from view direction -float2 GetLatLongCoords(float3 dir, int upperHemisphereOnly) +float2 GetLatLongCoords(float3 dir, float upperHemisphereOnly) { float angle = atan2(dir.z, dir.x)/(2.0*PI) + 0.5; float height = lerp(dir.y * 0.5 + 0.5, dir.y, upperHemisphereOnly); From 3f6be526e972091281ea6746c78609a7bc19630f Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 11:37:55 +0200 Subject: [PATCH 19/44] update test --- .../Scene Settings Profile.asset | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset index eb195883681..3b0c721e318 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow/Scene Settings Profile.asset @@ -67,15 +67,27 @@ MonoBehaviour: hdriSky: m_OverrideState: 1 m_Value: {fileID: 8900000, guid: 5fb993a599e7e9b4b825e1a28e6d2c07, type: 3} + enableDistortion: + m_OverrideState: 1 + m_Value: 1 + procedural: + m_OverrideState: 0 + m_Value: 1 flowmap: m_OverrideState: 1 m_Value: {fileID: 0} - flowCycle: + upperHemisphereOnly: m_OverrideState: 0 m_Value: 1 - flowStrength: + scrollDirection: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + scrollSpeed: m_OverrideState: 1 m_Value: 0 + min: 0 enableBackplate: m_OverrideState: 0 m_Value: 0 From e64a038839dbc6c34c7c867bf3dc58c3d4e467bf Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 11:54:08 +0200 Subject: [PATCH 20/44] remove useless variable --- .../Runtime/Sky/HDRISky/HDRISky.shader | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 1eebd4edf7c..bb1048d1b66 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -53,7 +53,6 @@ Shader "Hidden/HDRP/Sky/HDRISky" TEXTURE2D(_Flowmap); SAMPLER(sampler_Flowmap); - float4 _DistortionParam; // x time, y amplitude, zw rotation (cosPhi and sinPhi) float4 _SkyParam; // x exposure, y multiplier, zw rotation (cosPhi and sinPhi) float4 _BackplateParameters0; // xy: scale, z: groundLevel, w: projectionDistance float4 _BackplateParameters1; // x: BackplateType, y: BlendAmount, zw: backplate rotation (cosPhi_plate, sinPhi_plate) @@ -61,7 +60,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 _BackplateShadowTint; // xyz: ShadowTint uint _BackplateShadowFilter; - float4 _FlowmapParam; // x upper hemisphere only, y scroll speed, zw scroll direction (cosPhi and sinPhi) + float4 _FlowmapParam; // x upper hemisphere only, y scroll factor, zw scroll direction (cosPhi and sinPhi) #define _Intensity _SkyParam.x #define _CosPhi _SkyParam.z From 7e50c96aa5bc4858258a371d35690f3a213cbf0c Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 13:19:23 +0200 Subject: [PATCH 21/44] doc --- .../Editor/Sky/HDRISky/HDRISkyEditor.cs | 12 ++++++++++++ .../Runtime/Sky/HDRISky/HDRISky.cs | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs index 698e0fcc48a..3aec9004d39 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDRISky/HDRISkyEditor.cs @@ -118,6 +118,16 @@ public void GetUpperHemisphereLuxValue() m_UpperHemisphereLuxColor.value.vector3Value *= 0.5f; // Arbitrary 25% to not have too dark or too bright shadow } + bool IsFlowmapFormatInvalid(SerializedDataParameter map) + { + if (!map.overrideState.boolValue || map.value.objectReferenceValue == null) + return false; + var tex = map.value.objectReferenceValue; + if (tex.GetType() == typeof(RenderTexture)) + return (tex as RenderTexture).dimension != TextureDimension.Tex2D; + return tex.GetType() != typeof(Texture2D); + } + public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); @@ -141,6 +151,8 @@ public override void OnInspectorGUI() { EditorGUI.indentLevel++; PropertyField(m_Flowmap); + if (IsFlowmapFormatInvalid(m_Flowmap)) + EditorGUILayout.HelpBox("The flowmap needs to be a 2D Texture in LatLong layout.", MessageType.Info); PropertyField(m_UpperHemisphereOnly); EditorGUI.indentLevel--; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 6ec47441e17..9ff4636e651 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -26,11 +26,11 @@ public class HDRISky : SkySettings /// Enable to affect only the upper part of the sky. [Tooltip("Check this box if the flowmap covers only the upper part of the sky.")] public BoolParameter upperHemisphereOnly = new BoolParameter(true); - /// Direction of the wind. + /// Direction of the distortion. [Tooltip("Sets the rotation of the distortion (in degrees).")] public ClampedFloatParameter scrollDirection = new ClampedFloatParameter(0.0f, 0.0f, 360.0f); - /// Force of the wind. - [Tooltip("Sets the cloud movement speed. The higher the value, the faster the clouds will move.")] + /// Speed of the distortion. + [Tooltip("Sets the scrolling speed of the distortion.")] public MinFloatParameter scrollSpeed = new MinFloatParameter(2.0f, 0.0f); /// Enable Backplate to have it visible. From e223a306e1232a3180a66568429d5dd3afb1ed13 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 15:26:40 +0200 Subject: [PATCH 22/44] CloudLayer HDRI --- .../Editor/Sky/CloudLayer.meta | 8 ++ .../Editor/Sky/CloudLayer/CloudLayerEditor.cs | 80 ++++++++++++ .../Sky/CloudLayer/CloudLayerEditor.cs.meta | 11 ++ .../Runtime/RenderPipeline/Camera/HDCamera.cs | 3 + .../RenderPipeline/HDStringConstants.cs | 3 + .../Runtime/Sky/CloudLayer.meta | 8 ++ .../Runtime/Sky/CloudLayer/CloudLayer.cs | 115 ++++++++++++++++++ .../Runtime/Sky/CloudLayer/CloudLayer.cs.meta | 11 ++ .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 81 ++++++++++++ .../Sky/CloudLayer/CloudLayer.hlsl.meta | 9 ++ .../Sky/GradientSky/GradientSkyRenderer.cs | 1 + .../Runtime/Sky/HDRISky/HDRISky.shader | 7 +- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 9 ++ .../Runtime/Sky/SkyManager.cs | 10 +- .../Runtime/Sky/SkyRenderer.cs | 3 + .../Runtime/Sky/SkyUpdateContext.cs | 1 + 16 files changed, 358 insertions(+), 2 deletions(-) create mode 100644 com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl.meta diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer.meta b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer.meta new file mode 100644 index 00000000000..04dd5970562 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d54106328eb9dec478d3593c76dda4ad +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs new file mode 100644 index 00000000000..6a4465af83e --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering.HighDefinition; + +namespace UnityEditor.Rendering.HighDefinition +{ + [CanEditMultipleObjects] + [VolumeComponentEditor(typeof(CloudLayer))] + class CloudLayerEditor : VolumeComponentEditor + { + SerializedDataParameter m_Enabled; + + SerializedDataParameter m_UpperHemisphereOnly; + SerializedDataParameter m_CloudMap; + + SerializedDataParameter m_EnableCloudMotion; + SerializedDataParameter m_Procedural; + SerializedDataParameter m_Flowmap; + SerializedDataParameter m_ScrollDirection; + SerializedDataParameter m_ScrollSpeed; + + public override void OnEnable() + { + var o = new PropertyFetcher(serializedObject); + + m_Enabled = Unpack(o.Find(x => x.enabled)); + + m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); + m_CloudMap = Unpack(o.Find(x => x.cloudMap)); + + m_EnableCloudMotion = Unpack(o.Find(x => x.enableCloudMotion)); + m_Procedural = Unpack(o.Find(x => x.procedural)); + m_Flowmap = Unpack(o.Find(x => x.flowmap)); + m_ScrollDirection = Unpack(o.Find(x => x.scrollDirection)); + m_ScrollSpeed = Unpack(o.Find(x => x.scrollSpeed)); + } + + bool IsMapFormatInvalid(SerializedDataParameter map) + { + if (!map.overrideState.boolValue || map.value.objectReferenceValue == null) + return false; + var tex = map.value.objectReferenceValue; + if (tex.GetType() == typeof(RenderTexture)) + return (tex as RenderTexture).dimension != TextureDimension.Tex2D; + return tex.GetType() != typeof(Texture2D); + } + + public override void OnInspectorGUI() + { + PropertyField(m_Enabled, new GUIContent("Enable")); + + PropertyField(m_CloudMap); + if (IsMapFormatInvalid(m_CloudMap)) + EditorGUILayout.HelpBox("The cloud map needs to be a 2D Texture in LatLong layout.", MessageType.Info); + + PropertyField(m_UpperHemisphereOnly); + + PropertyField(m_EnableCloudMotion, new GUIContent("Cloud Motion")); + if (m_EnableCloudMotion.value.boolValue) + { + EditorGUI.indentLevel++; + + PropertyField(m_Procedural, new GUIContent("Procedural distortion")); + if (!m_Procedural.value.boolValue) + { + EditorGUI.indentLevel++; + PropertyField(m_Flowmap); + if (IsMapFormatInvalid(m_Flowmap)) + EditorGUILayout.HelpBox("The flowmap needs to be a 2D Texture in LatLong layout.", MessageType.Info); + EditorGUI.indentLevel--; + } + + PropertyField(m_ScrollDirection); + PropertyField(m_ScrollSpeed); + EditorGUI.indentLevel--; + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs.meta new file mode 100644 index 00000000000..56e845e992d --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e6ca009210e85204d928e065bde4db48 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index ce12c8649c2..100a134862a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -757,6 +757,9 @@ internal void UpdateCurrentSky(SkyManager skyManager) visualSky.skySettings = SkyManager.GetSkySetting(volumeStack); + var cloudLayer = volumeStack.GetComponent(); + visualSky.cloudLayer = (cloudLayer != null && cloudLayer.enabled.value) ? cloudLayer : null; + // Now, see if we have a lighting override // Update needs to happen before testing if the component is active other internal data structure are not properly updated yet. VolumeManager.instance.Update(skyManager.lightingOverrideVolumeStack, volumeAnchor, skyManager.lightingOverrideLayerMask); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index 68a401e5370..834cc7a250a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -490,6 +490,9 @@ static class HDShaderIDs public static readonly int _Flowmap = Shader.PropertyToID("_Flowmap"); public static readonly int _FlowmapParam = Shader.PropertyToID("_FlowmapParam"); + public static readonly int _CloudMap = Shader.PropertyToID("_CloudMap"); + public static readonly int _CloudFlowmap = Shader.PropertyToID("_CloudFlowmap"); + public static readonly int _CloudParam = Shader.PropertyToID("_CloudParam"); public static readonly int _Size = Shader.PropertyToID("_Size"); public static readonly int _Source = Shader.PropertyToID("_Source"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer.meta b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer.meta new file mode 100644 index 00000000000..9a4378f4bc9 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2aa30fadfa3cfc40a2283f98aa5be6f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs new file mode 100644 index 00000000000..666707590b3 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -0,0 +1,115 @@ +using System; + +namespace UnityEngine.Rendering.HighDefinition +{ + /// + /// Cloud Layer Volume Component. + /// This component setups the cloud layer for rendering. + /// + [VolumeComponentMenu("Sky/Cloud Layer")] + public class CloudLayer : VolumeComponent + { + /// Enable fog. + [Tooltip("Check to have a cloud layer in the sky.")] + public BoolParameter enabled = new BoolParameter(false); + + /// Texture used to render the clouds. + [Tooltip("Specify the texture HDRP uses to render the clouds (in LatLong layout).")] + public TextureParameter cloudMap = new TextureParameter(null); + /// Enable to cover only the upper part of the sky. + [Tooltip("Check this box if the cloud layer covers only the upper part of the sky.")] + public BoolParameter upperHemisphereOnly = new BoolParameter(true); + + /// Enable to have cloud motion. + [Tooltip("Enable or disable cloud motion.")] + public BoolParameter enableCloudMotion = new BoolParameter(false); + /// Enable to have a simple, procedural distorsion. + [Tooltip("If enabled, the clouds will be distorted by a constant wind.")] + public BoolParameter procedural = new BoolParameter(true); + /// Texture used to distort the UVs for the cloud layer. + [Tooltip("Specify the flowmap HDRP uses for cloud distortion (in LatLong layout).")] + public TextureParameter flowmap = new TextureParameter(null); + /// Direction of the distortion. + [Tooltip("Sets the rotation of the distortion (in degrees).")] + public ClampedFloatParameter scrollDirection = new ClampedFloatParameter(0.0f, 0.0f, 360.0f); + /// Speed of the distortion. + [Tooltip("Sets the cloud scrolling speed. The higher the value, the faster the clouds will move.")] + public MinFloatParameter scrollSpeed = new MinFloatParameter(2.0f, 0.0f); + + + private float scrollFactor = 0.0f, lastTime = 0.0f; + + /// + /// Returns the shader parameters of the cloud layer. + /// + /// The shader parameters of the cloud layer. + public Vector4 GetParameters() + { + scrollFactor += scrollSpeed.value * (Time.time - lastTime) * 0.01f; + lastTime = Time.time; + + float rot = -Mathf.Deg2Rad*scrollDirection.value; + return new Vector4(upperHemisphereOnly.value ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); + } + + public void Render(Material skyMaterial) + { + Vector4 cloudParam = GetParameters(); + + skyMaterial.EnableKeyword("USE_CLOUD_MAP"); + skyMaterial.SetTexture(HDShaderIDs._CloudMap, cloudMap.value); + skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); + + if (enableCloudMotion.value == true) + { + skyMaterial.EnableKeyword("USE_CLOUD_MOTION"); + if (procedural.value == true) + skyMaterial.DisableKeyword("USE_CLOUD_MAP"); + else + skyMaterial.SetTexture(HDShaderIDs._CloudFlowmap, flowmap.value); + } + else + skyMaterial.DisableKeyword("USE_CLOUD_MOTION"); + } + + /// + /// Returns the hash code of the HDRI sky parameters. + /// + /// The hash code of the HDRI sky parameters. + public override int GetHashCode() + { + int hash = base.GetHashCode(); + + unchecked + { +#if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) + hash = cloudMap.value != null ? hash * 23 + cloudMap.value.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; + hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); + hash = hash * 23 + enableCloudMotion.value.GetHashCode(); + hash = hash * 23 + procedural.value.GetHashCode(); + hash = hash * 23 + windDirection.value.GetHashCode(); + hash = hash * 23 + windForce.value.GetHashCode(); + + hash = cloudMap.value != null ? hash * 23 + cloudMap.overrideState.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; + hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); + hash = hash * 23 + enableCloudMotion.overrideState.GetHashCode(); + hash = hash * 23 + procedural.overrideState.GetHashCode(); + hash = hash * 23 + windDirection.overrideState.GetHashCode(); + hash = hash * 23 + windForce.overrideState.GetHashCode(); +#else + hash = cloudMap.value != null ? hash * 23 + cloudMap.GetHashCode() : hash; + hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; + hash = hash * 23 + upperHemisphereOnly.GetHashCode(); + hash = hash * 23 + enableCloudMotion.GetHashCode(); + hash = hash * 23 + procedural.GetHashCode(); + hash = hash * 23 + scrollDirection.GetHashCode(); + hash = hash * 23 + scrollSpeed.GetHashCode(); +#endif + } + + return hash; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs.meta new file mode 100644 index 00000000000..26c9804e9e1 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4df53429744a4174ca20efaba13fe1e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl new file mode 100644 index 00000000000..9e13a693a59 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -0,0 +1,81 @@ +#ifndef __CLOUDLAYER_H__ +#define __CLOUDLAYER_H__ + +TEXTURE2D(_CloudMap); +SAMPLER(sampler_CloudMap); + +TEXTURE2D(_CloudFlowmap); +SAMPLER(sampler_CloudFlowmap); + +float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direction (cosPhi and sinPhi) + +#define _CloudUpperHemisphere _CloudParam.x +#define _CloudScrollFactor _CloudParam.y +#define _CloudScrollDirection _CloudParam.zw + +#define USE_CLOUD_LAYER defined(USE_CLOUD_MAP) || (!defined(USE_CLOUD_MAP) && defined(USE_CLOUD_MOTION)) + +float3 sampleCloud(float3 dir, float3 sky) +{ + float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); + return lerp(sky, cloudLayerColor.rgb, cloudLayerColor.a); +} + +float3 CloudRotationUp(float3 p, float2 cos_sin) +{ + float3 rotDirX = float3(cos_sin.x, 0, -cos_sin.y); + float3 rotDirY = float3(cos_sin.y, 0, cos_sin.x); + + return float3(dot(rotDirX, p), p.y, dot(rotDirY, p)); +} + +float3 GetDistordedCloudColor(float3 dir, float3 sky) +{ +#if USE_CLOUD_MOTION + if (dir.y >= 0 || !_CloudUpperHemisphere) + { + float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); + float3 bitangent = cross(tangent, dir); + + // Compute flow factor + float3 windDir = CloudRotationUp(dir, _CloudScrollDirection); +#ifdef USE_CLOUD_MAP + float2 flow = SAMPLE_TEXTURE2D_LOD(_CloudFlowmap, sampler_CloudFlowmap, GetLatLongCoords(windDir, _CloudUpperHemisphere), 0).rg * 2.0 - 1.0; +#else + float2 flow = GenerateFlow(windDir); +#endif + + float2 alpha = frac(float2(_CloudScrollFactor, _CloudScrollFactor + 0.5)) - 0.5; + + float2 uv1 = alpha.x * flow; + float2 uv2 = alpha.y * flow; + + float3 dd1 = uv1.x * tangent + uv1.y * bitangent; //dd1.y = abs(dd1.y); + float3 dd2 = uv2.x * tangent + uv2.y * bitangent; //dd2.y = abs(dd2.y); + + // Sample twice + float3 color1 = sampleCloud(dir + dd1, sky); + float3 color2 = sampleCloud(dir + dd2, sky); + + // Blend color samples + sky = lerp(color1, color2, abs(2.0 * alpha.x)); + } +#else + float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); + sky = lerp(sky, cloudLayerColor.rgb, cloudLayerColor.a); +#endif + + return sky; +} + +float3 ApplyCloudLayer(float3 dir, float3 sky) +{ +#if USE_CLOUD_LAYER + if (dir.y >= 0 || !_CloudUpperHemisphere) + sky = GetDistordedCloudColor(dir, sky); +#endif + + return sky; +} + +#endif // __CLOUDLAYER_H__ diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl.meta b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl.meta new file mode 100644 index 00000000000..864ea5444f8 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 6ed84b23a96bc804c8c32740c6fa7ed7 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs index 79cdda8c34f..8d224f16b01 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs @@ -12,6 +12,7 @@ class GradientSkyRenderer : SkyRenderer public GradientSkyRenderer() { + SupportDynamicSunLight = false; } public override void Build() diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index bb1048d1b66..8e0cdf10c45 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -13,6 +13,9 @@ Shader "Hidden/HDRP/Sky/HDRISky" #pragma multi_compile_local _ SKY_MOTION #pragma multi_compile_local _ USE_FLOWMAP + #pragma multi_compile_local _ USE_CLOUD_MAP + #pragma multi_compile_local _ USE_CLOUD_MOTION + #pragma multi_compile _ DEBUG_DISPLAY #pragma multi_compile SHADOW_LOW SHADOW_MEDIUM SHADOW_HIGH @@ -34,6 +37,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/SDF2D.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" @@ -220,7 +224,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 GetSkyColor(float3 dir) { - return GetDistordedSkyColor(dir); + float3 sky = GetDistordedSkyColor(dir); + return ApplyCloudLayer(dir, sky); } float4 GetColorWithRotation(float3 dir, float exposure, float2 cos_sin) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 8d451cafbfc..573c4321182 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -16,6 +16,7 @@ class HDRISkyRenderer : SkyRenderer public HDRISkyRenderer() { + SupportDynamicSunLight = false; } public override void Build() @@ -153,6 +154,14 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo else m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); + if (builtinParams.cloudLayer != null) + builtinParams.cloudLayer.Render(m_SkyHDRIMaterial); + else + { + m_SkyHDRIMaterial.DisableKeyword("USE_CLOUD_MAP"); + m_SkyHDRIMaterial.DisableKeyword("USE_CLOUD_MOTION"); + } + m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters0, GetBackplateParameters0(hdriSky)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index 52bb03f685c..56acbb50a35 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -65,6 +65,8 @@ public class BuiltinSkyParameters public int frameIndex; /// Current sky settings. public SkySettings skySettings; + /// Current cloud layer. + public CloudLayer cloudLayer; /// Current debug dsplay settings. public DebugDisplaySettings debugSettings; /// Null color buffer render target identifier. @@ -646,9 +648,13 @@ bool IsCachedContextValid(SkyUpdateContext skyContext) int ComputeSkyHash(HDCamera camera, SkyUpdateContext skyContext, Light sunLight, SkyAmbientMode ambientMode, bool staticSky = false) { int sunHash = 0; - if (sunLight != null) + if (sunLight != null && skyContext.skyRenderer.SupportDynamicSunLight) sunHash = GetSunLightHashCode(sunLight); + int cloudHash = 0; + if (skyContext.cloudLayer != null && skyContext.skyRenderer.SupportCloudLayer) + cloudHash = skyContext.cloudLayer.GetHashCode(); + // For planar reflections we want to use the parent position for hash. Camera cameraForHash = camera.camera; if (camera.camera.cameraType == CameraType.Reflection && camera.parentCamera != null) @@ -657,6 +663,7 @@ int ComputeSkyHash(HDCamera camera, SkyUpdateContext skyContext, Light sunLight, } int skyHash = sunHash * 23 + skyContext.skySettings.GetHashCode(cameraForHash); + skyHash = skyHash * 23 + cloudHash; skyHash = skyHash * 23 + (staticSky ? 1 : 0); skyHash = skyHash * 23 + (ambientMode == SkyAmbientMode.Static ? 1 : 0); return skyHash; @@ -708,6 +715,7 @@ public void UpdateEnvironment( HDCamera hdCamera, m_BuiltinParameters.debugSettings = null; // We don't want any debug when updating the environment. m_BuiltinParameters.frameIndex = frameIndex; m_BuiltinParameters.skySettings = skyContext.skySettings; + m_BuiltinParameters.cloudLayer = skyContext.cloudLayer; int skyHash = ComputeSkyHash(hdCamera, skyContext, sunLight, ambientMode, staticSky); bool forceUpdate = updateRequired; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs index 2c6df35695d..fc28deebc04 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs @@ -7,6 +7,9 @@ public abstract class SkyRenderer { int m_LastFrameUpdate = -1; + public bool SupportDynamicSunLight = true; + public bool SupportCloudLayer = true; + /// /// Called on startup. Create resources used by the renderer (shaders, materials, etc). /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs index 3ae3591daa4..8055eae485e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs @@ -6,6 +6,7 @@ internal class SkyUpdateContext { SkySettings m_SkySettings; public SkyRenderer skyRenderer { get; private set; } + public CloudLayer cloudLayer = null; public int cachedSkyRenderingContextId = -1; public int skyParametersHash = -1; From 8aedb3974adf60f24e09ffe640672b39e61e2a9c Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 27 Apr 2020 16:33:04 +0200 Subject: [PATCH 23/44] CloudLayer Gradient --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 5 ++--- .../Runtime/Sky/GradientSky/GradientSky.shader | 9 +++++++-- .../Runtime/Sky/GradientSky/GradientSkyRenderer.cs | 8 ++++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index be357f7fdb9..3aa8ffd45a6 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added Min distance to contact shadows. - Added support for Depth of Field in path tracing (by sampling the lens aperture). - Added a flow map parameter to HDRI Sky +- Added a Cloud Layer volume override. ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index 9e13a693a59..b5ce27a2357 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -61,11 +61,10 @@ float3 GetDistordedCloudColor(float3 dir, float3 sky) sky = lerp(color1, color2, abs(2.0 * alpha.x)); } #else - float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); - sky = lerp(sky, cloudLayerColor.rgb, cloudLayerColor.a); + sky = sampleCloud(dir, sky); #endif - return sky; + return sky; } float3 ApplyCloudLayer(float3 dir, float3 sky) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader index 6c9f6999425..fd1c1c7907d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSky.shader @@ -8,11 +8,15 @@ Shader "Hidden/HDRP/Sky/GradientSky" #pragma target 4.5 #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_local _ USE_CLOUD_MAP + #pragma multi_compile_local _ USE_CLOUD_MOTION + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl" float4 _GradientBottom; float4 _GradientMiddle; @@ -48,8 +52,9 @@ Shader "Hidden/HDRP/Sky/GradientSky" float topLerpFactor = saturate(-verticalGradient); float bottomLerpFactor = saturate(verticalGradient); float3 color = lerp(_GradientMiddle.xyz, _GradientBottom.xyz, bottomLerpFactor); - color = lerp(color, _GradientTop.xyz, topLerpFactor) * _SkyIntensity; - return float4(color, 1.0); + color = lerp(color, _GradientTop.xyz, topLerpFactor); + color = ApplyCloudLayer(-viewDirWS, color); + return float4(color * _SkyIntensity, 1.0); } float4 FragBaking(Varyings input) : SV_Target diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs index 8d224f16b01..b1767d0febf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs @@ -35,6 +35,14 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo m_GradientSkyMaterial.SetFloat(_GradientDiffusion, gradientSky.gradientDiffusion.value); m_GradientSkyMaterial.SetFloat(HDShaderIDs._SkyIntensity, GetSkyIntensity(gradientSky, builtinParams.debugSettings)); + if (builtinParams.cloudLayer != null) + builtinParams.cloudLayer.Render(m_GradientSkyMaterial); + else + { + m_GradientSkyMaterial.DisableKeyword("USE_CLOUD_MAP"); + m_GradientSkyMaterial.DisableKeyword("USE_CLOUD_MOTION"); + } + // This matrix needs to be updated at the draw call frequency. m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); From 1371f36263fb64b3a85a3b94cb0e9efaf10aa6a5 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 28 Apr 2020 12:18:17 +0200 Subject: [PATCH 24/44] CloudLayer Physically Based --- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 5 ++++- .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 7 ++++--- .../Runtime/Sky/GradientSky/GradientSkyRenderer.cs | 2 +- .../Runtime/Sky/HDRISky/HDRISky.shader | 4 ++-- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 2 +- .../Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader | 5 +++++ .../Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs | 8 ++++++++ 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 666707590b3..45b2ecd0fa4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -52,7 +52,10 @@ public Vector4 GetParameters() return new Vector4(upperHemisphereOnly.value ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); } - public void Render(Material skyMaterial) + /// + /// Sets keywords and parameters on a sky material to render the cloud layer. + /// + public void Apply(Material skyMaterial) { Vector4 cloudParam = GetParameters(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index b5ce27a2357..62745ba3b5b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -18,7 +18,8 @@ float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direc float3 sampleCloud(float3 dir, float3 sky) { float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); - return lerp(sky, cloudLayerColor.rgb, cloudLayerColor.a); + float f = max(sky.x, max(sky.y, max(sky.z, 1.0))); // factor to balance sky exposure, there may be a better solution + return lerp(sky, cloudLayerColor.rgb*f, cloudLayerColor.a); } float3 CloudRotationUp(float3 p, float2 cos_sin) @@ -50,8 +51,8 @@ float3 GetDistordedCloudColor(float3 dir, float3 sky) float2 uv1 = alpha.x * flow; float2 uv2 = alpha.y * flow; - float3 dd1 = uv1.x * tangent + uv1.y * bitangent; //dd1.y = abs(dd1.y); - float3 dd2 = uv2.x * tangent + uv2.y * bitangent; //dd2.y = abs(dd2.y); + float3 dd1 = uv1.x * tangent + uv1.y * bitangent; + float3 dd2 = uv2.x * tangent + uv2.y * bitangent; // Sample twice float3 color1 = sampleCloud(dir + dd1, sky); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs index b1767d0febf..c41a90b25d0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs @@ -36,7 +36,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo m_GradientSkyMaterial.SetFloat(HDShaderIDs._SkyIntensity, GetSkyIntensity(gradientSky, builtinParams.debugSettings)); if (builtinParams.cloudLayer != null) - builtinParams.cloudLayer.Render(m_GradientSkyMaterial); + builtinParams.cloudLayer.Apply(m_GradientSkyMaterial); else { m_GradientSkyMaterial.DisableKeyword("USE_CLOUD_MAP"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 8e0cdf10c45..3fa4b2b8d25 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -207,8 +207,8 @@ Shader "Hidden/HDRP/Sky/HDRISky" float2 uv1 = alpha.x * flow; float2 uv2 = alpha.y * flow; - float3 dd1 = uv1.x * tangent + uv1.y * bitangent; //dd1.y = abs(dd1.y); - float3 dd2 = uv2.x * tangent + uv2.y * bitangent; //dd2.y = abs(dd2.y); + float3 dd1 = uv1.x * tangent + uv1.y * bitangent; + float3 dd2 = uv2.x * tangent + uv2.y * bitangent; // Sample twice float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd1, 0).rgb; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 573c4321182..99f9cab0ca2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -155,7 +155,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); if (builtinParams.cloudLayer != null) - builtinParams.cloudLayer.Render(m_SkyHDRIMaterial); + builtinParams.cloudLayer.Apply(m_SkyHDRIMaterial); else { m_SkyHDRIMaterial.DisableKeyword("USE_CLOUD_MAP"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader index 299b583f8c1..96c0c2e12ad 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSky.shader @@ -9,12 +9,16 @@ Shader "Hidden/HDRP/Sky/PbrSky" #pragma target 4.5 #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_local _ USE_CLOUD_MAP + #pragma multi_compile_local _ USE_CLOUD_MOTION + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/AtmosphericScattering.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/CookieSampling.hlsl" @@ -221,6 +225,7 @@ Shader "Hidden/HDRP/Sky/PbrSky" } skyColor += radiance * (1 - skyOpacity); + skyColor = ApplyCloudLayer(-V, skyColor); skyColor *= _IntensityMultiplier; return float4(skyColor, 1.0); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs index b91015b7943..4bd486bc77e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs @@ -468,6 +468,14 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo int pass = (renderForCubemap ? 0 : 2) + (isPbrSkyActive ? 0 : 1); + if (builtinParams.cloudLayer != null) + builtinParams.cloudLayer.Apply(s_PbrSkyMaterial); + else + { + s_PbrSkyMaterial.DisableKeyword("USE_CLOUD_MAP"); + s_PbrSkyMaterial.DisableKeyword("USE_CLOUD_MOTION"); + } + CoreUtils.DrawFullScreen(builtinParams.commandBuffer, s_PbrSkyMaterial, s_PbrSkyMaterialProperties, pass); } } From 636ec05f1b8065e55c1603c6e234135a7c5b3cbf Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 28 Apr 2020 14:38:13 +0200 Subject: [PATCH 25/44] Documentation --- .../Documentation~/Creating-a-Custom-Sky.md | 8 +++- .../Images/Override-CloudLayer.png | 3 ++ .../Documentation~/Override-Cloud-Layer.md | 42 +++++++++++++++++++ .../Documentation~/Override-HDRI-Sky.md | 2 +- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 30 ++++++++----- .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 6 +++ .../Sky/GradientSky/GradientSkyRenderer.cs | 8 +--- .../Runtime/Sky/HDRISky/HDRISkyRenderer.cs | 10 +---- .../PhysicallyBasedSkyRenderer.cs | 8 +--- 9 files changed, 82 insertions(+), 35 deletions(-) create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md index a165bdddd69..38bc6a1f49d 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md @@ -153,6 +153,8 @@ class NewSkyRenderer : SkyRenderer m_PropertyBlock.SetVector(_SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); m_PropertyBlock.SetMatrix(_PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); + CloudLayer.Apply(builtinParams.cloudLayer, m_NewSkyMaterial); + CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_NewSkyMaterial, m_PropertyBlock, passID); } } @@ -177,10 +179,13 @@ Shader "Hidden/HDRP/Sky/NewSky" #pragma target 4.5 #pragma only_renderers d3d11 playstation xboxone vulkan metal switch + #pragma multi_compile_local _ USE_CLOUD_MAP + #pragma multi_compile_local _ USE_CLOUD_MOTION #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl" TEXTURECUBE(_Cubemap); SAMPLER(sampler_Cubemap); @@ -225,6 +230,7 @@ Shader "Hidden/HDRP/Sky/NewSky" { dir = RotationUp(dir, cos_sin); float3 skyColor = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb * _Intensity * exposure; + skyColor = ApplyCloudLayer(dir, skyColor); skyColor = ClampToFloat16Max(skyColor); return float4(skyColor, 1.0); @@ -286,4 +292,4 @@ Shader "Hidden/HDRP/Sky/NewSky" } ``` -**Note**: The NewSky example uses two passes, one that uses a Depth Test for rendering the sky in the background (so that geometry occludes it correctly), and the other that does not use a Depth Test and renders the sky into the reflection cubemap. \ No newline at end of file +**Note**: The NewSky example uses two passes, one that uses a Depth Test for rendering the sky in the background (so that geometry occludes it correctly), and the other that does not use a Depth Test and renders the sky into the reflection cubemap. diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png new file mode 100644 index 00000000000..6c1300f58ea --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf31ca2a40721e174fcfd5dea362ae4d774686ab7c879bf3779e6a8baf865122 +size 10751 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md new file mode 100644 index 00000000000..ea2edbaf77c --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md @@ -0,0 +1,42 @@ +# Cloud Layer + +The **Cloud Layer** Volume component override controls an optional cloud layer you can add on top of any Sky. The cloud layer is a 2D texture blended with the sky that can be animated using a flowmap. + +## Using Cloud Layer + +The **Cloud Layer** uses the [Volume](Volumes.html) framework, so to enable and modify **Cloud Layer** properties, you must add a **Cloud Layer** override to a [Volume](Volumes.html) in your Scene. To add **Cloud Layer** to a Volume: + +1. In the Scene or Hierarchy view, select a GameObject that contains a Volume component to view it in the Inspector. +2. In the Inspector, navigate to **Add Override > Sky** and click on **Cloud Layer**. + +After you add a **Cloud Layer** override, you must enable it in the override itself. In the override, Check the **Enable** property. HDRP now renders **Cloud Layer** for any Camera this Volume affects. + + + +## Customizing the Cloud Map + +The Cloud Map is a 2D texture in LatLong layout (sometimes called Cylindrical or Equirectangular) that contains cloud color in the RGB channel and cloud coverage in the alpha channel. +If **Upper Hemisphere Only** is checked, the map is interpreted as being the upper half of a LatLong texture. +In that case, it is recommended to set the **Wrap Mode** to **Clamp** in the texture import settings to avoid artifacts above the horizon. + + + +## Customizing the Flowmap + +The Flowmap must have the same layout as the cloud map, and is also subject to the **Upper Hemisphere Only** property. +Only the red and green channel are used and they represent respectively horizontal and vertical displacement. For each of these channels, a value of `0.5` means no displacement, a value of `0` means a negative displacement and a value of `1` means a positive displacement. + +## Properties + +![](Images/Override-CloudLayer.png) + +| Property | Description | +| ----------------------------- | ------------------------------------------------------------ | +| **Enable** | Enables the cloud layer. | +| **Cloud Map* | Assign a Texture that HDRP uses to render the cloud layer. Refer to the section [Customizing the Cloud Map](#CustomizingCloudMap) for more details. | +| **Upper Hemisphere Only** | Check the box if the cloud layer is to be applied above the horizon only. | +| **Cloud Motion** | Enable or disable cloud motion using UV distortion. | +| - **Procedural distortion** | Check the box to distort the clouds using a uniform wind direction. | +| -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the clouds. Only available if **Procedural is unchecked. Refer to the section [Customizing the Flowmap](#CustomizingFlowmap) for more details. | +| - **Scroll direction** | Use the slider to set the scrolling direction for the distortion. | +| - **Scroll speed** | Modify the speed at which HDRP scrolls the distortion texture. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md index 8eb35bf7380..47d88caa2c0 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md @@ -26,7 +26,7 @@ After you add an **HDRI Sky** override, you must set the Volume to use **HDRI Sk | - **Procedural distortion** | Check the box to distort the sky using a uniform wind direction. | | -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the sky. Only available if **Procedural is unchecked. | | -- **Upper Hemisphere Only** | Check the box if the flowmap contains distortion for the sky above the horizon only. Only available if **Procedural is unchecked. | -| - **Scroll direction** | Use the slider to set the scrolling directio for the distortion, in degrees. | +| - **Scroll direction** | Use the slider to set the scrolling direction for the distortion. | | - **Scroll speed** | Modify the speed at which HDRP scrolls the distortion texture. | | **Intensity Mode** | Use the drop-down to select the method that HDRP uses to calculate the sky intensity.
• **Exposure**: HDRP calculates intensity from an exposure value in EV100.
• **Multiplier**: HDRP calculates intensity from a flat multiplier.
• **Lux**: HDRP calculates intensity in terms of a target Lux value. | | - **Exposure** | Set the amount of light per unit area that HDRP applies to the HDRI Sky cubemap.
This property only appears when you select **Exposure** from the **Intensity Mode** drop-down. | diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 45b2ecd0fa4..8116633844c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -55,24 +55,32 @@ public Vector4 GetParameters() /// /// Sets keywords and parameters on a sky material to render the cloud layer. /// - public void Apply(Material skyMaterial) + public static void Apply(CloudLayer layer, Material skyMaterial) { - Vector4 cloudParam = GetParameters(); + if (layer != null) + { + Vector4 cloudParam = layer.GetParameters(); - skyMaterial.EnableKeyword("USE_CLOUD_MAP"); - skyMaterial.SetTexture(HDShaderIDs._CloudMap, cloudMap.value); - skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); + skyMaterial.EnableKeyword("USE_CLOUD_MAP"); + skyMaterial.SetTexture(HDShaderIDs._CloudMap, layer.cloudMap.value); + skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); - if (enableCloudMotion.value == true) - { - skyMaterial.EnableKeyword("USE_CLOUD_MOTION"); - if (procedural.value == true) - skyMaterial.DisableKeyword("USE_CLOUD_MAP"); + if (layer.enableCloudMotion.value == true) + { + skyMaterial.EnableKeyword("USE_CLOUD_MOTION"); + if (layer.procedural.value == true) + skyMaterial.DisableKeyword("USE_CLOUD_MAP"); + else + skyMaterial.SetTexture(HDShaderIDs._CloudFlowmap, layer.flowmap.value); + } else - skyMaterial.SetTexture(HDShaderIDs._CloudFlowmap, flowmap.value); + skyMaterial.DisableKeyword("USE_CLOUD_MOTION"); } else + { + skyMaterial.DisableKeyword("USE_CLOUD_MAP"); skyMaterial.DisableKeyword("USE_CLOUD_MOTION"); + } } /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index 62745ba3b5b..0f075d0294e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -78,4 +78,10 @@ float3 ApplyCloudLayer(float3 dir, float3 sky) return sky; } +#undef _CloudUpperHemisphere +#undef _CloudScrollFactor +#undef _CloudScrollDirection + +#undef USE_CLOUD_LAYER + #endif // __CLOUDLAYER_H__ diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs index c41a90b25d0..0ca6941d630 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/GradientSky/GradientSkyRenderer.cs @@ -35,13 +35,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo m_GradientSkyMaterial.SetFloat(_GradientDiffusion, gradientSky.gradientDiffusion.value); m_GradientSkyMaterial.SetFloat(HDShaderIDs._SkyIntensity, GetSkyIntensity(gradientSky, builtinParams.debugSettings)); - if (builtinParams.cloudLayer != null) - builtinParams.cloudLayer.Apply(m_GradientSkyMaterial); - else - { - m_GradientSkyMaterial.DisableKeyword("USE_CLOUD_MAP"); - m_GradientSkyMaterial.DisableKeyword("USE_CLOUD_MOTION"); - } + CloudLayer.Apply(builtinParams.cloudLayer, m_GradientSkyMaterial); // This matrix needs to be updated at the draw call frequency. m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs index 99f9cab0ca2..6c79e66e5dd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISkyRenderer.cs @@ -154,14 +154,6 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo else m_SkyHDRIMaterial.DisableKeyword("SKY_MOTION"); - if (builtinParams.cloudLayer != null) - builtinParams.cloudLayer.Apply(m_SkyHDRIMaterial); - else - { - m_SkyHDRIMaterial.DisableKeyword("USE_CLOUD_MAP"); - m_SkyHDRIMaterial.DisableKeyword("USE_CLOUD_MOTION"); - } - m_SkyHDRIMaterial.SetTexture(HDShaderIDs._Cubemap, hdriSky.hdriSky.value); m_SkyHDRIMaterial.SetVector(HDShaderIDs._SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); m_SkyHDRIMaterial.SetVector(HDShaderIDs._BackplateParameters0, GetBackplateParameters0(hdriSky)); @@ -177,6 +169,8 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo shadowFilter |= unchecked((uint)LightFeatureFlags.Area); m_SkyHDRIMaterial.SetInt(HDShaderIDs._BackplateShadowFilter, unchecked((int)shadowFilter)); + CloudLayer.Apply(builtinParams.cloudLayer, m_SkyHDRIMaterial); + // This matrix needs to be updated at the draw call frequency. m_PropertyBlock.SetMatrix(HDShaderIDs._PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_SkyHDRIMaterial, m_PropertyBlock, passID); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs index 4bd486bc77e..4cbb7f8c7f7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/PhysicallyBasedSky/PhysicallyBasedSkyRenderer.cs @@ -468,13 +468,7 @@ public override void RenderSky(BuiltinSkyParameters builtinParams, bool renderFo int pass = (renderForCubemap ? 0 : 2) + (isPbrSkyActive ? 0 : 1); - if (builtinParams.cloudLayer != null) - builtinParams.cloudLayer.Apply(s_PbrSkyMaterial); - else - { - s_PbrSkyMaterial.DisableKeyword("USE_CLOUD_MAP"); - s_PbrSkyMaterial.DisableKeyword("USE_CLOUD_MOTION"); - } + CloudLayer.Apply(builtinParams.cloudLayer, s_PbrSkyMaterial); CoreUtils.DrawFullScreen(builtinParams.commandBuffer, s_PbrSkyMaterial, s_PbrSkyMaterialProperties, pass); } From 86b1e9bb2195cbfa9e0ab4916d077c02c8e96d78 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 29 Apr 2020 12:40:07 +0200 Subject: [PATCH 26/44] Add clouds to Static Lighting Sky --- .../Runtime/RenderPipeline/Camera/HDCamera.cs | 4 +- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 2 +- .../Runtime/Sky/SkyManager.cs | 2 + .../Runtime/Sky/StaticLightingSky.cs | 88 ++++++++++++++++++- 4 files changed, 91 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index 82a21379212..89dce196649 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -748,9 +748,7 @@ internal void UpdateCurrentSky(SkyManager skyManager) skyAmbientMode = volumeStack.GetComponent().skyAmbientMode.value; visualSky.skySettings = SkyManager.GetSkySetting(volumeStack); - - var cloudLayer = volumeStack.GetComponent(); - visualSky.cloudLayer = (cloudLayer != null && cloudLayer.enabled.value) ? cloudLayer : null; + visualSky.cloudLayer = volumeStack.GetComponent(); // Now, see if we have a lighting override // Update needs to happen before testing if the component is active other internal data structure are not properly updated yet. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 8116633844c..9e1a309e57d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -57,7 +57,7 @@ public Vector4 GetParameters() /// public static void Apply(CloudLayer layer, Material skyMaterial) { - if (layer != null) + if (layer != null && layer.enabled.value == true) { Vector4 cloudParam = layer.GetParameters(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index 89604a78e5a..61c0e21e2a4 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -812,6 +812,7 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC if (staticLightingSky != null) { m_StaticLightingSky.skySettings = staticLightingSky.skySettings; + m_StaticLightingSky.cloudLayer = staticLightingSky.cloudLayer; UpdateEnvironment(hdCamera, renderContext, m_StaticLightingSky, sunLight, m_StaticSkyUpdateRequired, true, true, SkyAmbientMode.Static, frameIndex, cmd); m_StaticSkyUpdateRequired = false; } @@ -839,6 +840,7 @@ internal void UpdateBuiltinParameters(SkyUpdateContext skyContext, HDCamera hdCa m_BuiltinParameters.debugSettings = debugSettings; m_BuiltinParameters.frameIndex = frameIndex; m_BuiltinParameters.skySettings = skyContext.skySettings; + m_BuiltinParameters.cloudLayer = skyContext.cloudLayer; } public void PreRenderSky(HDCamera hdCamera, Light sunLight, RTHandle colorBuffer, RTHandle normalBuffer, RTHandle depthBuffer, DebugDisplaySettings debugSettings, int frameIndex, CommandBuffer cmd) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs index d2cb6061cc2..7638bb0d775 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs @@ -16,7 +16,7 @@ public class StaticLightingSky : MonoBehaviour VolumeProfile m_Profile; [SerializeField, FormerlySerializedAs("m_BakingSkyUniqueID")] int m_StaticLightingSkyUniqueID = 0; - int m_LastComputedHash; + int m_LastComputedHash, m_LastComputedCloudHash; bool m_NeedUpdateStaticLightingSky; SkySettings m_SkySettings; // This one contain only property values from overridden properties in the original profile component @@ -43,6 +43,29 @@ internal SkySettings skySettings List m_VolumeSkyList = new List(); + + CloudLayer m_CloudLayer; // This one contain only property values from overridden properties in the original profile component + CloudLayer m_CloudLayerFromProfile; + + internal CloudLayer cloudLayer + { + get + { + GetCloudFromVolume(m_Profile, out var cloudFromProfile); + if (cloudFromProfile != null) + { + int newHash = cloudFromProfile.GetHashCode(); + if (m_LastComputedCloudHash != newHash) + UpdateCurrentStaticLightingCloud(); + } + else + { + Reset(); + } + return m_CloudLayer; + } + } + /// /// Volume profile where the sky settings used for static lighting will be fetched. /// @@ -160,6 +183,64 @@ void UpdateCurrentStaticLightingSky() } } + void GetCloudFromVolume(VolumeProfile profile, out CloudLayer cloudLayer) + { + if (profile != null) + profile.TryGet(out cloudLayer); + else + cloudLayer = null; + } + + void UpdateCurrentStaticLightingCloud() + { + // First, grab the cloud layer of the right type in the profile. + CoreUtils.Destroy(m_CloudLayer); + m_CloudLayer = null; + m_LastComputedCloudHash = 0; + GetCloudFromVolume(m_Profile, out m_CloudLayerFromProfile); + + if (m_CloudLayerFromProfile != null) + { + // The static lighting sky is a Volume Component that lives outside of the volume system (we just grab a component from a profile) + // As such, it may contain values that are not actually overridden + // For example, user overrides a value, change it, and disable overrides. In this case the volume still contains the old overridden value + // In this case, we want to use values only if they are still overridden, so we create a volume component with default values and then copy the overridden values from the profile. + // Also, a default profile might be set in the HDRP project settings, this volume is applied by default to all the scene so it should also be taken into account here. + + // Create an instance with default values + m_CloudLayer = ScriptableObject.CreateInstance(); + var newCloudParameters = m_CloudLayer.parameters; + var profileCloudParameters = m_CloudLayerFromProfile.parameters; + + var defaultVolume = HDRenderPipeline.GetOrCreateDefaultVolume(); + defaultVolume.sharedProfile.TryGet(out CloudLayer defaultCloud); + var defaultCloudParameters = defaultCloud != null ? defaultCloud.parameters : null; // Can be null if the profile does not contain the component. + + // Seems to inexplicably happen sometimes on domain reload. + if (profileCloudParameters == null) + return; + + int parameterCount = m_CloudLayer.parameters.Count; + // Copy overridden parameters. + for (int i = 0; i < parameterCount; ++i) + { + if (profileCloudParameters[i].overrideState == true) + { + newCloudParameters[i].SetValue(profileCloudParameters[i]); + } + // Fallback to the default profile if values are overridden in there. + else if (defaultCloudParameters != null && defaultCloudParameters[i].overrideState == true) + { + newCloudParameters[i].SetValue(defaultCloudParameters[i]); + } + } + + m_LastComputedCloudHash = m_CloudLayerFromProfile.GetHashCode(); + } + } + + + // 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() { @@ -217,6 +298,11 @@ void Reset() m_SkySettings = null; m_SkySettingsFromProfile = null; m_LastComputedHash = 0; + + CoreUtils.Destroy(m_CloudLayer); + m_CloudLayer = null; + m_CloudLayerFromProfile = null; + m_LastComputedCloudHash = 0; } } } From 48c8923bbb3de668c59776b2fcace2ad943d5498 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 29 Apr 2020 17:06:50 +0200 Subject: [PATCH 27/44] Fix spherical conversion --- .../Runtime/Sky/SkyUtils.hlsl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index 471ed627a6a..045471d99ac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -20,10 +20,11 @@ float3 GetSkyViewDirWS(float2 positionCS) // Returns latlong coords from view direction float2 GetLatLongCoords(float3 dir, float upperHemisphereOnly) { - float angle = atan2(dir.z, dir.x)/(2.0*PI) + 0.5; - float height = lerp(dir.y * 0.5 + 0.5, dir.y, upperHemisphereOnly); - - return float2(angle, height); + const float2 invAtan = float2(0.1591, 0.3183); + float2 uv = float2(atan2(dir.x, dir.z), asin(dir.y)); + uv = uv * invAtan + 0.5; + uv.y = lerp(uv.y, uv.y * 2.0 - 1.0, upperHemisphereOnly); + return uv; } // Generates a flow for a constant wind in the z direction From 6fc396fa637df6abbb3cf17dde7a828f6bfff57a Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 30 Apr 2020 16:28:47 +0200 Subject: [PATCH 28/44] Fix procedural flow --- .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 22 ++++++++++--------- .../Runtime/Sky/HDRISky/HDRISky.shader | 16 ++++++++------ .../Runtime/Sky/SkyUtils.hlsl | 8 ------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index 0f075d0294e..dd60db5c5aa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -35,31 +35,33 @@ float3 GetDistordedCloudColor(float3 dir, float3 sky) #if USE_CLOUD_MOTION if (dir.y >= 0 || !_CloudUpperHemisphere) { + float2 alpha = frac(float2(_CloudScrollFactor, _CloudScrollFactor + 0.5)) - 0.5; + +#ifdef USE_CLOUD_MAP float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); float3 bitangent = cross(tangent, dir); - // Compute flow factor float3 windDir = CloudRotationUp(dir, _CloudScrollDirection); -#ifdef USE_CLOUD_MAP float2 flow = SAMPLE_TEXTURE2D_LOD(_CloudFlowmap, sampler_CloudFlowmap, GetLatLongCoords(windDir, _CloudUpperHemisphere), 0).rg * 2.0 - 1.0; -#else - float2 flow = GenerateFlow(windDir); -#endif - - float2 alpha = frac(float2(_CloudScrollFactor, _CloudScrollFactor + 0.5)) - 0.5; float2 uv1 = alpha.x * flow; float2 uv2 = alpha.y * flow; float3 dd1 = uv1.x * tangent + uv1.y * bitangent; float3 dd2 = uv2.x * tangent + uv2.y * bitangent; +#else + float3 windDir = CloudRotationUp(float3(0, 0, 1), _CloudScrollDirection); + + float3 dd1 = alpha.x*windDir*sin(dir.y*PI*0.5)*1; + float3 dd2 = alpha.y*windDir*sin(dir.y*PI*0.5)*1; +#endif // Sample twice - float3 color1 = sampleCloud(dir + dd1, sky); - float3 color2 = sampleCloud(dir + dd2, sky); + float3 color1 = sampleCloud(normalize(dir + dd1), sky); + float3 color2 = sampleCloud(normalize(dir + dd2), sky); // Blend color samples - sky = lerp(color1, color2, abs(2.0 * alpha.x)); + return lerp(color1, color2, abs(2.0 * alpha.x)); } #else sky = sampleCloud(dir, sky); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 3fa4b2b8d25..e17d4e0ad4a 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -191,24 +191,26 @@ Shader "Hidden/HDRP/Sky/HDRISky" #if SKY_MOTION if (dir.y >= 0 || !_UpperHemisphere) { + float2 alpha = frac(float2(_ScrollFactor, _ScrollFactor + 0.5)) - 0.5; + +#ifdef USE_FLOWMAP float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); float3 bitangent = cross(tangent, dir); - // Compute flow factor float3 windDir = RotationUp(dir, _ScrollDirection); -#ifdef USE_FLOWMAP float2 flow = SAMPLE_TEXTURE2D_LOD(_Flowmap, sampler_Flowmap, GetLatLongCoords(windDir, _UpperHemisphere), 0).rg * 2.0 - 1.0; -#else - float2 flow = GenerateFlow(windDir); -#endif - - float2 alpha = frac(float2(_ScrollFactor, _ScrollFactor + 0.5)) - 0.5; float2 uv1 = alpha.x * flow; float2 uv2 = alpha.y * flow; float3 dd1 = uv1.x * tangent + uv1.y * bitangent; float3 dd2 = uv2.x * tangent + uv2.y * bitangent; +#else + float3 windDir = RotationUp(float3(0, 0, 1), _ScrollDirection); + + float3 dd1 = alpha.x*windDir*dir.y*1; + float3 dd2 = alpha.y*windDir*dir.y*1; +#endif // Sample twice float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd1, 0).rgb; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index 045471d99ac..5bfe30e43c9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -27,12 +27,4 @@ float2 GetLatLongCoords(float3 dir, float upperHemisphereOnly) return uv; } -// Generates a flow for a constant wind in the z direction -// source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic -float2 GenerateFlow(float3 dir) -{ - float3 d = float3(0, 1, 0) - dir; - return (dir.y > 0) * normalize(d - dot(d, dir) * dir).zx; -} - #endif // __SKYUTILS_H__ From 10a8b0378bca4658219f5e29fe68bd55c2145240 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Mon, 4 May 2020 10:32:30 +0200 Subject: [PATCH 29/44] Fix lat long and procedural flow --- .../Documentation~/Override-HDRI-Sky.md | 2 +- .../Runtime/Sky/HDRISky/HDRISky.shader | 26 ++++++++----------- .../Runtime/Sky/SkyUtils.hlsl | 17 ++++-------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md index 8eb35bf7380..47d88caa2c0 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-HDRI-Sky.md @@ -26,7 +26,7 @@ After you add an **HDRI Sky** override, you must set the Volume to use **HDRI Sk | - **Procedural distortion** | Check the box to distort the sky using a uniform wind direction. | | -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the sky. Only available if **Procedural is unchecked. | | -- **Upper Hemisphere Only** | Check the box if the flowmap contains distortion for the sky above the horizon only. Only available if **Procedural is unchecked. | -| - **Scroll direction** | Use the slider to set the scrolling directio for the distortion, in degrees. | +| - **Scroll direction** | Use the slider to set the scrolling direction for the distortion. | | - **Scroll speed** | Modify the speed at which HDRP scrolls the distortion texture. | | **Intensity Mode** | Use the drop-down to select the method that HDRP uses to calculate the sky intensity.
• **Exposure**: HDRP calculates intensity from an exposure value in EV100.
• **Multiplier**: HDRP calculates intensity from a flat multiplier.
• **Lux**: HDRP calculates intensity in terms of a target Lux value. | | - **Exposure** | Set the amount of light per unit area that HDRP applies to the HDRI Sky cubemap.
This property only appears when you select **Exposure** from the **Intensity Mode** drop-down. | diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index bb1048d1b66..6e09d3a0e1f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -187,28 +187,24 @@ Shader "Hidden/HDRP/Sky/HDRISky" #if SKY_MOTION if (dir.y >= 0 || !_UpperHemisphere) { - float3 tangent = cross(dir, float3(0.0, 1.0, 0.0)); - float3 bitangent = cross(tangent, dir); + float2 alpha = frac(float2(_ScrollFactor, _ScrollFactor + 0.5)) - 0.5; - // Compute flow factor - float3 windDir = RotationUp(dir, _ScrollDirection); #ifdef USE_FLOWMAP + float3 tangent = normalize(cross(dir, float3(0.0, 1.0, 0.0))); + float3 bitangent = normalize(cross(tangent, dir)); + + float3 windDir = RotationUp(dir, _ScrollDirection); float2 flow = SAMPLE_TEXTURE2D_LOD(_Flowmap, sampler_Flowmap, GetLatLongCoords(windDir, _UpperHemisphere), 0).rg * 2.0 - 1.0; + + float3 dd = flow.x * tangent + flow.y * bitangent; #else - float2 flow = GenerateFlow(windDir); + float3 windDir = RotationUp(float3(0, 0, 1), _ScrollDirection); + float3 dd = windDir*sin(dir.y*PI*0.5); #endif - float2 alpha = frac(float2(_ScrollFactor, _ScrollFactor + 0.5)) - 0.5; - - float2 uv1 = alpha.x * flow; - float2 uv2 = alpha.y * flow; - - float3 dd1 = uv1.x * tangent + uv1.y * bitangent; //dd1.y = abs(dd1.y); - float3 dd2 = uv2.x * tangent + uv2.y * bitangent; //dd2.y = abs(dd2.y); - // Sample twice - float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd1, 0).rgb; - float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + dd2, 0).rgb; + float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + alpha.x*dd, 0).rgb; + float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + alpha.y*dd, 0).rgb; // Blend color samples return lerp(color1, color2, abs(2.0 * alpha.x)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index 471ed627a6a..5bfe30e43c9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -20,18 +20,11 @@ float3 GetSkyViewDirWS(float2 positionCS) // Returns latlong coords from view direction float2 GetLatLongCoords(float3 dir, float upperHemisphereOnly) { - float angle = atan2(dir.z, dir.x)/(2.0*PI) + 0.5; - float height = lerp(dir.y * 0.5 + 0.5, dir.y, upperHemisphereOnly); - - return float2(angle, height); -} - -// Generates a flow for a constant wind in the z direction -// source: https://www.gdcvault.com/play/1020146/Moving-the-Heavens-An-Artistic -float2 GenerateFlow(float3 dir) -{ - float3 d = float3(0, 1, 0) - dir; - return (dir.y > 0) * normalize(d - dot(d, dir) * dir).zx; + const float2 invAtan = float2(0.1591, 0.3183); + float2 uv = float2(atan2(dir.x, dir.z), asin(dir.y)); + uv = uv * invAtan + 0.5; + uv.y = lerp(uv.y, uv.y * 2.0 - 1.0, upperHemisphereOnly); + return uv; } #endif // __SKYUTILS_H__ From baab0522b0ba0f920779416c601ed4a63ef46645 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 6 May 2020 11:03:41 +0200 Subject: [PATCH 30/44] replace trig functions. Correct wind dir --- .../Runtime/Sky/HDRISky/HDRISky.shader | 8 +++++--- .../Runtime/Sky/SkyUtils.hlsl | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 6e09d3a0e1f..3f111e14588 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -191,7 +191,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" #ifdef USE_FLOWMAP float3 tangent = normalize(cross(dir, float3(0.0, 1.0, 0.0))); - float3 bitangent = normalize(cross(tangent, dir)); + float3 bitangent = cross(tangent, dir); float3 windDir = RotationUp(dir, _ScrollDirection); float2 flow = SAMPLE_TEXTURE2D_LOD(_Flowmap, sampler_Flowmap, GetLatLongCoords(windDir, _UpperHemisphere), 0).rg * 2.0 - 1.0; @@ -199,16 +199,18 @@ Shader "Hidden/HDRP/Sky/HDRISky" float3 dd = flow.x * tangent + flow.y * bitangent; #else float3 windDir = RotationUp(float3(0, 0, 1), _ScrollDirection); + windDir.x *= -1.0; float3 dd = windDir*sin(dir.y*PI*0.5); #endif // Sample twice - float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + alpha.x*dd, 0).rgb; - float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir + alpha.y*dd, 0).rgb; + float3 color1 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir - alpha.x*dd, 0).rgb; + float3 color2 = SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir - alpha.y*dd, 0).rgb; // Blend color samples return lerp(color1, color2, abs(2.0 * alpha.x)); } + else #endif return SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl index 5bfe30e43c9..2fa34dfff56 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl @@ -21,9 +21,10 @@ float3 GetSkyViewDirWS(float2 positionCS) float2 GetLatLongCoords(float3 dir, float upperHemisphereOnly) { const float2 invAtan = float2(0.1591, 0.3183); - float2 uv = float2(atan2(dir.x, dir.z), asin(dir.y)); - uv = uv * invAtan + 0.5; - uv.y = lerp(uv.y, uv.y * 2.0 - 1.0, upperHemisphereOnly); + + float fastATan2 = FastATan(dir.x/dir.z) + (dir.z <= 0.0) * sign(dir.x) * PI; + float2 uv = float2(fastATan2, FastASin(dir.y)) * invAtan + 0.5; + uv.y = upperHemisphereOnly ? uv.y * 2.0 - 1.0 : uv.y; return uv; } From fbf711c042c157b3e776cb618369ed5116947713 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 13 May 2020 11:55:52 +0200 Subject: [PATCH 31/44] sync with hdri flow --- .../Editor/Sky/CloudLayer/CloudLayerEditor.cs | 2 +- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs index 6a4465af83e..74b9b1e7d3a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs @@ -29,7 +29,7 @@ public override void OnEnable() m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); m_CloudMap = Unpack(o.Find(x => x.cloudMap)); - m_EnableCloudMotion = Unpack(o.Find(x => x.enableCloudMotion)); + m_EnableCloudMotion = Unpack(o.Find(x => x.enableDistortion)); m_Procedural = Unpack(o.Find(x => x.procedural)); m_Flowmap = Unpack(o.Find(x => x.flowmap)); m_ScrollDirection = Unpack(o.Find(x => x.scrollDirection)); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 9e1a309e57d..a312e5e1a6f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -20,9 +20,9 @@ public class CloudLayer : VolumeComponent [Tooltip("Check this box if the cloud layer covers only the upper part of the sky.")] public BoolParameter upperHemisphereOnly = new BoolParameter(true); - /// Enable to have cloud motion. - [Tooltip("Enable or disable cloud motion.")] - public BoolParameter enableCloudMotion = new BoolParameter(false); + /// Enable to have cloud distortion. + [Tooltip("Enable or disable cloud distortion.")] + public BoolParameter enableDistortion = new BoolParameter(false); /// Enable to have a simple, procedural distorsion. [Tooltip("If enabled, the clouds will be distorted by a constant wind.")] public BoolParameter procedural = new BoolParameter(true); @@ -65,7 +65,7 @@ public static void Apply(CloudLayer layer, Material skyMaterial) skyMaterial.SetTexture(HDShaderIDs._CloudMap, layer.cloudMap.value); skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); - if (layer.enableCloudMotion.value == true) + if (layer.enableDistortion.value == true) { skyMaterial.EnableKeyword("USE_CLOUD_MOTION"); if (layer.procedural.value == true) @@ -97,7 +97,7 @@ public override int GetHashCode() hash = cloudMap.value != null ? hash * 23 + cloudMap.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); - hash = hash * 23 + enableCloudMotion.value.GetHashCode(); + hash = hash * 23 + enableDistortion.value.GetHashCode(); hash = hash * 23 + procedural.value.GetHashCode(); hash = hash * 23 + windDirection.value.GetHashCode(); hash = hash * 23 + windForce.value.GetHashCode(); @@ -105,7 +105,7 @@ public override int GetHashCode() hash = cloudMap.value != null ? hash * 23 + cloudMap.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); - hash = hash * 23 + enableCloudMotion.overrideState.GetHashCode(); + hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); hash = hash * 23 + procedural.overrideState.GetHashCode(); hash = hash * 23 + windDirection.overrideState.GetHashCode(); hash = hash * 23 + windForce.overrideState.GetHashCode(); @@ -113,7 +113,7 @@ public override int GetHashCode() hash = cloudMap.value != null ? hash * 23 + cloudMap.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; hash = hash * 23 + upperHemisphereOnly.GetHashCode(); - hash = hash * 23 + enableCloudMotion.GetHashCode(); + hash = hash * 23 + enableDistortion.GetHashCode(); hash = hash * 23 + procedural.GetHashCode(); hash = hash * 23 + scrollDirection.GetHashCode(); hash = hash * 23 + scrollSpeed.GetHashCode(); From 38ae08cf57d83af153fd552bf3b088b6636f3917 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 13 May 2020 11:58:56 +0200 Subject: [PATCH 32/44] Renamed variables --- .../Runtime/Sky/HDRISky/HDRISky.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs index 9ff4636e651..03abb2bb571 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs @@ -86,11 +86,11 @@ public override int GetHashCode() #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = hdriSky.value != null ? hash * 23 + hdriSky.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; - hash = hash * 23 + enableCloudMotion.value.GetHashCode(); + hash = hash * 23 + enableDistortion.value.GetHashCode(); hash = hash * 23 + procedural.value.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); - hash = hash * 23 + windDirection.value.GetHashCode(); - hash = hash * 23 + windForce.value.GetHashCode(); + hash = hash * 23 + scrollDirection.value.GetHashCode(); + hash = hash * 23 + scrollSpeed.value.GetHashCode(); hash = hash * 23 + enableBackplate.value.GetHashCode(); hash = hash * 23 + backplateType.value.GetHashCode(); @@ -108,11 +108,11 @@ public override int GetHashCode() hash = hdriSky.value != null ? hash * 23 + hdriSky.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; - hash = hash * 23 + enableCloudMotion.overrideState.GetHashCode(); + hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); hash = hash * 23 + procedural.overrideState.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); - hash = hash * 23 + windDirection.overrideState.GetHashCode(); - hash = hash * 23 + windForce.overrideState.GetHashCode(); + hash = hash * 23 + scrollDirection.overrideState.GetHashCode(); + hash = hash * 23 + scrollSpeed.overrideState.GetHashCode(); hash = hash * 23 + enableBackplate.overrideState.GetHashCode(); hash = hash * 23 + backplateType.overrideState.GetHashCode(); From 8e08e172b7e0baa50d99b51a1bc56e2a8ad6f4e2 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 13 May 2020 13:51:26 +0200 Subject: [PATCH 33/44] Allow full sphere coverage for procedural flowmap --- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 85f36793a5e..230a04798c9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -49,8 +49,7 @@ public Vector4 GetParameters() lastTime = Time.time; float rot = -Mathf.Deg2Rad*scrollDirection.value; - bool upperOnly = upperHemisphereOnly.value || procedural.value; - return new Vector4(upperOnly ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); + return new Vector4(upperHemisphereOnly.value ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); } /// From 166a496e69d555c4096de0327f78295a07f1eef6 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 14 May 2020 11:19:29 +0200 Subject: [PATCH 34/44] Added missing doc --- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 6 +++--- .../Runtime/Sky/SkyRenderer.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 230a04798c9..a5d47892fac 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -52,9 +52,9 @@ public Vector4 GetParameters() return new Vector4(upperHemisphereOnly.value ? 1.0f : 0.0f, scrollFactor, Mathf.Cos(rot), Mathf.Sin(rot)); } - /// - /// Sets keywords and parameters on a sky material to render the cloud layer. - /// + /// Sets keywords and parameters on a sky material to render the cloud layer. + /// The cloud layer to apply. + /// The sky material to change. public static void Apply(CloudLayer layer, Material skyMaterial) { if (layer != null && layer.enabled.value == true) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs index 24b8537efc9..64d226a480b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs @@ -7,7 +7,9 @@ public abstract class SkyRenderer { int m_LastFrameUpdate = -1; + /// Determines if the sky should be rendered when the sun light changes. public bool SupportDynamicSunLight = true; + /// Determines if the sky should be rendered when the cloud layer changes. public bool SupportCloudLayer = true; /// From e584cd0db6258b823839a5d1461fff904a5dfacc Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Fri, 22 May 2020 11:03:44 +0200 Subject: [PATCH 35/44] Fix cloud reset and unrelated warnings in hdri sky shader --- .../Runtime/Sky/HDRISky/HDRISky.shader | 6 +++--- .../Runtime/Sky/StaticLightingSky.cs | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 6e7af9a23c7..9f32e43d8f9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -126,7 +126,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" { const float alpha = (_GroundLevel - _WorldSpaceCameraPos.y)/dir.y; - return _WorldSpaceCameraPos + alpha*dir; + return (float3)_WorldSpaceCameraPos + alpha*dir; } float GetSDF(out float scale, float2 position) @@ -299,7 +299,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" float blend; if (IsBackplateHitWithBlend(finalPos, blend, viewDirWS)) { - depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - _WorldSpaceCameraPos, UNITY_MATRIX_VP).z; + depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - (float3)_WorldSpaceCameraPos, UNITY_MATRIX_VP).z; } else { @@ -338,7 +338,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" float depth; if (IsBackplateHit(finalPos, viewDirWS)) { - depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - _WorldSpaceCameraPos, UNITY_MATRIX_VP).z; + depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - (float3)_WorldSpaceCameraPos, UNITY_MATRIX_VP).z; } else { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs index 54b7fa20607..0858197f76d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs @@ -35,7 +35,7 @@ internal SkySettings skySettings } else { - Reset(); + ResetSky(); } return m_SkySettings; } @@ -60,7 +60,7 @@ internal CloudLayer cloudLayer } else { - Reset(); + ResetCloud(); } return m_CloudLayer; } @@ -282,7 +282,8 @@ void OnDisable() if (m_Profile != null) SkyManager.UnRegisterStaticLightingSky(this); - Reset(); + ResetSky(); + ResetCloud(); } void Update() @@ -294,13 +295,16 @@ void Update() } } - void Reset() + void ResetSky() { CoreUtils.Destroy(m_SkySettings); m_SkySettings = null; m_SkySettingsFromProfile = null; m_LastComputedHash = 0; + } + void ResetCloud() + { CoreUtils.Destroy(m_CloudLayer); m_CloudLayer = null; m_CloudLayerFromProfile = null; From 4f246fa3797ed66e8005f049de85cca2ab0ddeb9 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Tue, 26 May 2020 15:43:23 +0200 Subject: [PATCH 36/44] Try different blending method --- .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 4 ++-- .../Runtime/Sky/HDRISky/HDRISky.shader | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index 827afefd7d6..ebdd20a85aa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -18,8 +18,8 @@ float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direc float3 sampleCloud(float3 dir, float3 sky) { float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); - float f = max(sky.x, max(sky.y, max(sky.z, 1.0))); // factor to balance sky exposure, there may be a better solution - return lerp(sky, cloudLayerColor.rgb*f, cloudLayerColor.a); + float f = (sky.r+sky.g+sky.b) / 3.0; + return lerp(sky, (cloudLayerColor.rgb + 1.0) * f,cloudLayerColor.a); } float3 CloudRotationUp(float3 p, float2 cos_sin) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader index 9f32e43d8f9..6e7af9a23c7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader @@ -126,7 +126,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" { const float alpha = (_GroundLevel - _WorldSpaceCameraPos.y)/dir.y; - return (float3)_WorldSpaceCameraPos + alpha*dir; + return _WorldSpaceCameraPos + alpha*dir; } float GetSDF(out float scale, float2 position) @@ -299,7 +299,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" float blend; if (IsBackplateHitWithBlend(finalPos, blend, viewDirWS)) { - depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - (float3)_WorldSpaceCameraPos, UNITY_MATRIX_VP).z; + depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - _WorldSpaceCameraPos, UNITY_MATRIX_VP).z; } else { @@ -338,7 +338,7 @@ Shader "Hidden/HDRP/Sky/HDRISky" float depth; if (IsBackplateHit(finalPos, viewDirWS)) { - depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - (float3)_WorldSpaceCameraPos, UNITY_MATRIX_VP).z; + depth = ComputeNormalizedDeviceCoordinatesWithZ(finalPos - _WorldSpaceCameraPos, UNITY_MATRIX_VP).z; } else { From 1cf25f7660cb072011a69fedc72b3ecd4052a94d Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 27 May 2020 18:36:26 +0200 Subject: [PATCH 37/44] Fixes + test another blending --- .../Documentation~/Environment-Lighting.md | 2 +- .../Editor/Sky/CloudLayer/CloudLayerEditor.cs | 10 ++++++++-- .../Runtime/Debug/DebugDisplay.cs | 2 +- .../Runtime/Debug/VolumeDebug.cs | 6 +++--- .../Runtime/RenderPipeline/HDStringConstants.cs | 2 ++ .../Runtime/Sky/CloudLayer/CloudLayer.cs | 17 +++++++++++++++++ .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 6 ++++-- .../Runtime/Sky/StaticLightingSky.cs | 6 +++++- 8 files changed, 41 insertions(+), 10 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md b/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md index 107fef2bdb6..f932a425bdd 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md @@ -45,7 +45,7 @@ The **Environment (HDRP)** section is at the top and has two settings that you c | **Setting** | **Description** | | ----------------------- | ------------------------------------------------------------ | | **Profile** | A [Volume Profile](Volume-Profile.html) for the sky. This Volume Profile must include at least one Sky Volume override. | -| **Static Lighting Sky** | The sky to use for the Global Illumination simulation. The drop-down only contains sky types that the **Profile** includes. For example, if the **Profile** includes a **Gradient Sky** Volume override, you can select **Gradient Sky** from this drop-down.
You can only edit this setting if you assign a Volume Profile to the **Profile** field. | +| **Static Lighting Sky** | The sky to use for the Global Illumination simulation. The drop-down only contains sky types that the **Profile** includes. For example, if the **Profile** includes a **Gradient Sky** Volume override, you can select **Gradient Sky** from this drop-down.
If the **Profile** includes a **Cloud Layer** Volume override, it will also be taken into account.
You can only edit this setting if you assign a Volume Profile to the **Profile** field. | You can assign the same Volume Profile to both the **Static Lighting Sky** field and a Volume in your Scene. If you do this, and use the same sky settings for the baked lighting and the visual background in the Volume, the baked lighting accurately matches the background at runtime. If you want to control the light baking for the environment lighting separately to the visual background in your Scene, you can assign a different Volume Profile for each process. diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs index 1b6ff67c58c..a2a211b1868 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs @@ -11,8 +11,10 @@ class CloudLayerEditor : VolumeComponentEditor { SerializedDataParameter m_Enabled; - SerializedDataParameter m_UpperHemisphereOnly; SerializedDataParameter m_CloudMap; + SerializedDataParameter m_UpperHemisphereOnly; + SerializedDataParameter m_Brightness; + SerializedDataParameter m_Opacity; SerializedDataParameter m_EnableDistortion; SerializedDataParameter m_Procedural; @@ -29,8 +31,10 @@ public override void OnEnable() m_Enabled = Unpack(o.Find(x => x.enabled)); - m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); m_CloudMap = Unpack(o.Find(x => x.cloudMap)); + m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); + m_Brightness = Unpack(o.Find(x => x.brightness)); + m_Opacity = Unpack(o.Find(x => x.opacity)); m_EnableDistortion = Unpack(o.Find(x => x.enableDistortion)); m_Procedural = Unpack(o.Find(x => x.procedural)); @@ -58,6 +62,8 @@ public override void OnInspectorGUI() EditorGUILayout.HelpBox("The cloud map needs to be a 2D Texture in LatLong layout.", MessageType.Info); PropertyField(m_UpperHemisphereOnly); + PropertyField(m_Brightness); + PropertyField(m_Opacity); PropertyField(m_EnableDistortion); if (m_EnableDistortion.value.boolValue) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 27f0ff26983..70e11ad2e93 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -1292,7 +1292,7 @@ DebugUI.Widget makeWidget(string name, VolumeParameter param) displayName = name, getter = () => { var value = property.GetValue(param); - if (value == null) + if (value == null || value.Equals(null)) return "None"; var valueString = nameProp.GetValue(value); return valueString == null ? "None" : valueString; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs index 2d6f1536a8f..d538e731927 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs @@ -206,7 +206,7 @@ public VolumeParameter GetParameter(Volume volume, FieldInfo field) } float[] weights = null; - float ComputeWeight(Volume volume) + float ComputeWeight(Volume volume, Vector3 triggerPos) { var profile = volume.HasInstantiatedProfile() ? volume.profile : volume.sharedProfile; @@ -218,7 +218,6 @@ float ComputeWeight(Volume volume) float weight = Mathf.Clamp01(volume.weight); if (!volume.isGlobal) { - var triggerPos = selectedCameraPosition; var colliders = volume.GetComponents(); // Find closest distance to volume, 0 means it's inside it @@ -313,9 +312,10 @@ public bool RefreshVolumes(Volume[] newVolumes) } } + var triggerPos = selectedCameraPosition; weights = new float[volumes.Length]; for (int i = 0; i < volumes.Length; i++) - weights[i] = ComputeWeight(volumes[i]); + weights[i] = ComputeWeight(volumes[i], triggerPos); return ret; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index d690fdfbf1a..d3911cf2626 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -382,6 +382,8 @@ static class HDShaderIDs public static readonly int _CloudMap = Shader.PropertyToID("_CloudMap"); public static readonly int _CloudFlowmap = Shader.PropertyToID("_CloudFlowmap"); public static readonly int _CloudParam = Shader.PropertyToID("_CloudParam"); + public static readonly int _CloudBrightness = Shader.PropertyToID("_CloudBrightness"); + public static readonly int _CloudOpacity = Shader.PropertyToID("_CloudOpacity"); public static readonly int _Size = Shader.PropertyToID("_Size"); public static readonly int _Source = Shader.PropertyToID("_Source"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index a5d47892fac..81153969444 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -19,6 +19,12 @@ public class CloudLayer : VolumeComponent /// Enable to cover only the upper part of the sky. [Tooltip("Check this box if the cloud layer covers only the upper part of the sky.")] public BoolParameter upperHemisphereOnly = new BoolParameter(true); + /// Controls the brightness of the cloud layer. + [Tooltip("Controls the brightness of the cloud layer.")] + public ClampedFloatParameter brightness = new ClampedFloatParameter(0.3f, 0.0f, 1.0f); + /// Opacity of the cloud layer. + [Tooltip("Blending factor between the sky and the cloud layer.")] + public ClampedFloatParameter opacity = new ClampedFloatParameter(1.0f, 0.0f, 1.0f); /// Enable to have cloud distortion. [Tooltip("Enable or disable cloud distortion.")] @@ -64,6 +70,8 @@ public static void Apply(CloudLayer layer, Material skyMaterial) skyMaterial.EnableKeyword("USE_CLOUD_MAP"); skyMaterial.SetTexture(HDShaderIDs._CloudMap, layer.cloudMap.value); skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); + skyMaterial.SetFloat(HDShaderIDs._CloudBrightness, layer.brightness.value); + skyMaterial.SetFloat(HDShaderIDs._CloudOpacity, layer.opacity.value); if (layer.enableDistortion.value == true) { @@ -96,7 +104,10 @@ public override int GetHashCode() #if UNITY_2019_3 // In 2019.3, when we call GetHashCode on a VolumeParameter it generate garbage (due to the boxing of the generic parameter) hash = cloudMap.value != null ? hash * 23 + cloudMap.value.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; + hash = hash * 23 + enabled.value.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); + hash = hash * 23 + brightness.value.GetHashCode(); + hash = hash * 23 + opacity.value.GetHashCode(); hash = hash * 23 + enableDistortion.value.GetHashCode(); hash = hash * 23 + procedural.value.GetHashCode(); hash = hash * 23 + scrollDirection.value.GetHashCode(); @@ -104,7 +115,10 @@ public override int GetHashCode() hash = cloudMap.value != null ? hash * 23 + cloudMap.overrideState.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; + hash = hash * 23 + enabled.overrideState.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); + hash = hash * 23 + brightness.overrideState.GetHashCode(); + hash = hash * 23 + opacity.overrideState.GetHashCode(); hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); hash = hash * 23 + procedural.overrideState.GetHashCode(); hash = hash * 23 + scrollDirection.overrideState.GetHashCode(); @@ -112,7 +126,10 @@ public override int GetHashCode() #else hash = cloudMap.value != null ? hash * 23 + cloudMap.GetHashCode() : hash; hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; + hash = hash * 23 + enabled.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.GetHashCode(); + hash = hash * 23 + brightness.GetHashCode(); + hash = hash * 23 + opacity.GetHashCode(); hash = hash * 23 + enableDistortion.GetHashCode(); hash = hash * 23 + procedural.GetHashCode(); hash = hash * 23 + scrollDirection.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index ebdd20a85aa..90afd0d2b2f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -8,6 +8,8 @@ TEXTURE2D(_CloudFlowmap); SAMPLER(sampler_CloudFlowmap); float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direction (cosPhi and sinPhi) +float _CloudBrightness; +float _CloudOpacity; #define _CloudUpperHemisphere _CloudParam.x #define _CloudScrollFactor _CloudParam.y @@ -18,8 +20,8 @@ float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direc float3 sampleCloud(float3 dir, float3 sky) { float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); - float f = (sky.r+sky.g+sky.b) / 3.0; - return lerp(sky, (cloudLayerColor.rgb + 1.0) * f,cloudLayerColor.a); + float brightness = (sky.r+sky.g+sky.b) * _CloudBrightness / (600.0 * GetCurrentExposureMultiplier()); + return lerp(sky, sky + cloudLayerColor.rgb + brightness, cloudLayerColor.a * _CloudOpacity); } float3 CloudRotationUp(float3 p, float2 cos_sin) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs index 0858197f76d..1dd04ac73e0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/StaticLightingSky.cs @@ -123,7 +123,7 @@ void GetSkyFromIDAndVolume(int skyUniqueID, VolumeProfile profile, out SkySettin { foreach (var sky in m_VolumeSkyList) { - if (skyUniqueID == SkySettings.GetUniqueID(sky.GetType())) + if (skyUniqueID == SkySettings.GetUniqueID(sky.GetType()) && sky.active) { skyType = sky.GetType(); skySetting = sky; @@ -188,7 +188,11 @@ void UpdateCurrentStaticLightingSky() void GetCloudFromVolume(VolumeProfile profile, out CloudLayer cloudLayer) { if (profile != null) + { profile.TryGet(out cloudLayer); + if (cloudLayer != null && !cloudLayer.active) + cloudLayer = null; + } else cloudLayer = null; } From b7cec1b5d5b3cc8140749189b980e4237c400e0c Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Wed, 3 Jun 2020 11:36:10 +0200 Subject: [PATCH 38/44] Tint and intensity parameters. Fix static sky used by lightmapper --- .../Documentation~/Override-Cloud-Layer.md | 2 ++ .../Editor/Sky/CloudLayer/CloudLayerEditor.cs | 12 ++++---- .../Runtime/Debug/DebugDisplay.cs | 2 +- .../Runtime/Debug/VolumeDebug.cs | 6 ++-- .../RenderPipeline/HDStringConstants.cs | 3 +- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 29 ++++++++++--------- .../Runtime/Sky/CloudLayer/CloudLayer.hlsl | 10 ++++--- .../Runtime/Sky/SkyManager.cs | 4 +-- .../Runtime/Sky/SkyUpdateContext.cs | 15 +++++++++- 9 files changed, 50 insertions(+), 33 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md index 0a61f4beae5..66d4c8a4a36 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md @@ -35,6 +35,8 @@ Only the red and green channel are used and they represent respectively horizont | **Enable** | Enables the cloud layer. | | **Cloud Map* | Assign a Texture that HDRP uses to render the cloud layer. Refer to the section [Customizing the Cloud Map](#CustomizingCloudMap) for more details. | | **Upper Hemisphere Only** | Check the box to display the cloud layer above the horizon only. | +| **Tint** | Specifies a color that HDRP uses to tint the Cloud Layer. | +| **Intensity Multiplier** | Set the multiplier by which HDRP multiplies the Cloud Layer color. | | **Enable Distortion** | Enable or disable cloud motion using UV distortion. | | - **Distortion Mode** | Use the drop-down to select the method that HDRP uses to calculate the cloud distortion.
• **Procedural**: HDRP distorts the clouds using a uniform wind direction.
• **Flowmap**: HDRP distorts the clouds with a user provided flowmap. | | -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the clouds. Refer to the section [Customizing the Flowmap](#CustomizingFlowmap) for more details.
This property only appears when you select **Flowmap** from the **Distortion Mode** drop-down. | diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs index a2a211b1868..98de2b923f6 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/CloudLayer/CloudLayerEditor.cs @@ -13,8 +13,8 @@ class CloudLayerEditor : VolumeComponentEditor SerializedDataParameter m_CloudMap; SerializedDataParameter m_UpperHemisphereOnly; - SerializedDataParameter m_Brightness; - SerializedDataParameter m_Opacity; + SerializedDataParameter m_Tint; + SerializedDataParameter m_IntensityMultiplier; SerializedDataParameter m_EnableDistortion; SerializedDataParameter m_Procedural; @@ -33,8 +33,8 @@ public override void OnEnable() m_CloudMap = Unpack(o.Find(x => x.cloudMap)); m_UpperHemisphereOnly = Unpack(o.Find(x => x.upperHemisphereOnly)); - m_Brightness = Unpack(o.Find(x => x.brightness)); - m_Opacity = Unpack(o.Find(x => x.opacity)); + m_Tint = Unpack(o.Find(x => x.tint)); + m_IntensityMultiplier = Unpack(o.Find(x => x.intensityMultiplier)); m_EnableDistortion = Unpack(o.Find(x => x.enableDistortion)); m_Procedural = Unpack(o.Find(x => x.procedural)); @@ -62,8 +62,8 @@ public override void OnInspectorGUI() EditorGUILayout.HelpBox("The cloud map needs to be a 2D Texture in LatLong layout.", MessageType.Info); PropertyField(m_UpperHemisphereOnly); - PropertyField(m_Brightness); - PropertyField(m_Opacity); + PropertyField(m_Tint); + PropertyField(m_IntensityMultiplier); PropertyField(m_EnableDistortion); if (m_EnableDistortion.value.boolValue) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 70e11ad2e93..27f0ff26983 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -1292,7 +1292,7 @@ DebugUI.Widget makeWidget(string name, VolumeParameter param) displayName = name, getter = () => { var value = property.GetValue(param); - if (value == null || value.Equals(null)) + if (value == null) return "None"; var valueString = nameProp.GetValue(value); return valueString == null ? "None" : valueString; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs index d538e731927..2d6f1536a8f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/VolumeDebug.cs @@ -206,7 +206,7 @@ public VolumeParameter GetParameter(Volume volume, FieldInfo field) } float[] weights = null; - float ComputeWeight(Volume volume, Vector3 triggerPos) + float ComputeWeight(Volume volume) { var profile = volume.HasInstantiatedProfile() ? volume.profile : volume.sharedProfile; @@ -218,6 +218,7 @@ float ComputeWeight(Volume volume, Vector3 triggerPos) float weight = Mathf.Clamp01(volume.weight); if (!volume.isGlobal) { + var triggerPos = selectedCameraPosition; var colliders = volume.GetComponents(); // Find closest distance to volume, 0 means it's inside it @@ -312,10 +313,9 @@ public bool RefreshVolumes(Volume[] newVolumes) } } - var triggerPos = selectedCameraPosition; weights = new float[volumes.Length]; for (int i = 0; i < volumes.Length; i++) - weights[i] = ComputeWeight(volumes[i], triggerPos); + weights[i] = ComputeWeight(volumes[i]); return ret; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs index d3911cf2626..2ad1244b6fa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs @@ -382,8 +382,7 @@ static class HDShaderIDs public static readonly int _CloudMap = Shader.PropertyToID("_CloudMap"); public static readonly int _CloudFlowmap = Shader.PropertyToID("_CloudFlowmap"); public static readonly int _CloudParam = Shader.PropertyToID("_CloudParam"); - public static readonly int _CloudBrightness = Shader.PropertyToID("_CloudBrightness"); - public static readonly int _CloudOpacity = Shader.PropertyToID("_CloudOpacity"); + public static readonly int _CloudParam2 = Shader.PropertyToID("_CloudParam2"); public static readonly int _Size = Shader.PropertyToID("_Size"); public static readonly int _Source = Shader.PropertyToID("_Source"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index 81153969444..ed8f5f649aa 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -19,12 +19,12 @@ public class CloudLayer : VolumeComponent /// Enable to cover only the upper part of the sky. [Tooltip("Check this box if the cloud layer covers only the upper part of the sky.")] public BoolParameter upperHemisphereOnly = new BoolParameter(true); - /// Controls the brightness of the cloud layer. - [Tooltip("Controls the brightness of the cloud layer.")] - public ClampedFloatParameter brightness = new ClampedFloatParameter(0.3f, 0.0f, 1.0f); - /// Opacity of the cloud layer. - [Tooltip("Blending factor between the sky and the cloud layer.")] - public ClampedFloatParameter opacity = new ClampedFloatParameter(1.0f, 0.0f, 1.0f); + /// Color multiplier of the clouds. + [Tooltip("Specifies the color that HDRP uses to tint the clouds.")] + public ColorParameter tint = new ColorParameter(Color.white); + /// Intensity multipler of the clouds. + [Tooltip("Sets the intensity multiplier for the clouds.")] + public MinFloatParameter intensityMultiplier = new MinFloatParameter(1.0f, 0.0f); /// Enable to have cloud distortion. [Tooltip("Enable or disable cloud distortion.")] @@ -66,12 +66,13 @@ public static void Apply(CloudLayer layer, Material skyMaterial) if (layer != null && layer.enabled.value == true) { Vector4 cloudParam = layer.GetParameters(); + Vector4 cloudParam2 = layer.tint.value; + cloudParam2.w = layer.intensityMultiplier.value; skyMaterial.EnableKeyword("USE_CLOUD_MAP"); skyMaterial.SetTexture(HDShaderIDs._CloudMap, layer.cloudMap.value); skyMaterial.SetVector(HDShaderIDs._CloudParam, cloudParam); - skyMaterial.SetFloat(HDShaderIDs._CloudBrightness, layer.brightness.value); - skyMaterial.SetFloat(HDShaderIDs._CloudOpacity, layer.opacity.value); + skyMaterial.SetVector(HDShaderIDs._CloudParam2, cloudParam2); if (layer.enableDistortion.value == true) { @@ -106,8 +107,8 @@ public override int GetHashCode() hash = flowmap.value != null ? hash * 23 + flowmap.value.GetHashCode() : hash; hash = hash * 23 + enabled.value.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.value.GetHashCode(); - hash = hash * 23 + brightness.value.GetHashCode(); - hash = hash * 23 + opacity.value.GetHashCode(); + hash = hash * 23 + tint.value.GetHashCode(); + hash = hash * 23 + intensityMultiplier.value.GetHashCode(); hash = hash * 23 + enableDistortion.value.GetHashCode(); hash = hash * 23 + procedural.value.GetHashCode(); hash = hash * 23 + scrollDirection.value.GetHashCode(); @@ -117,8 +118,8 @@ public override int GetHashCode() hash = flowmap.value != null ? hash * 23 + flowmap.overrideState.GetHashCode() : hash; hash = hash * 23 + enabled.overrideState.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.overrideState.GetHashCode(); - hash = hash * 23 + brightness.overrideState.GetHashCode(); - hash = hash * 23 + opacity.overrideState.GetHashCode(); + hash = hash * 23 + tint.overrideState.GetHashCode(); + hash = hash * 23 + intensityMultiplier.overrideState.GetHashCode(); hash = hash * 23 + enableDistortion.overrideState.GetHashCode(); hash = hash * 23 + procedural.overrideState.GetHashCode(); hash = hash * 23 + scrollDirection.overrideState.GetHashCode(); @@ -128,8 +129,8 @@ public override int GetHashCode() hash = flowmap.value != null ? hash * 23 + flowmap.GetHashCode() : hash; hash = hash * 23 + enabled.GetHashCode(); hash = hash * 23 + upperHemisphereOnly.GetHashCode(); - hash = hash * 23 + brightness.GetHashCode(); - hash = hash * 23 + opacity.GetHashCode(); + hash = hash * 23 + tint.GetHashCode(); + hash = hash * 23 + intensityMultiplier.GetHashCode(); hash = hash * 23 + enableDistortion.GetHashCode(); hash = hash * 23 + procedural.GetHashCode(); hash = hash * 23 + scrollDirection.GetHashCode(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl index 90afd0d2b2f..0db21de3237 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.hlsl @@ -8,20 +8,20 @@ TEXTURE2D(_CloudFlowmap); SAMPLER(sampler_CloudFlowmap); float4 _CloudParam; // x upper hemisphere only, y scroll factor, zw scroll direction (cosPhi and sinPhi) -float _CloudBrightness; -float _CloudOpacity; +float4 _CloudParam2; // xyz tint, w intensity #define _CloudUpperHemisphere _CloudParam.x #define _CloudScrollFactor _CloudParam.y #define _CloudScrollDirection _CloudParam.zw +#define _CloudTint _CloudParam2.xyz +#define _CloudIntensity _CloudParam2.w #define USE_CLOUD_LAYER defined(USE_CLOUD_MAP) || (!defined(USE_CLOUD_MAP) && defined(USE_CLOUD_MOTION)) float3 sampleCloud(float3 dir, float3 sky) { float4 cloudLayerColor = SAMPLE_TEXTURE2D_LOD(_CloudMap, sampler_CloudMap, GetLatLongCoords(dir, _CloudUpperHemisphere), 0); - float brightness = (sky.r+sky.g+sky.b) * _CloudBrightness / (600.0 * GetCurrentExposureMultiplier()); - return lerp(sky, sky + cloudLayerColor.rgb + brightness, cloudLayerColor.a * _CloudOpacity); + return lerp(sky, sky + cloudLayerColor.rgb * _CloudTint * _CloudIntensity, cloudLayerColor.a); } float3 CloudRotationUp(float3 p, float2 cos_sin) @@ -80,6 +80,8 @@ float3 ApplyCloudLayer(float3 dir, float3 sky) #undef _CloudUpperHemisphere #undef _CloudScrollFactor #undef _CloudScrollDirection +#undef _CloudTint +#undef _CloudIntensity #undef USE_CLOUD_LAYER diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index 04dfd06d7cf..06d54830607 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -795,7 +795,7 @@ public void UpdateEnvironment( HDCamera hdCamera, #if UNITY_EDITOR // In the editor when we change the sky we want to make the GI dirty so when baking again the new sky is taken into account. // Changing the hash of the rendertarget allow to say that GI is dirty - renderingContext.skyboxCubemapRT.rt.imageContentsHash = new Hash128((uint)skyContext.skySettings.GetHashCode(hdCamera.camera), 0, 0, 0); + renderingContext.skyboxCubemapRT.rt.imageContentsHash = new Hash128((uint)skyHash, 0, 0, 0); #endif } } @@ -824,7 +824,7 @@ public void UpdateEnvironment(HDCamera hdCamera, ScriptableRenderContext renderC #if UNITY_EDITOR // In the editor, we might need the static sky ready for baking lightmaps/lightprobes regardless of the current ambient mode so we force it to update in this case if it's not been computed yet.. // We don't test if the hash of the static sky has changed here because it depends on the sun direction and in the case of LookDev, sun will be different from the main rendering so it will induce improper recomputation. - forceStaticUpdate = staticLightingSky != null && m_StaticLightingSky.skyParametersHash == -1; ; + forceStaticUpdate = staticLightingSky != null && m_StaticLightingSky.skyParametersHash == -1; #endif if ((ambientMode == SkyAmbientMode.Static || forceStaticUpdate) && hdCamera.camera.cameraType != CameraType.Preview) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs index d7f804249d8..3f5fe859b87 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs @@ -5,8 +5,8 @@ namespace UnityEngine.Rendering.HighDefinition internal class SkyUpdateContext { SkySettings m_SkySettings; + CloudLayer m_CloudLayer; public SkyRenderer skyRenderer { get; private set; } - public CloudLayer cloudLayer = null; public int cachedSkyRenderingContextId = -1; public int skyParametersHash = -1; @@ -42,6 +42,19 @@ public SkySettings skySettings } } + public CloudLayer cloudLayer + { + get { return m_CloudLayer; } + set + { + if (m_CloudLayer == value) + return; + + skyParametersHash = -1; + m_CloudLayer = value; + } + } + public void Cleanup() { if (skyRenderer != null) From d2f56eef9e71f1abb7f4785194e9e367e1e2faee Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Thu, 4 Jun 2020 17:02:05 +0200 Subject: [PATCH 39/44] Added graphic test. Updated doc --- .../Scenes/5x_SkyAndFog/5010_CloudLayer.meta | 8 + .../Scenes/5x_SkyAndFog/5010_CloudLayer.unity | 329 ++++++++++++++++++ .../5x_SkyAndFog/5010_CloudLayer.unity.meta | 7 + .../Scene Settings Profile.asset | 327 +++++++++++++++++ .../Scene Settings Profile.asset.meta | 8 + .../5x_SkyAndFog/5010_CloudLayer/clouds.png | 3 + .../5010_CloudLayer/clouds.png.meta | 108 ++++++ .../OSXEditor/Metal/None/5010_CloudLayer.png | 3 + .../Metal/None/5010_CloudLayer.png.meta | 96 +++++ .../Direct3D11/None/5010_CloudLayer.png | 3 + .../Direct3D11/None/5010_CloudLayer.png.meta | 96 +++++ .../Direct3D12/None/5010_CloudLayer.png | 3 + .../Direct3D12/None/5010_CloudLayer.png.meta | 96 +++++ .../Vulkan/None/5010_CloudLayer.png | 3 + .../Vulkan/None/5010_CloudLayer.png.meta | 96 +++++ .../Direct3D11/None/5010_CloudLayer.png | 3 + .../Direct3D11/None/5010_CloudLayer.png.meta | 96 +++++ .../ProjectSettings/EditorBuildSettings.asset | 3 + .../Documentation~/Creating-a-Custom-Sky.md | 11 +- .../Images/Override-CloudLayer.png | 4 +- .../Documentation~/Override-Cloud-Layer.md | 2 +- 21 files changed, 1301 insertions(+), 4 deletions(-) create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.meta new file mode 100644 index 00000000000..2d2b7d97b1d --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22ed54d594144d04f88aef373a4a8a27 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity new file mode 100644 index 00000000000..4f4276a9bae --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity @@ -0,0 +1,329 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 1149913020} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1001 &452585676 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.x + value: -0.44 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.y + value: 0.28999972 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.z + value: -13.38 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.x + value: -0.15503997 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.w + value: 0.98790824 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: -17.838 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_ClearFlags + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_BackGroundColor.r + value: 0.4705882 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_BackGroundColor.g + value: 0.4705882 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_BackGroundColor.b + value: 0.4705882 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: far clip plane + value: 30 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: field of view + value: 30 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_Version + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 + value: 70005818916701 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: clearColorMode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: ImageComparisonSettings.TargetWidth + value: 640 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} +--- !u!1 &840375756 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 840375759} + - component: {fileID: 840375758} + m_Layer: 0 + m_Name: Scene Settings + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &840375758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 840375756} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: 3c92a6b444bd8a749b685664884c5a36, type: 2} +--- !u!4 &840375759 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 840375756} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!850595691 &1149913020 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 2 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRRussianRouletteStartBounce: 2 + m_PVREnvironmentMIS: 1 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity.meta new file mode 100644 index 00000000000..6bb6eaf9d9f --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 602816355ed2fb94383bb6396823e77e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset new file mode 100644 index 00000000000..583f7bba85c --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset @@ -0,0 +1,327 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-3155368813038754222 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} + m_Name: HDRISky + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 0 + m_Value: 0 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 0.46607345 + min: 0 + upperHemisphereLuxColor: + m_OverrideState: 0 + m_Value: {x: 0.18750395, y: 0.2918189, z: 0.5} + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + hdriSky: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 8253d41e6e8b11a4cbe77a4f8f82934d, type: 3} + enableDistortion: + m_OverrideState: 0 + m_Value: 0 + procedural: + m_OverrideState: 0 + m_Value: 1 + flowmap: + m_OverrideState: 0 + m_Value: {fileID: 0} + upperHemisphereOnly: + m_OverrideState: 0 + m_Value: 1 + scrollDirection: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + scrollSpeed: + m_OverrideState: 0 + m_Value: 2 + min: 0 + enableBackplate: + m_OverrideState: 0 + m_Value: 0 + backplateType: + m_OverrideState: 0 + m_Value: 0 + groundLevel: + m_OverrideState: 0 + m_Value: 0 + scale: + m_OverrideState: 0 + m_Value: {x: 32, y: 32} + projectionDistance: + m_OverrideState: 0 + m_Value: 16 + min: 0.0000001 + plateRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexRotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + plateTexOffset: + m_OverrideState: 0 + m_Value: {x: 0, y: 0} + blendAmount: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 100 + shadowTint: + m_OverrideState: 0 + m_Value: {r: 0.5, g: 0.5, b: 0.5, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + pointLightShadow: + m_OverrideState: 0 + m_Value: 0 + dirLightShadow: + m_OverrideState: 0 + m_Value: 0 + rectLightShadow: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &-1065974624950405951 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4df53429744a4174ca20efaba13fe1e0, type: 3} + m_Name: CloudLayer + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + enabled: + m_OverrideState: 1 + m_Value: 1 + cloudMap: + m_OverrideState: 1 + m_Value: {fileID: 2800000, guid: 556e9bc309995094c87d3c02677f230d, type: 3} + upperHemisphereOnly: + m_OverrideState: 0 + m_Value: 1 + tint: + m_OverrideState: 1 + m_Value: {r: 0.5647059, g: 0.5764706, b: 0.5568628, a: 1} + hdr: 0 + showAlpha: 1 + showEyeDropper: 1 + intensityMultiplier: + m_OverrideState: 1 + m_Value: 1.02 + min: 0 + enableDistortion: + m_OverrideState: 0 + m_Value: 0 + procedural: + m_OverrideState: 0 + m_Value: 1 + flowmap: + m_OverrideState: 0 + m_Value: {fileID: 0} + scrollDirection: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + scrollSpeed: + m_OverrideState: 0 + m_Value: 2 + min: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: Scene Settings Profile + m_EditorClassIdentifier: + components: + - {fileID: 3479482973930658046} + - {fileID: -3155368813038754222} + - {fileID: -1065974624950405951} +--- !u!114 &3479482973930658046 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d7593b3a9277ac4696b20006c21dde2, type: 3} + m_Name: VisualEnvironment + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + skyType: + m_OverrideState: 1 + m_Value: 1 + skyAmbientMode: + m_OverrideState: 0 + m_Value: 0 + fogType: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &4845244889253265832 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6d31fa107c795994496a3089be99149a, type: 3} + m_Name: PhysicallyBasedSkySettings + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + rotation: + m_OverrideState: 0 + m_Value: 0 + min: 0 + max: 360 + skyIntensityMode: + m_OverrideState: 0 + m_Value: 0 + exposure: + m_OverrideState: 0 + m_Value: 0 + multiplier: + m_OverrideState: 0 + m_Value: 1 + min: 0 + upperHemisphereLuxValue: + m_OverrideState: 0 + m_Value: 1 + min: 0 + desiredLuxValue: + m_OverrideState: 0 + m_Value: 20000 + updateMode: + m_OverrideState: 0 + m_Value: 0 + updatePeriod: + m_OverrideState: 0 + m_Value: 0 + min: 0 + includeSunInBaking: + m_OverrideState: 0 + m_Value: 0 + planetaryRadius: + m_OverrideState: 0 + m_Value: 6378.759 + min: 0 + planetCenterPosition: + m_OverrideState: 0 + m_Value: {x: 0, y: -6378.759, z: 0} + airAttenuationDistance: + m_OverrideState: 0 + m_Value: {r: 0.17241378, g: 0.074074075, b: 0.030211482, a: 1} + hdr: 1 + showAlpha: 0 + showEyeDropper: 0 + airAlbedo: + m_OverrideState: 0 + m_Value: {r: 0.9, g: 0.9, b: 1, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 0 + airMaxAltitude: + m_OverrideState: 0 + m_Value: 58.3 + min: 0 + aerosolAttenuationDistance: + m_OverrideState: 0 + m_Value: 0.5 + min: 0 + aerosolAlbedo: + m_OverrideState: 0 + m_Value: 0.9 + min: 0 + max: 1 + aerosolMaxAltitude: + m_OverrideState: 0 + m_Value: 8.3 + min: 0 + aerosolAnisotropy: + m_OverrideState: 0 + m_Value: 0 + min: -1 + max: 1 + numBounces: + m_OverrideState: 0 + m_Value: 8 + min: 1 + max: 10 + groundColor: + m_OverrideState: 1 + m_Value: {r: 0.17254902, g: 0.227451, b: 0.3137255, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 0 + groundAlbedoTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: 703a4570dfe8b8e41aff24d2320bd405, type: 3} + groundEmissionTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: ec98521838f4e7f4a839280309cb08ab, type: 3} + planetRotation: + m_OverrideState: 1 + m_Value: {x: 180, y: -50, z: 170} + spaceEmissionTexture: + m_OverrideState: 1 + m_Value: {fileID: 8900000, guid: b0c5cbf24c773cd449436a2060083b10, type: 3} + spaceRotation: + m_OverrideState: 1 + m_Value: {x: 15, y: 30, z: 45} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset.meta new file mode 100644 index 00000000000..4d0fc8e59e2 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/Scene Settings Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c92a6b444bd8a749b685664884c5a36 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png new file mode 100644 index 00000000000..d0b9985b2c1 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b5f4f77e643c755598e9c59f45839fe3818aead9859d098461708d10dcc5cf74 +size 744889 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png.meta new file mode 100644 index 00000000000..5983659864a --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer/clouds.png.meta @@ -0,0 +1,108 @@ +fileFormatVersion: 2 +guid: 556e9bc309995094c87d3c02677f230d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 0 + 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 + vTOnly: 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: 1 + 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: 2 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png new file mode 100644 index 00000000000..b6905fbd255 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c141c8eaec873e0ce1f0289dd16035d05f5e43c0127256e26465944ea36995e +size 166413 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png.meta new file mode 100644 index 00000000000..57e7e7f7b14 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/5010_CloudLayer.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: cb32c186acc7493478a9c553e3602883 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png new file mode 100644 index 00000000000..b6905fbd255 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c141c8eaec873e0ce1f0289dd16035d05f5e43c0127256e26465944ea36995e +size 166413 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png.meta new file mode 100644 index 00000000000..5397f17976c --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/5010_CloudLayer.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 138f3f330ef4c2441a8ed225fe022058 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + 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: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png new file mode 100644 index 00000000000..b6905fbd255 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c141c8eaec873e0ce1f0289dd16035d05f5e43c0127256e26465944ea36995e +size 166413 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png.meta new file mode 100644 index 00000000000..58c07d3a597 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/5010_CloudLayer.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: b4526db69dbb8cf49880762253e0d3be +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png new file mode 100644 index 00000000000..b6905fbd255 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c141c8eaec873e0ce1f0289dd16035d05f5e43c0127256e26465944ea36995e +size 166413 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png.meta new file mode 100644 index 00000000000..0daf2cab9f1 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/5010_CloudLayer.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 2eb5894d0b40c5c4687accde81393255 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png new file mode 100644 index 00000000000..b6905fbd255 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c141c8eaec873e0ce1f0289dd16035d05f5e43c0127256e26465944ea36995e +size 166413 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png.meta new file mode 100644 index 00000000000..cfae3e3dadf --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/5010_CloudLayer.png.meta @@ -0,0 +1,96 @@ +fileFormatVersion: 2 +guid: 7b0def33545ea0e47b1b9fffd8371015 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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 + vTOnly: 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: 1 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset index 80e3bedde07..4440cca4ba7 100644 --- a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset @@ -443,6 +443,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/GraphicTests/Scenes/5x_SkyAndFog/5009_HDRI_Sky_Flow.unity guid: f2fd7a28087b7634e94c49cb78704e74 + - enabled: 1 + path: Assets/GraphicTests/Scenes/5x_SkyAndFog/5010_CloudLayer.unity + guid: 602816355ed2fb94383bb6396823e77e - enabled: 1 path: Assets/GraphicTests/Scenes/8x_ShaderGraph/8101_Opaque.unity guid: 3f9e911b4dbc9464e85add595c37cb89 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md b/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md index ccd3b02496a..ed9489378ef 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Creating-a-Custom-Sky.md @@ -122,6 +122,14 @@ class NewSkyRenderer : SkyRenderer private static int m_RenderCubemapID = 0; // FragBaking private static int m_RenderFullscreenSkyID = 1; // FragRender + + public NewSkyRenderer() + { + // These booleans tell the sky system if the sky needs to be recomputed + // when the sun light or the cloud layer changes + SupportDynamicSunLight = true; + SupportCloudLayer = true; + } public override void Build() { @@ -159,7 +167,8 @@ class NewSkyRenderer : SkyRenderer m_PropertyBlock.SetVector(_SkyParam, new Vector4(intensity, 0.0f, Mathf.Cos(phi), Mathf.Sin(phi))); m_PropertyBlock.SetMatrix(_PixelCoordToViewDirWS, builtinParams.pixelCoordToViewDirMatrix); - CloudLayer.Apply(builtinParams.cloudLayer, m_NewSkyMaterial); + if (SupportCloudLayer) + CloudLayer.Apply(builtinParams.cloudLayer, m_NewSkyMaterial); CoreUtils.DrawFullScreen(builtinParams.commandBuffer, m_NewSkyMaterial, m_PropertyBlock, passID); } diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png index 6c1300f58ea..b729b6268c4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/Override-CloudLayer.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf31ca2a40721e174fcfd5dea362ae4d774686ab7c879bf3779e6a8baf865122 -size 10751 +oid sha256:58f1c0836b097b52457650cc996d13154eaea7ccf939d4cfc8175a66aa17c822 +size 12864 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md index 66d4c8a4a36..700ccbb2743 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Override-Cloud-Layer.md @@ -36,7 +36,7 @@ Only the red and green channel are used and they represent respectively horizont | **Cloud Map* | Assign a Texture that HDRP uses to render the cloud layer. Refer to the section [Customizing the Cloud Map](#CustomizingCloudMap) for more details. | | **Upper Hemisphere Only** | Check the box to display the cloud layer above the horizon only. | | **Tint** | Specifies a color that HDRP uses to tint the Cloud Layer. | -| **Intensity Multiplier** | Set the multiplier by which HDRP multiplies the Cloud Layer color. | +| **Intensity Multiplier** | Set the multiplier by which HDRP multiplies the Cloud Layer color.
Note: If the **Cloud Layer** is applied on top of a **Physically Based Sky**, the multiplier may need to be quite big. | | **Enable Distortion** | Enable or disable cloud motion using UV distortion. | | - **Distortion Mode** | Use the drop-down to select the method that HDRP uses to calculate the cloud distortion.
• **Procedural**: HDRP distorts the clouds using a uniform wind direction.
• **Flowmap**: HDRP distorts the clouds with a user provided flowmap. | | -- **Flowmap** | Assign a flowmap, in LatLong layout, that HDRP uses to distort UVs when rendering the clouds. Refer to the section [Customizing the Flowmap](#CustomizingFlowmap) for more details.
This property only appears when you select **Flowmap** from the **Distortion Mode** drop-down. | From 5444710a179e61a67d856ceb02fb2739176041e0 Mon Sep 17 00:00:00 2001 From: Adrien de Tocqueville Date: Fri, 5 Jun 2020 15:39:07 +0200 Subject: [PATCH 40/44] Updated tests using a disabled static sky If a sky override is used for static lighting and is disabled in the volume, it is not used anymore --- .../Linear/OSXEditor/Metal/None/2308_Microshadows.png | 4 ++-- .../Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png | 4 ++-- .../Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png | 4 ++-- .../WindowsEditor/Direct3D11/None/2308_Microshadows.png | 4 ++-- .../WindowsEditor/Direct3D11/None/2601_SSAO_HalfRes.png | 4 ++-- .../WindowsEditor/Direct3D11/None/2602_SSAO_FullRes.png | 4 ++-- .../WindowsEditor/Direct3D12/None/2308_Microshadows.png | 4 ++-- .../WindowsEditor/Direct3D12/None/2601_SSAO_HalfRes.png | 4 ++-- .../WindowsEditor/Direct3D12/None/2602_SSAO_FullRes.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/2308_Microshadows.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/2601_SSAO_HalfRes.png | 4 ++-- .../Linear/WindowsEditor/Vulkan/None/2602_SSAO_FullRes.png | 4 ++-- .../Documentation~/Environment-Lighting.md | 2 +- .../Editor/Sky/HDLightingWindowEnvironmentSection.cs | 2 +- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png index 444707a1c55..9b59051bb20 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:644ae6bada80d8c33ce1d93a6a58ebd6ea67e3b67ed62ebec749bda79cb9720b -size 42591 +oid sha256:9b5f95212d2065405d112551de5a63c4cf438380b6a3dcd5f7eaede2e193c32d +size 24542 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png index fc2c51b53ba..7d216bd0482 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7083f6c2ce35a22fef09634d291b49d2cd8329abd27be93be323874d0e1fd336 -size 74362 +oid sha256:bc17c857e0e7f12eca807fff68388fcbcc15d045606067ed25ee1adfa16868bd +size 118682 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png index bb78c777495..ebb30d828f6 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:96ab981af44a739e91dd847058c22fae7afae2ecc6f735f8bf0f2d9a361be1ba -size 123593 +oid sha256:3bc21975c8972b085c8b55c098a9765425df667cebf1e44cf7d37ed288f4a135 +size 139587 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2308_Microshadows.png index bbaba4fbb94..9b59051bb20 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eee60c6908da777a9d4275f787426cbc03fd4249060bfd8aaf45d56cacb6b0e7 -size 37485 +oid sha256:9b5f95212d2065405d112551de5a63c4cf438380b6a3dcd5f7eaede2e193c32d +size 24542 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2601_SSAO_HalfRes.png index 2fe16ac91fe..7d216bd0482 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3e1e6eb40c3373e31bba6660b726a274b6b01ad788e9b3ca4ab3f9ea36856834 -size 138495 +oid sha256:bc17c857e0e7f12eca807fff68388fcbcc15d045606067ed25ee1adfa16868bd +size 118682 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2602_SSAO_FullRes.png index 6f15097f7a6..ebb30d828f6 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a2f02786220bcb04807619067b3e50c24dcde08eac1d578954ef18153cfc20a -size 161721 +oid sha256:3bc21975c8972b085c8b55c098a9765425df667cebf1e44cf7d37ed288f4a135 +size 139587 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2308_Microshadows.png index d78609bb3c6..9b59051bb20 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68e343374594055f5366449f8ba419fb752c00ad6cfca827fba99e4e785b7798 -size 42655 +oid sha256:9b5f95212d2065405d112551de5a63c4cf438380b6a3dcd5f7eaede2e193c32d +size 24542 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2601_SSAO_HalfRes.png index 8f1716ca16d..7d216bd0482 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:528ff653ea85a5c9e0964c0333b51dc0c5152c46301d457daf528d19285911cd -size 138363 +oid sha256:bc17c857e0e7f12eca807fff68388fcbcc15d045606067ed25ee1adfa16868bd +size 118682 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2602_SSAO_FullRes.png index 1b98d3b8e93..ebb30d828f6 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2e404a0757452da69f850e0ffcb159c9f5ef59341df1270f7bc2d26d04b0d230 -size 161886 +oid sha256:3bc21975c8972b085c8b55c098a9765425df667cebf1e44cf7d37ed288f4a135 +size 139587 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2308_Microshadows.png index 75475877dc5..9b59051bb20 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fe27184a0fa7221b2aedbf2ec3e8f072e4643086896af221c4d7fe59bcaae4b -size 42602 +oid sha256:9b5f95212d2065405d112551de5a63c4cf438380b6a3dcd5f7eaede2e193c32d +size 24542 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2601_SSAO_HalfRes.png index f12d26d2f43..7d216bd0482 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:86b9c5bd30255e4a3e450c10e6a9183fd2242e4c1b2f25d6baf8832ba491e4a9 -size 138277 +oid sha256:bc17c857e0e7f12eca807fff68388fcbcc15d045606067ed25ee1adfa16868bd +size 118682 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2602_SSAO_FullRes.png index dea191a3b69..ebb30d828f6 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6c8ad25f24b2df583eefa218bc44fe0225e36346feb4892d6e7d6b8783f8f8af -size 161708 +oid sha256:3bc21975c8972b085c8b55c098a9765425df667cebf1e44cf7d37ed288f4a135 +size 139587 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md b/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md index f932a425bdd..94cac8a04c4 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Environment-Lighting.md @@ -45,7 +45,7 @@ The **Environment (HDRP)** section is at the top and has two settings that you c | **Setting** | **Description** | | ----------------------- | ------------------------------------------------------------ | | **Profile** | A [Volume Profile](Volume-Profile.html) for the sky. This Volume Profile must include at least one Sky Volume override. | -| **Static Lighting Sky** | The sky to use for the Global Illumination simulation. The drop-down only contains sky types that the **Profile** includes. For example, if the **Profile** includes a **Gradient Sky** Volume override, you can select **Gradient Sky** from this drop-down.
If the **Profile** includes a **Cloud Layer** Volume override, it will also be taken into account.
You can only edit this setting if you assign a Volume Profile to the **Profile** field. | +| **Static Lighting Sky** | The sky to use for the Global Illumination simulation. The drop-down only contains sky types included and activated in the **Profile**. For example, if the **Profile** has an active **Gradient Sky** Volume override, you can select **Gradient Sky** from this drop-down.
If the **Profile** includes an active **Cloud Layer** Volume override, it will contribute to Global Illumination.
You can only edit this setting if you assign a Volume Profile to the **Profile** field and that **Profile** contains at least one active Sky Volume Override. | You can assign the same Volume Profile to both the **Static Lighting Sky** field and a Volume in your Scene. If you do this, and use the same sky settings for the baked lighting and the visual background in the Volume, the baked lighting accurately matches the background at runtime. If you want to control the light baking for the environment lighting separately to the visual background in your Scene, you can assign a different Volume Profile for each process. diff --git a/com.unity.render-pipelines.high-definition/Editor/Sky/HDLightingWindowEnvironmentSection.cs b/com.unity.render-pipelines.high-definition/Editor/Sky/HDLightingWindowEnvironmentSection.cs index 682cba36804..009c168b822 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Sky/HDLightingWindowEnvironmentSection.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Sky/HDLightingWindowEnvironmentSection.cs @@ -207,7 +207,7 @@ void UpdateSkyIntPopupData() foreach (KeyValuePair kvp in skyTypesDict) { - if (profile.Has(kvp.Value)) + if (profile.TryGet(kvp.Value, out VolumeComponent comp) && comp.active) { m_SkyClassNames.Add(new GUIContent(kvp.Value.Name.ToString())); m_SkyUniqueIDs.Add(kvp.Key); From 914d47daf5bf3bd3096e277820be885ff393719b Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Mon, 8 Jun 2020 00:21:31 +0200 Subject: [PATCH 41/44] Update LocalAmbientOcclusionNoisy.asset --- .../AmbientOcclusionData/LocalAmbientOcclusionNoisy.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/AmbientOcclusionData/LocalAmbientOcclusionNoisy.asset b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/AmbientOcclusionData/LocalAmbientOcclusionNoisy.asset index cc33c97869b..d090fa99e34 100644 --- a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/AmbientOcclusionData/LocalAmbientOcclusionNoisy.asset +++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/AmbientOcclusionData/LocalAmbientOcclusionNoisy.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 59b6606ef2548734bb6d11b9d160bc7e, type: 3} m_Name: HDRISky m_EditorClassIdentifier: - active: 0 + active: 1 m_AdvancedMode: 0 rotation: m_OverrideState: 0 From 8cfe47b26dfe41b8248a85a1556b78d219a4388a Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Mon, 8 Jun 2020 00:27:32 +0200 Subject: [PATCH 42/44] update linux screenshots --- .../Linear/LinuxEditor/Vulkan/None/2308_Microshadows.png | 4 ++-- .../Linear/LinuxEditor/Vulkan/None/2601_SSAO_HalfRes.png | 4 ++-- .../Linear/LinuxEditor/Vulkan/None/2602_SSAO_FullRes.png | 4 ++-- .../Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2308_Microshadows.png index dbaf85a924d..445b08af3e2 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad5de5f57059f24c8fb887dee29262460d8f0f56573543620da0fce8b2c38163 -size 42603 +oid sha256:bdc4a6e895ae21def889dce2f30f45930ffd7574a2a64560b8c393a79599ea8d +size 24518 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2601_SSAO_HalfRes.png index f1f44e94791..cbc420ff548 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e5043b5f9b4797f4fc343e76567cb3e4c010734852e933cf25ec66e34cf67c60 -size 39316 +oid sha256:de492d6a865aeca799913e81c20e39bf816e80d38901d9a6511671245c128623 +size 28074 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2602_SSAO_FullRes.png index ec6b26b12bb..8cfeacd02df 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9bcc3e2df703d67353afae90d2694a7169da8bc18d18a8f7027f824fd129306d -size 46697 +oid sha256:f5a5e0f42edba600d28ef25819c2e3ac39220eeb95b5c4d3b64aefb59f758dbb +size 36058 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png new file mode 100644 index 00000000000..524f5b419d8 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/5010_CloudLayer.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:727618937f30f812f35c3a26ec7b4935d78788a1e46d952a4b86e1bccefcdda9 +size 194309 From e494fe4fc5f7face90072129ffebdf6fc77aa405 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Mon, 8 Jun 2020 00:35:06 +0200 Subject: [PATCH 43/44] Update CloudLayer.cs --- .../Runtime/Sky/CloudLayer/CloudLayer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs index ed8f5f649aa..a9ab4b590ce 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/CloudLayer/CloudLayer.cs @@ -6,7 +6,7 @@ namespace UnityEngine.Rendering.HighDefinition /// Cloud Layer Volume Component. /// This component setups the cloud layer for rendering. ///
- [VolumeComponentMenu("Sky/Cloud Layer")] + [VolumeComponentMenu("Sky/Cloud Layer (Preview)")] public class CloudLayer : VolumeComponent { /// Enable fog. @@ -45,6 +45,12 @@ public class CloudLayer : VolumeComponent private float scrollFactor = 0.0f, lastTime = 0.0f; + CloudLayer() + { + displayName = "CloudLayer (Preview)"; + + } + /// /// Returns the shader parameters of the cloud layer. /// From 0148eae2b6d039ac5e029afb8e1bed243a395524 Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Mon, 8 Jun 2020 01:16:24 +0200 Subject: [PATCH 44/44] update OSX screenshots --- .../Linear/OSXEditor/Metal/None/2308_Microshadows.png | 4 ++-- .../Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png | 4 ++-- .../Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png index ce39621d639..33852130210 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2308_Microshadows.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4f89ff302527a34dd737570c57ea59e390b8e67f4add730ef6c4e6e7995053a -size 259 +oid sha256:5afd74fc3ccf86a344d3cc59adca94372ee9af9b145eb2b4ec9bb607f10688ba +size 26991 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png index 7cf4a9fc417..59a48506086 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2601_SSAO_HalfRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ea743117d0536c467728d35b3d5425711194544c01b386827c0ebf7065bfad75 -size 261 +oid sha256:3afa43c5da5b997db0674ceb7273a49c462c501c0ffd88882006bac65a022cf7 +size 125393 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png index b9b4840750d..e82e1b46a40 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2602_SSAO_FullRes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d266a0d96b02b8d510bf1320db9313cc47a0bd6c7b84bbab0414268e9baec92 -size 261 +oid sha256:959b4db54a3dcf8cf7be850f19945e6943e65469e728840c7411684d6c267a86 +size 145807