升级6.4.升级水,升级天气
This commit is contained in:
@@ -11,8 +11,6 @@
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Globals.hlsl"
|
||||
|
||||
float2 _Crest_HorizonNormal;
|
||||
|
||||
TEXTURE2D_X(_Crest_WaterMaskTexture);
|
||||
|
||||
m_CrestNameSpace
|
||||
@@ -45,7 +43,7 @@ half4 Fragment(Varyings input)
|
||||
|
||||
const uint2 positionSS = input.positionCS.xy;
|
||||
const float mask = LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, positionSS).x;
|
||||
const float2 offset = -((float2)mask) * _Crest_HorizonNormal;
|
||||
const float2 offset = -((float2)mask) * g_Crest_HorizonNormal;
|
||||
float weight = 1.0;
|
||||
|
||||
// Sample three pixels along the normal. If the sample is different than the
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl"
|
||||
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Shim.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Keywords.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Lighting.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/VolumeLighting.hlsl"
|
||||
|
||||
@@ -34,12 +35,14 @@ half _Crest_ShadowsAffectsAmbientFactor;
|
||||
// Volume parameters.
|
||||
half _Crest_SunBoost;
|
||||
half3 _Crest_AmbientLighting;
|
||||
int _Crest_DataSliceOffset;
|
||||
uint _Crest_DataSliceOffset;
|
||||
#endif
|
||||
|
||||
half _Crest_Radius;
|
||||
half _Crest_RefractionStrength;
|
||||
|
||||
bool _Crest_PortalInverted;
|
||||
|
||||
m_CrestNameSpace
|
||||
|
||||
struct Attributes
|
||||
@@ -87,7 +90,7 @@ half4 Fragment(Varyings input)
|
||||
|
||||
#if d_Masked
|
||||
// Prevent rendering inside of new portal modules.
|
||||
if (LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, input.positionCS.xy).r == k_Crest_MaskInsidePortal)
|
||||
if ((LOAD_TEXTURE2D_X(_Crest_WaterMaskTexture, input.positionCS.xy).r == k_Crest_MaskInsidePortal) == _Crest_PortalInverted)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
@@ -154,10 +157,21 @@ half4 Fragment(Varyings input)
|
||||
half3 scattering = _Crest_Scattering.xyz;
|
||||
|
||||
// Keep the same as the volume.
|
||||
const int sliceIndex = clamp(_Crest_DataSliceOffset, 0, g_Crest_LodCount - 2);
|
||||
const uint sliceIndex = clamp(_Crest_DataSliceOffset, 0, g_Crest_LodCount - 2);
|
||||
|
||||
if (g_Crest_SampleAbsorptionSimulation) absorption = Cascade::MakeAbsorption(sliceIndex).Sample(_WorldSpaceCameraPos.xz).xyz;
|
||||
if (g_Crest_SampleScatteringSimulation) scattering = Cascade::MakeScattering(sliceIndex).Sample(_WorldSpaceCameraPos.xz).xyz;
|
||||
#if d_Crest_AbsorptionLod
|
||||
if (g_Crest_SampleAbsorptionSimulation)
|
||||
{
|
||||
absorption = Cascade::MakeAbsorption(sliceIndex).Sample(_WorldSpaceCameraPos.xz).xyz;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if d_Crest_ScatteringLod
|
||||
if (g_Crest_SampleScatteringSimulation)
|
||||
{
|
||||
scattering = Cascade::MakeScattering(sliceIndex).Sample(_WorldSpaceCameraPos.xz).xyz;
|
||||
}
|
||||
#endif
|
||||
|
||||
float3 lightDirection; float3 lightColor;
|
||||
PrimaryLight(positionWS, lightColor, lightDirection);
|
||||
@@ -174,10 +188,13 @@ half4 Fragment(Varyings input)
|
||||
#endif
|
||||
|
||||
half shadow = 1.0;
|
||||
|
||||
#if d_Crest_ShadowLod
|
||||
{
|
||||
// Soft in red, hard in green. But hard not computed in HDRP.
|
||||
shadow = 1.0 - Cascade::MakeShadow(sliceIndex).SampleShadow(_WorldSpaceCameraPos.xz).x;
|
||||
}
|
||||
#endif
|
||||
|
||||
half3 lighting = VolumeLighting
|
||||
(
|
||||
@@ -190,8 +207,10 @@ half4 Fragment(Varyings input)
|
||||
lerp(half3(0, -1, 0), lightDirection, opacity),
|
||||
lightColor,
|
||||
half3(0.0, 0.0, 0.0), // Additional lights
|
||||
1.0, // Additional light blend
|
||||
_Crest_AmbientTerm,
|
||||
_Crest_DirectTerm,
|
||||
1.0, // Additional light term
|
||||
_Crest_SunBoost,
|
||||
_Crest_ShadowsAffectsAmbientFactor
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user