升级水插件
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user