升级水插件

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

@@ -0,0 +1,36 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#pragma exclude_renderers glcore gles3
#pragma kernel CrestAdd
#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4
#if d_Float1
#define m_Type float
#elif d_Float2
#define m_Type float2
#elif d_Float3
#define m_Type float3
#elif d_Float4
#define m_Type float4
#endif
#include "HLSLSupport.cginc"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Macros.hlsl"
Texture2DArray<m_Type> _Crest_Source;
RWTexture2DArray<m_Type> _Crest_Target;
m_UtilityNameSpace
void Add(uint3 id)
{
_Crest_Target[id] += _Crest_Source[id];
}
m_UtilityNameSpaceEnd
m_UtilityKernelDefault(Add)

View File

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

View File

@@ -0,0 +1,63 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#pragma exclude_renderers glcore gles3
#pragma kernel BlurHorizontal
#pragma kernel BlurVertical
#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4
#if d_Float1
#define m_Type float
#elif d_Float2
#define m_Type float2
#elif d_Float3
#define m_Type float3
#elif d_Float4
#define m_Type float4
#endif
Texture2DArray<m_Type> _Crest_Source;
RWTexture2DArray<m_Type> _Crest_Target;
// (width, height, slices)
uint _Crest_Resolution;
// 5-tap Gaussian (sigma ≈ 1)
static const float w0 = 0.4026;
static const float w1 = 0.2442;
static const float w2 = 0.0545;
uint2 ClampXY(uint2 p)
{
return clamp(p, 0, _Crest_Resolution - 1);
}
[numthreads(8, 8, 1)]
void BlurHorizontal(uint3 id : SV_DispatchThreadID)
{
const int3 p = int3(id.x, id.y, id.z);
const int2 xy = p.xy;
_Crest_Target[p] =
_Crest_Source[id] * w0 +
_Crest_Source[uint3(ClampXY(xy + int2( 1, 0)), p.z)] * w1 +
_Crest_Source[uint3(ClampXY(xy + int2(-1, 0)), p.z)] * w1 +
_Crest_Source[uint3(ClampXY(xy + int2( 2, 0)), p.z)] * w2 +
_Crest_Source[uint3(ClampXY(xy + int2(-2, 0)), p.z)] * w2;
}
[numthreads(8, 8, 1)]
void BlurVertical(uint3 id : SV_DispatchThreadID)
{
const int3 p = int3(id.x, id.y, id.z);
const int2 xy = p.xy;
_Crest_Target[p] =
_Crest_Source[id] * w0 +
_Crest_Source[uint3(ClampXY(xy + int2(0, 1)), p.z)] * w1 +
_Crest_Source[uint3(ClampXY(xy + int2(0, -1)), p.z)] * w1 +
_Crest_Source[uint3(ClampXY(xy + int2(0, 2)), p.z)] * w2 +
_Crest_Source[uint3(ClampXY(xy + int2(0, -2)), p.z)] * w2;
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5a49c73b133c743caa1d82459943eabf
ComputeShaderImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,19 +3,33 @@
// Clear specific components using a mask.
#pragma exclude_renderers glcore gles3
#pragma kernel CrestClearTarget
#pragma kernel CrestClearTargetBoundaryX d_BoundaryX
#pragma kernel CrestClearTargetBoundaryY d_BoundaryY
#pragma multi_compile_local d_Float1 d_Float2 d_Float3 d_Float4
#if d_Float1
#define m_Type float
#elif d_Float2
#define m_Type float2
#elif d_Float3
#define m_Type float3
#elif d_Float4
#define m_Type float4
#endif
#include "HLSLSupport.cginc"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Macros.hlsl"
RWTexture2DArray<float4> _Crest_Target;
RWTexture2DArray<m_Type> _Crest_Target;
CBUFFER_START(CrestPerMaterial)
float4 _Crest_ClearMask;
float4 _Crest_ClearColor;
m_Type _Crest_ClearMask;
m_Type _Crest_ClearColor;
uint _Crest_Resolution;
uint _Crest_TargetSlice;
CBUFFER_END

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7c6a37fe33f609947b680abac9e850cc
guid: 5801035604cb84ff5a9557a2173630cd
folderAsset: yes
DefaultImporter:
externalObjects: {}