修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -0,0 +1,34 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#pragma kernel CrestVisualizeNegativeValues_Scalar
#pragma kernel CrestVisualizeNegativeValues_Array _ARRAY
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Macros.hlsl"
#ifdef _ARRAY
#define d_RWTexture RWTexture2DArray
#else
#define d_RWTexture RWTexture2D
#endif
#ifdef _ARRAY
#define d_RWTextureCoordinates(id) id
#else
#define d_RWTextureCoordinates(id) id.xy
#endif
d_RWTexture<float4> _Crest_Target;
m_UtilityNameSpace
void VisualizeNegativeValues(uint3 id)
{
_Crest_Target[d_RWTextureCoordinates(id)] += 1.0;
_Crest_Target[d_RWTextureCoordinates(id)] *= 0.5;
}
m_UtilityNameSpaceEnd
m_UtilityKernelDefaultVariant(VisualizeNegativeValues, _Scalar)
m_UtilityKernelDefaultVariant(VisualizeNegativeValues, _Array)

View File

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

View File

@@ -0,0 +1,85 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
#ifndef d_WaterLevelDepth
#define d_WaterLevelDepth
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Macros.hlsl"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/InputsDriven.hlsl"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Cascade.hlsl"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Surface/Geometry.hlsl"
m_CrestNameSpace
struct Attributes
{
float3 positionOS : POSITION;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
};
Varyings Vertex(Attributes attributes)
{
// This will work for all pipelines.
Varyings varyings = (Varyings)0;
const Cascade cascade0 = Cascade::Make(_Crest_LodIndex);
const Cascade cascade1 = Cascade::Make(_Crest_LodIndex + 1);
float3 positionWS = mul(UNITY_MATRIX_M, float4(attributes.positionOS.xyz, 1.0)).xyz;
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
positionWS.xz += _WorldSpaceCameraPos.xz;
#endif
float alpha;
SnapAndTransitionVertLayout(_Crest_ChunkMeshScaleAlpha, cascade0, _Crest_ChunkGeometryGridWidth, positionWS, alpha);
{
// :WaterGridPrecisionErrors
float2 center = UNITY_MATRIX_M._m03_m23;
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
center += _WorldSpaceCameraPos.xz;
#endif
const float2 camera = abs(_WorldSpaceCameraPos.xz);
positionWS.xz = lerp(center, positionWS.xz, lerp(1.0, 1.01, max(camera.x, camera.y) * 0.00001));
}
const float weight0 = (1.0 - alpha) * cascade0._Weight;
const float weight1 = (1.0 - weight0) * cascade1._Weight;
half offset = 0.0;
if (weight0 > m_CrestSampleLodThreshold)
{
Cascade::MakeLevel(_Crest_LodIndex).SampleLevel(positionWS.xz, weight0, offset);
}
if (weight1 > m_CrestSampleLodThreshold)
{
Cascade::MakeLevel(_Crest_LodIndex + 1).SampleLevel(positionWS.xz, weight1, offset);
}
positionWS.y += offset;
#if (SHADEROPTIONS_CAMERA_RELATIVE_RENDERING != 0)
positionWS.xz -= _WorldSpaceCameraPos.xz;
#endif
varyings.positionCS = mul(UNITY_MATRIX_VP, float4(positionWS, 1.0));
return varyings;
}
half4 Fragment(Varyings varyings)
{
return half4(0.0, 0.0, 0.0, 1.0);
}
m_CrestNameSpaceEnd
m_CrestVertex
m_CrestFragment(half4)
#endif // d_WaterLevelDepth

View File

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

View File

@@ -0,0 +1,74 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
Shader "Hidden/Crest/Editor/Water Level (Depth)"
{
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.high-definition"
}
Tags { "RenderPipeline"="HDRenderPipeline" }
Pass
{
Cull Back
HLSLPROGRAM
#pragma vertex Vertex
#pragma fragment Fragment
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
#include "Packages/com.waveharmonic.crest/Editor/Shaders/WaterLevel.hlsl"
ENDHLSL
}
}
SubShader
{
PackageRequirements
{
"com.unity.render-pipelines.universal"
}
Tags { "RenderPipeline"="UniversalPipeline" }
Pass
{
Cull Back
HLSLPROGRAM
#pragma vertex Vertex
#pragma fragment Fragment
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.waveharmonic.crest/Editor/Shaders/WaterLevel.hlsl"
ENDHLSL
}
}
SubShader
{
Pass
{
Cull Back
HLSLPROGRAM
#pragma vertex Vertex
#pragma fragment Fragment
#include "UnityCG.cginc"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Core.hlsl"
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/InputsDriven.hlsl"
#include "Packages/com.waveharmonic.crest/Editor/Shaders/WaterLevel.hlsl"
ENDHLSL
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cbfa79cd4adf840128ddd9c3be065074
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
// Crest Water System
// Copyright © 2024 Wave Harmonic. All rights reserved.
Shader "Hidden/Crest/Editor/WaterProxy"
{
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
UNITY_TRANSFER_FOG(o, o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = fixed4(0.0, 0.3, 1.0, 0.5);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 64f548899ca4e4bfab9b53303d8b9c84
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: