升级水插件

This commit is contained in:
2026-01-31 00:32:49 +08:00
parent a739d2fe3b
commit 4123e83573
293 changed files with 13449 additions and 2853 deletions

View File

@@ -39,6 +39,7 @@
result._Texture = g_Crest_Cascade##name##source; \
result._SamplingParameters = g_Crest_SamplingParametersCascade##name##source; \
result._Index = i_Index; \
result._IndexI = i_Index; \
result._PositionSnapped = perSlice.xy; \
result._Texel = perSlice.z; \
result._Resolution = perType.y; \
@@ -56,6 +57,7 @@
result._Texture = i_Cascade._Texture; \
result._SamplingParameters = i_Cascade._SamplingParameters; \
result._Index = i_Index; \
result._IndexI = i_Index; \
result._PositionSnapped = perSlice.xy; \
result._Texel = perSlice.z; \
result._Resolution = perType.y; \
@@ -70,6 +72,7 @@
const float4 perAll = g_Crest_CascadeData##source[i_Index]; \
Cascade result; \
result._Index = i_Index; \
result._IndexI = i_Index; \
result._Scale = perAll.x; \
result._Weight = perAll.y; \
result._MaximumWavelength = perAll.z; \
@@ -140,6 +143,51 @@
} \
} \
return result; \
} \
half4 Sample##name##Overflow(const Texture2DArray i_Texture, const float2 i_Position, const float i_Border) m_ConstantReturn \
{ \
half4 result = 0.0; \
const float3 uv = WorldToUV(i_Position); \
const half2 r = abs(uv.xy - 0.5); \
const half rMax = 0.5 - _OneOverResolution * i_Border; \
if (max(r.x, r.y) <= rMax) \
{ \
result = Sample(i_Texture, uv); \
} \
else if ((_Index + 1) < _Count) \
{ \
const Cascade cascade = Cascade::Make##name(_Index + 1, this); \
const float3 uv = cascade.WorldToUV(i_Position); \
const half2 r = abs(uv.xy - 0.5); \
const half rMax = 0.5 - cascade._OneOverResolution * i_Border; \
if (max(r.x, r.y) <= rMax) \
{ \
result = Sample(i_Texture, uv); \
} \
} \
return result; \
} \
half4 Sample##name##Overflow(const Texture2DArray i_Texture, const float3 i_UV, const float i_Border) m_ConstantReturn \
{ \
half4 result = 0.0; \
const half2 r = abs(i_UV.xy - 0.5); \
const half rMax = 0.5 - _OneOverResolution * i_Border; \
if (max(r.x, r.y) <= rMax) \
{ \
result = Sample(i_Texture, i_UV); \
} \
else if ((_Index + 1) < _Count) \
{ \
const Cascade cascade = Cascade::Make##name(_Index + 1, this); \
const float3 uv = cascade.WorldToUV(UVToWorld(i_UV)); \
const half2 r = abs(uv.xy - 0.5); \
const half rMax = 0.5 - cascade._OneOverResolution * i_Border; \
if (max(r.x, r.y) <= rMax) \
{ \
result = Sample(i_Texture, uv); \
} \
} \
return result; \
}
#define m_SampleWeighted(name, type) \
@@ -175,6 +223,8 @@ struct Cascade
// For copy constructor.
float4 _SamplingParameters[MAX_LOD_COUNT];
uint _IndexI;
m_MakeCascadeShared
m_MakeCascadeSharedPrevious
@@ -183,6 +233,7 @@ struct Cascade
const float4 perAll = i_Previous ? g_Crest_CascadeDataSource[i_Index] : g_Crest_CascadeData[i_Index];
Cascade result;
result._Index = i_Index;
result._IndexI = i_Index;
result._Scale = perAll.x;
result._Weight = perAll.y;
result._MaximumWavelength = perAll.z;
@@ -232,6 +283,12 @@ struct Cascade
return float3((i_Position - _PositionSnapped) / (_Texel * _Resolution) + 0.5, _Index);
}
uint3 WorldToID(const float2 i_Position) m_ConstantReturn
{
const float3 uv = WorldToUV(i_Position);
return uint3(uv.xy * _Resolution, _IndexI);
}
float2 IDToWorld(const uint2 i_ID) m_ConstantReturn
{
return UVToWorld(IDToUV(i_ID));
@@ -354,6 +411,7 @@ struct Cascade
float4 position = SampleAnimatedWaves(uv);
io_LevelOffset += position.w * i_Weight;
io_Position += position.xyz * i_Weight;
io_Position.y += position.w * i_Weight;
// Derivatives
{
@@ -456,6 +514,13 @@ struct Cascade
return value;
}
void SampleSignedDepthFromSeaLevelAndDistance(const float2 i_Position, const float i_Weight, inout half io_Depth, inout half io_Distance) m_ConstantReturn
{
const half2 value = SampleSignedDepthFromSeaLevelAndDistance(i_Position) * i_Weight;
io_Depth += value.x;
io_Distance += value.y;
}
void SampleSignedDepthFromSeaLevel(const float2 i_Position, const float i_Weight, inout half io_Depth) m_ConstantReturn
{
io_Depth += (g_Crest_WaterCenter.y - SampleSceneHeight(i_Position)) * i_Weight;

View File

@@ -9,7 +9,7 @@
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl"
SamplerState LODData_linear_clamp_sampler;
SamplerState LODData_point_clamp_sampler;
SamplerState sampler_Crest_point_clamp;
SamplerState sampler_Crest_linear_repeat;
SamplerState _Crest_linear_clamp_sampler;
@@ -25,6 +25,11 @@ float g_Crest_ClipByDefault;
float g_Crest_LodAlphaBlackPointFade;
float g_Crest_LodAlphaBlackPointWhitePointFade;
// Refraction
float g_Crest_WaterDepthAtViewer;
float g_Crest_MaximumVerticalDisplacement;
float2 g_Crest_HorizonNormal;
// Hack - due to SV_IsFrontFace occasionally coming through as true for
// backfaces, add a param here that forces water to be in undrwater state. I
// think the root cause here might be imprecision or numerical issues at water

View File

@@ -0,0 +1,13 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#ifndef d_WaveHarmonic_Crest_Keywords
#define d_WaveHarmonic_Crest_Keywords
#define d_Crest_AlbedoLod CREST_ALBEDO_SIMULATION
#define d_Crest_FlowLod defined(_CREST_FLOW_LOD)
#define d_Crest_ShadowLod CREST_SHADOW_SIMULATION
#define d_Crest_AbsorptionLod CREST_ABSORPTION_SIMULATION
#define d_Crest_ScatteringLod CREST_SCATTERING_SIMULATION
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2e2c3338345cc4cc79fac0ec9b65a4f2
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,6 +13,22 @@
#define m_FloatMaximum 3.402823466e+38
//
// Fallback for WebGPU
//
#ifdef SHADER_API_WEBGPU
#define m_Float2 float4
#define m_Float2Constructor(x, y) float4(x, y, 0.0, 0.0)
#define m_Float2FromFloat2(p0) float4(p0.x, p0.y, 0, 0)
#else
#define m_Float2 float2
#define m_Float2Constructor(x, y) float2(x, y)
#define m_Float2FromFloat2(p0) p0
#endif
#if (CREST_FULL_PRECISION_DISPLACEMENT != 0)
#define m_DisplacementTexture(texture, components) texture<float##components>
#else

View File

@@ -1,19 +1,27 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#ifndef SETTINGS_CREST_HLSL
#define SETTINGS_CREST_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettings: static fields
//
#define CREST_PACKAGE_HDRP (1)
#define CREST_PACKAGE_URP (1)
#define CREST_PORTALS (0)
#define CREST_SHIFTING_ORIGIN (0)
#define CREST_FULL_PRECISION_DISPLACEMENT (1)
#define CREST_DISCARD_ATMOSPHERIC_SCATTERING (1)
#define CREST_LEGACY_UNDERWATER (0)
#ifndef d_WaveHarmonic_Crest_Settings
#define d_WaveHarmonic_Crest_Settings
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.hlsl"
#if CREST_PLATFORM_STANDALONE
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Standalone.hlsl"
#elif CREST_PLATFORM_SERVER
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Server.hlsl"
#elif CREST_PLATFORM_ANDROID
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Android.hlsl"
#elif CREST_PLATFORM_IOS
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.iOS.hlsl"
#elif CREST_PLATFORM_WEB
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Web.hlsl"
#elif CREST_PLATFORM_TVOS
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.tvOS.hlsl"
#elif CREST_PLATFORM_VISIONOS
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.visionOS.hlsl"
#else
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings/Settings.Crest.Default.hlsl"
#endif
#endif // d_WaveHarmonic_Crest_Settings

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bb30ad2b71bed4acca040c6ce2900f37
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_ANDROID_HLSL
#define SETTINGS_CREST_ANDROID_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsAndroid: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 307613c3b5e1c4f7da556862bfea5712
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_DEFAULT_HLSL
#define SETTINGS_CREST_DEFAULT_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsDefault: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9b6abac1d09714922b174070c93c9054
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_SERVER_HLSL
#define SETTINGS_CREST_SERVER_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsServer: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 15a7369ec789c4ae08ac764eab29463e
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_STANDALONE_HLSL
#define SETTINGS_CREST_STANDALONE_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsStandalone: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d9f563484a71c4e04a3aefcbef8ce36a
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_WEB_HLSL
#define SETTINGS_CREST_WEB_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsWeb: static fields
//
#define CREST_ALBEDO_SIMULATION (0)
#define CREST_ABSORPTION_SIMULATION (0)
#define CREST_SCATTERING_SIMULATION (0)
#define CREST_SHADOW_SIMULATION (0)
#define CREST_CAUSTICS_FORCE_DISTORTION (0)
#define CREST_FOAM_BIOLUMINESCENCE (0)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (0)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0eecd007d82c74bf88658c84586cda62
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_HLSL
#define SETTINGS_CREST_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettings: static fields
//
#define CREST_PACKAGE_HDRP (1)
#define CREST_PACKAGE_URP (1)
#define CREST_PORTALS (0)
#define CREST_SHIFTING_ORIGIN (0)
#define CREST_PLATFORM_STANDALONE (1)
#define CREST_PLATFORM_SERVER (0)
#define CREST_PLATFORM_ANDROID (0)
#define CREST_PLATFORM_IOS (0)
#define CREST_PLATFORM_WEB (0)
#define CREST_PLATFORM_TVOS (0)
#define CREST_PLATFORM_VISIONOS (0)
#define CREST_FULL_PRECISION_DISPLACEMENT (1)
#define CREST_DISCARD_ATMOSPHERIC_SCATTERING (1)
#define CREST_LEGACY_UNDERWATER (0)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b25f99570a3c543dca0d91bc54a4e27e
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_IOS_HLSL
#define SETTINGS_CREST_IOS_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsIOS: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9d8991669495c4da8b6d2d9c62dadcb1
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_TVOS_HLSL
#define SETTINGS_CREST_TVOS_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsTVOS: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bff51ef931a4443a7b6c1a2fc2b88772
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
//
// This file was automatically generated. Please don't edit by hand. Execute Editor command [ Edit > Rendering > Generate Shader Includes ] instead
//
#ifndef SETTINGS_CREST_VISIONOS_HLSL
#define SETTINGS_CREST_VISIONOS_HLSL
//
// WaveHarmonic.Crest.Editor.ShaderSettingsVisionOS: static fields
//
#define CREST_ALBEDO_SIMULATION (1)
#define CREST_ABSORPTION_SIMULATION (1)
#define CREST_SCATTERING_SIMULATION (1)
#define CREST_SHADOW_SIMULATION (1)
#define CREST_CAUSTICS_FORCE_DISTORTION (1)
#define CREST_FOAM_BIOLUMINESCENCE (1)
#define CREST_NORMAL_MAPS (1)
#define CREST_SIMPLE_TRANSPARENCY (0)
#define CREST_PLANAR_REFLECTIONS (1)
#endif

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d0648a06882284ebc88f4b28f3c6f825
ShaderIncludeImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -66,6 +66,67 @@ float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearS
return result;
}
float4 CubicWeights(const float f)
{
const float f2 = f * f;
const float f3 = f2 * f;
// CatmullRom (a = -0.5)
return float4
(
-0.5 * f3 + f2 - 0.5 * f,
1.5 * f3 - 2.5 * f2 + 1.0,
-1.5 * f3 + 2.0 * f2 + 0.5 * f,
0.5 * f3 - 0.5 * f2
);
}
float4 SampleBicubicRepeat
(
const Texture2DArray<float4> i_Texture,
const float2 i_UV,
const uint2 i_Size,
const uint i_Slice
)
{
// Convert to texel space (centered at pixel centers).
const float2 samplePosition = i_UV * (float2)i_Size - 0.5;
const int2 texelPosition = (int2)floor(samplePosition);
const float2 f = samplePosition - (float2)texelPosition;
// Precompute weights.
const float4 wx = CubicWeights(f.x);
const float4 wy = CubicWeights(f.y);
const uint2 size = i_Size - 1;
const uint4 x = uint4
(
(texelPosition.x - 1) & size.x,
(texelPosition.x + 0) & size.x,
(texelPosition.x + 1) & size.x,
(texelPosition.x + 2) & size.x
);
// Horizontal pass.
float4 row[4];
[unroll]
for (int j = -1; j <= 2; ++j)
{
const int y = (texelPosition.y + j) & size.y;
const float4 t0 = i_Texture[uint3(x.x, y, i_Slice)];
const float4 t1 = i_Texture[uint3(x.y, y, i_Slice)];
const float4 t2 = i_Texture[uint3(x.z, y, i_Slice)];
const float4 t3 = i_Texture[uint3(x.w, y, i_Slice)];
row[j + 1] = t0 * wx.x + t1 * wx.y + t2 * wx.z + t3 * wx.w;
}
// Vertical pass.
return row[0] * wy.x + row[1] * wy.y + row[2] * wy.z + row[3] * wy.w;
}
m_UtilityNameSpaceEnd
#endif // d_WaveHarmonic_Utility_Filtering

View File

@@ -43,6 +43,16 @@ float2 WorldNormalToScreenDirection(const float3 i_PositionWS, const float3 i_No
return direction;
}
float3 SafeComputeWorldSpacePosition(float2 positionNDC, float deviceDepth, float4x4 invViewProjMatrix)
{
float4 positionCS = ComputeClipSpacePosition(positionNDC, deviceDepth);
float4 hpositionWS = mul(invViewProjMatrix, positionCS);
// w is sometimes zero when using oblique projection.
// Zero is better than NaN.
return hpositionWS.w > 0.0 ? hpositionWS.xyz / hpositionWS.w : 0.0;
}
m_UtilityNameSpaceEnd
#endif // d_WaveHarmonic_Utility_Helpers

View File

@@ -86,6 +86,9 @@
// Transparent Objects Receives Shadows
//
// WebGPU does not like the binding.
#ifndef SHADER_API_WEBGPU
#if _SURFACE_TYPE_TRANSPARENT
#if _TRANSPARENT_RECEIVES_SHADOWS
#if SHADERPASS == SHADERPASS_FORWARD || SHADERPASS == SHADERPASS_FORWARD_ADD
@@ -108,4 +111,6 @@ float4 _ShadowMapTexture_TexelSize;
#endif
#endif
#endif // SHADER_API_WEBGPU
#endif // d_WaveHarmonic_Utility_ShaderGraphDefines

View File

@@ -21,24 +21,6 @@
#define CLUSTER_LIGHT_LOOP_SUBTRACTIVE_LIGHT_CHECK FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
#endif // FORWARD_PLUS_SUBTRACTIVE_LIGHT_CHECK
#if UNITY_VERSION >= 60000000
#if defined(STEREO_INSTANCING_ON) || defined(STEREO_MULTIVIEW_ON)
#if _ALPHATEST_ON
#if !USE_CLUSTER_LIGHT_LOOP
// If not clustered and additional light shadows and XR, the shading model
// completely breaks. It is like shadow attenuation is NaN or some obscure
// compiler issue. For 2022.3, it is broken for forward+ only, but cannot be fixed.
#define d_ShadowMaskBroken 1
#else
#if _RECEIVE_SHADOWS_OFF
// Right eye broken rendering similar to above.
#define d_AdditionalLightsBroken 1
#endif
#endif
#endif
#endif
#endif
#endif // CREST_URP
#if CREST_HDRP
@@ -78,7 +60,10 @@ void PrimaryLight
#elif CREST_BIRP
#ifndef USING_DIRECTIONAL_LIGHT
// Yes. This function wants the world position of the surface.
o_Direction = normalize(UnityWorldSpaceLightDir(i_PositionWS));
o_Direction = UnityWorldSpaceLightDir(i_PositionWS);
// Prevents divide by zero.
if (all(o_Direction == 0)) o_Direction = half3(0.0, 1.0, 0.0);
o_Direction = normalize(o_Direction);
#else
o_Direction = _WorldSpaceLightPos0.xyz;
// Prevents divide by zero.
@@ -153,14 +138,6 @@ LIGHT_LOOP_BEGIN(pixelLightCount)
// Includes shadows and cookies.
Light light = GetAdditionalLight(lightIndex, inputData, shadowMask, aoFactor);
#if d_ShadowMaskBroken
light.shadowAttenuation = 1.0;
#endif
#if d_AdditionalLightsBroken
light.color = 0.0;
#endif
#ifdef _LIGHT_LAYERS
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
#endif

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a381e15a67ba0474ea0e685cc27a6f8a
guid: 389b0f071dd5843c394f5255cd6ec73c
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: de25b8cb31cac9b4db1835b9632de8db
guid: ff5a7cc0943db46db9eac87f50e38097
folderAsset: yes
DefaultImporter:
externalObjects: {}