升级水插件
This commit is contained in:
@@ -20,10 +20,12 @@ Shader "Crest/Inputs/Absorption/Color"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
@@ -19,12 +19,13 @@ Shader "Crest/Inputs/Albedo/Color"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend [_Crest_BlendModeSource] [_Crest_BlendModeTarget]
|
||||
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vertex
|
||||
#pragma fragment Fragment
|
||||
|
||||
@@ -18,6 +18,8 @@ Shader "Crest/Inputs/Animated Waves/Add From Texture"
|
||||
SubShader
|
||||
{
|
||||
Blend One One
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
@@ -25,7 +27,7 @@ Shader "Crest/Inputs/Animated Waves/Add From Texture"
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
#pragma shader_feature_local d_HeightsOnly
|
||||
#pragma shader_feature_local_fragment d_HeightsOnly
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// Push water under the geometry. Needs to be rendered into all LODs - set Octave Wave length to 0.
|
||||
@@ -13,6 +13,9 @@ Shader "Crest/Inputs/Animated Waves/Push Water Under Convex Hull"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
BlendOp Min
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// This writes straight into the displacement texture and sets the water height to the y value of the geometry.
|
||||
@@ -16,6 +16,9 @@ Shader "Crest/Inputs/Animated Waves/Set Water Height Using Geometry"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend Off
|
||||
|
||||
@@ -16,6 +16,9 @@ Shader "Crest/Inputs/Animated Waves/Wave Particle"
|
||||
{
|
||||
Tags { "DisableBatching" = "True" }
|
||||
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend One One
|
||||
|
||||
@@ -14,6 +14,9 @@ Shader "Crest/Inputs/Dynamic Waves/Add Bump"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend One One
|
||||
|
||||
@@ -14,6 +14,9 @@ Shader "Crest/Inputs/Dynamic Waves/Dampen Circle"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
@@ -26,6 +26,8 @@ Shader "Crest/Inputs/Flow/Add From Texture"
|
||||
SubShader
|
||||
{
|
||||
Blend One One
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
@@ -33,10 +35,10 @@ Shader "Crest/Inputs/Flow/Add From Texture"
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
#pragma shader_feature_local d_FlipX
|
||||
#pragma shader_feature_local d_FlipZ
|
||||
#pragma shader_feature_local d_Feather
|
||||
#pragma shader_feature_local d_NegativeValues
|
||||
#pragma shader_feature_local_fragment d_FlipX
|
||||
#pragma shader_feature_local_fragment d_FlipZ
|
||||
#pragma shader_feature_local_fragment d_Feather
|
||||
#pragma shader_feature_local_fragment d_NegativeValues
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ Shader "Crest/Inputs/Flow/Fixed Direction"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
@@ -28,7 +31,7 @@ Shader "Crest/Inputs/Flow/Fixed Direction"
|
||||
#pragma fragment Frag
|
||||
|
||||
#pragma shader_feature_local d_Feather
|
||||
#pragma shader_feature_local d_ApplyRotation
|
||||
#pragma shader_feature_local_fragment d_ApplyRotation
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ Shader "Crest/Inputs/Foam/Add From Texture"
|
||||
SubShader
|
||||
{
|
||||
Blend One One
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
Shader "Crest/Inputs/Foam/Add From Vertex Colors"
|
||||
@@ -14,6 +14,8 @@ Shader "Crest/Inputs/Foam/Add From Vertex Colors"
|
||||
SubShader
|
||||
{
|
||||
Blend One One
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ RWTexture2DArray<float3> _Crest_Target;
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
int _Crest_Blend;
|
||||
float _Crest_Weight;
|
||||
float4 _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -42,7 +43,7 @@ void Execute(uint3 id)
|
||||
return;
|
||||
}
|
||||
|
||||
const half4 source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0);
|
||||
const half4 source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0) * _Crest_Multiplier;
|
||||
const half3 target = _Crest_Target[id];
|
||||
weight *= source.a;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// Renders convex hull to the clip surface texture.
|
||||
@@ -70,8 +70,9 @@ Shader "Hidden/Crest/Inputs/Clip/Convex Hull"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZWrite Off
|
||||
ColorMask R
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@ Texture2D _Crest_Texture;
|
||||
RWTexture2DArray<float> _Crest_Target;
|
||||
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
float _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -36,7 +37,7 @@ void Execute(uint3 id)
|
||||
return;
|
||||
}
|
||||
|
||||
const float result = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0).x;
|
||||
const float result = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0).x * _Crest_Multiplier;
|
||||
|
||||
// Painted clip defines a minimum value of the clip.
|
||||
_Crest_Target[id] = max(_Crest_Target[id], result);
|
||||
|
||||
@@ -29,6 +29,7 @@ Texture2D<m_CrestType> _Crest_Texture;
|
||||
RWTexture2DArray<m_CrestType> _Crest_Target;
|
||||
|
||||
CBUFFER_START(CrestInputTexture)
|
||||
float2 _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -50,7 +51,7 @@ void Execute(uint3 id)
|
||||
}
|
||||
|
||||
m_CrestType current = _Crest_Target[id];
|
||||
m_CrestType result = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0);
|
||||
m_CrestType result = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0) * _Crest_Multiplier;
|
||||
result.x += _Crest_HeightOffset;
|
||||
|
||||
// Take highest terrain height.
|
||||
|
||||
@@ -20,6 +20,7 @@ RWTexture2DArray<float2> _Crest_Target;
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
int _Crest_Blend;
|
||||
float _Crest_Weight;
|
||||
float2 _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -53,6 +54,8 @@ void Execute(uint3 id)
|
||||
source = source * 2.0 - 1.0;
|
||||
}
|
||||
|
||||
source *= _Crest_Multiplier;
|
||||
|
||||
if (_Crest_Blend == m_CrestBlendAlpha)
|
||||
{
|
||||
weight *= saturate(length(source));
|
||||
|
||||
@@ -20,6 +20,7 @@ RWTexture2DArray<float> _Crest_Target;
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
int _Crest_Blend;
|
||||
float _Crest_Weight;
|
||||
float _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -45,7 +46,7 @@ void Execute(uint3 id)
|
||||
return;
|
||||
}
|
||||
|
||||
const float source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0).x;
|
||||
const float source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0).x * _Crest_Multiplier;
|
||||
const float target = _Crest_Target[id];
|
||||
|
||||
_Crest_Target[id] = Blend(_Crest_Blend, weight, _Crest_SimDeltaTime, source, target);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// An implementation of the Jump Flood algorithm by Rong and Tan
|
||||
|
||||
@@ -23,6 +23,7 @@ RWTexture2DArray<float> _Crest_Target;
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
int _Crest_Blend;
|
||||
float _Crest_Weight;
|
||||
float _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -48,10 +49,11 @@ void Execute(uint3 id)
|
||||
}
|
||||
|
||||
#if d_CatmullRom
|
||||
const float source = Utility::SampleTextureCatmullRom(_Crest_Texture, LODData_linear_clamp_sampler, uv, _Crest_Resolution).x;
|
||||
const float source = Utility::SampleTextureCatmullRom(_Crest_Texture, LODData_linear_clamp_sampler, uv, _Crest_Resolution)
|
||||
#else
|
||||
const float source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0.0).x;
|
||||
const float source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0.0)
|
||||
#endif
|
||||
.x * _Crest_Multiplier;
|
||||
|
||||
const float target = _Crest_Target[id];
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ RWTexture2DArray<float3> _Crest_Target;
|
||||
CBUFFER_START(CrestPerMaterial)
|
||||
int _Crest_Blend;
|
||||
float _Crest_Weight;
|
||||
float4 _Crest_Multiplier;
|
||||
float2 _Crest_TextureSize;
|
||||
float2 _Crest_TexturePosition;
|
||||
float2 _Crest_TextureRotation;
|
||||
@@ -42,7 +43,7 @@ void Execute(uint3 id)
|
||||
return;
|
||||
}
|
||||
|
||||
const half4 source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0);
|
||||
const half4 source = _Crest_Texture.SampleLevel(LODData_linear_clamp_sampler, uv, 0) * _Crest_Multiplier;
|
||||
const half3 target = _Crest_Target[id];
|
||||
weight *= source.a;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
Shader "Crest/Inputs/All/Override"
|
||||
@@ -15,11 +15,13 @@ Shader "Crest/Inputs/All/Override"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend Off
|
||||
ColorMask [_Crest_ColorMask]
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vertex
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// 0-1 scaling of existing water data using multiplicative blending.
|
||||
@@ -32,6 +32,9 @@ Shader "Crest/Inputs/All/Scale"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
// Multiply
|
||||
@@ -42,8 +45,8 @@ Shader "Crest/Inputs/All/Scale"
|
||||
#pragma fragment Frag
|
||||
|
||||
#pragma shader_feature_local d_Texture
|
||||
#pragma shader_feature_local d_Invert
|
||||
#pragma shader_feature_local d_Feather
|
||||
#pragma shader_feature_local_fragment d_Invert
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
@@ -17,10 +17,12 @@ Shader "Crest/Inputs/Scattering/Color"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
ColorMask RGB
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// Generates waves from geometry that is rendered into the water simulation from a top down camera. Expects
|
||||
@@ -39,7 +39,7 @@ Shader "Crest/Inputs/Shape Waves/Add From Geometry"
|
||||
#pragma fragment Fragment
|
||||
// #pragma enable_d3d11_debug_symbols
|
||||
|
||||
#pragma shader_feature_local d_Feather
|
||||
#pragma shader_feature_local_fragment d_Feather
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
Shader "Crest/Inputs/All/Utility"
|
||||
@@ -17,12 +17,14 @@ Shader "Crest/Inputs/All/Utility"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend [_Crest_BlendModeSource] [_Crest_BlendModeTarget]
|
||||
BlendOp [_Crest_BlendOperation]
|
||||
ColorMask [_Crest_ColorMask]
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex Vertex
|
||||
|
||||
@@ -12,6 +12,9 @@ Shader "Crest/Inputs/Depth/Water Depth From Geometry"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
BlendOp Max
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Crest Water System
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// This sets base water height to Y value of geometry.
|
||||
@@ -17,6 +17,9 @@ Shader "Crest/Inputs/Level/Water Level From Geometry"
|
||||
|
||||
SubShader
|
||||
{
|
||||
ZTest Always
|
||||
ZWrite Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend [_Crest_BlendSource] [_Crest_BlendTarget]
|
||||
|
||||
Reference in New Issue
Block a user