还原水插件
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#define CREST_UNDERWATER_EFFECT_SHARED_INCLUDED
|
||||
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Settings.Crest.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Keywords.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Constants.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl"
|
||||
@@ -14,9 +13,6 @@
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Depth.hlsl"
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Helpers.hlsl"
|
||||
|
||||
#undef d_Crest_CausticsForceDistortion
|
||||
#define d_Crest_CausticsForceDistortion 1
|
||||
|
||||
#if d_Crest_Portal
|
||||
#include "Packages/com.waveharmonic.crest.portals/Runtime/Shaders/Library/Portals.hlsl"
|
||||
#endif
|
||||
@@ -203,9 +199,7 @@ half3 ApplyUnderwaterEffect
|
||||
const bool hasCaustics,
|
||||
const bool i_OutScatterScene,
|
||||
const bool i_ApplyLighting,
|
||||
const half i_multiplier,
|
||||
out half3 volumeOpacity,
|
||||
out half3 volumeLight
|
||||
const half i_multiplier
|
||||
)
|
||||
{
|
||||
const bool isUnderwater = true;
|
||||
@@ -214,8 +208,8 @@ half3 ApplyUnderwaterEffect
|
||||
PrimaryLight(i_positionWS, lightColor, lightDirection);
|
||||
|
||||
// Uniform effect calculated from camera position.
|
||||
volumeLight = 0.0;
|
||||
volumeOpacity = 1.0;
|
||||
half3 volumeLight = 0.0;
|
||||
half3 volumeOpacity = 1.0;
|
||||
{
|
||||
half3 absorption = _Crest_Absorption.xyz;
|
||||
half3 scattering = _Crest_Scattering.xyz;
|
||||
@@ -230,20 +224,19 @@ half3 ApplyUnderwaterEffect
|
||||
absorption *= _Crest_ExtinctionMultiplier;
|
||||
scattering *= _Crest_ExtinctionMultiplier;
|
||||
|
||||
const float4 displacement = Cascade::MakeAnimatedWaves(sliceIndex).Sample(_WorldSpaceCameraPos.xz);
|
||||
const float waterLevel = g_Crest_WaterCenter.y + displacement.y + displacement.w;
|
||||
const float waterLevel = g_Crest_WaterCenter.y + Cascade::MakeAnimatedWaves(sliceIndex).Sample(_WorldSpaceCameraPos.xz).w;
|
||||
|
||||
half shadow = 1.0;
|
||||
#if d_Crest_ShadowLod
|
||||
{
|
||||
// #if CREST_SHADOWS_ON
|
||||
// Camera should be at center of LOD system so no need for blending (alpha, weights, etc). This might not be
|
||||
// the case if there is large horizontal displacement, but the _Crest_DataSliceOffset should help by setting a
|
||||
// large enough slice as minimum.
|
||||
half2 shadowSoftHard = Cascade::MakeShadow(sliceIndex).SampleShadow(_WorldSpaceCameraPos.xz);
|
||||
// Soft in red, hard in green. But hard not computed in HDRP.
|
||||
shadow = 1.0 - shadowSoftHard.x;
|
||||
// #endif
|
||||
}
|
||||
#endif
|
||||
|
||||
half3 ambientLighting = AmbientLight(_Crest_AmbientLighting);
|
||||
|
||||
@@ -296,7 +289,7 @@ half3 ApplyUnderwaterEffect
|
||||
|
||||
const uint slice0 = PositionToSliceIndex(i_positionWS.xz, 0, g_Crest_WaterScale);
|
||||
|
||||
#if d_Crest_FlowLod
|
||||
#ifdef CREST_FLOW_ON
|
||||
half2 flowData = Cascade::MakeFlow(slice0).SampleFlow(i_positionWS.xz);
|
||||
const Flow flow = Flow::Make(flowData, g_Crest_Time);
|
||||
blur = _Crest_CausticsMotionBlur;
|
||||
@@ -307,7 +300,7 @@ half3 ApplyUnderwaterEffect
|
||||
|
||||
sceneColour *= Caustics
|
||||
(
|
||||
#if d_Crest_FlowLod
|
||||
#ifdef CREST_FLOW_ON
|
||||
flow,
|
||||
#endif
|
||||
i_positionWS,
|
||||
|
||||
Reference in New Issue
Block a user