升级6.4.升级水,升级天气

This commit is contained in:
2026-04-05 00:26:54 +08:00
parent 63bc9b5536
commit 5f7cbfb713
635 changed files with 34718 additions and 22567 deletions

View File

@@ -1,6 +1,8 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#pragma exclude_renderers glcore gles3
#pragma kernel CrestQueryDisplacement d_CrestDisplacement
#pragma kernel CrestQueryFlow d_CrestFlow
#pragma kernel CrestQueryDepth d_CrestDepth
@@ -40,13 +42,13 @@ RWStructuredBuffer<float3> _Crest_Target;
m_CrestNameSpace
float3 Compute(const float2 i_Position, const float i_MinimumSlice, const float i_BaseScale)
float3 Compute(const float2 i_Position, const uint i_MinimumSlice, const float i_BaseScale)
{
// Do not use last slice - this is a 'transition' slice used to cross-fade waves
// between LOD resolutions to avoid pops. That being said, this will have clamped
// samples leading to objects floating on waves that do not exist.
uint slice0, slice1; float alpha;
PosToSliceIndices(i_Position, i_MinimumSlice, g_Crest_LodCount - 2.0, i_BaseScale, slice0, slice1, alpha);
PositionToSliceIndices(i_Position, i_MinimumSlice, g_Crest_LodCount - 2, i_BaseScale, slice0, slice1, alpha);
const Cascade cascade0 = Cascade::d_CrestMake(slice0);
const Cascade cascade1 = Cascade::d_CrestMake(slice1);
@@ -64,15 +66,9 @@ float3 Compute(const float2 i_Position, const float i_MinimumSlice, const float
void Query(const uint3 id)
{
const float3 data = _Crest_QueryPositions_MinimumGridSizes[id.x];
const float minimumGridSize = data.z;
const uint minimumSlice = data.z;
float2 position = data.xy;
const float gridSizeSlice0 = Cascade::d_CrestMake(0)._Texel;
// Displacements should not utilize the last slice which is used for transitioning
// waves between sampling resolutions. While it might be ok to use the last slice
// for other targets, we avoid using it to be consistent with displacements.
const float minimumSlice = clamp(floor(log2(max(minimumGridSize / gridSizeSlice0, 1.0))), 0.0, g_Crest_LodCount - 2.0);
#if d_CrestDisplacement
// Perform iteration to invert the displacement vector field - find position that displaces to query position,
// and return displacement at that point.