[M] remove input UV

This commit is contained in:
2024-07-19 18:28:47 +08:00
parent 8a78f03983
commit 56a1e3da98
2 changed files with 6 additions and 14 deletions

View File

@@ -3,11 +3,12 @@
#define WATER_COMMON_INCLUDED #define WATER_COMMON_INCLUDED
//As per the "Shader" section of the documentation, this is primarily used for synchronizing animations in networked applications. //As per the "Shader" section of the documentation, this is primarily used for synchronizing animations in networked applications.
#define TIME_FRAG_INPUT input.uv.z //#define TIME_FRAG_INPUT input.uv.z
#define TIME_VERTEX_OUTPUT output.uv.z //#define TIME_VERTEX_OUTPUT output.uv.z
#define TIME ((TIME_FRAG_INPUT * _Speed) * -_Direction.xy) //#define TIME ((TIME_FRAG_INPUT * _Speed) * -_Direction.xy)
#define TIME_VERTEX ((TIME_VERTEX_OUTPUT * _Speed) * -_Direction.xy) //#define TIME_VERTEX ((TIME_VERTEX_OUTPUT * _Speed) * -_Direction.xy)
#define TIME_VERTEX ((_TimeParameters.x * _Speed) * -_Direction.xy)
#define HORIZONTAL_DISPLACEMENT_SCALAR 0.01 #define HORIZONTAL_DISPLACEMENT_SCALAR 0.01
#define UP_VECTOR float3(0,1,0) #define UP_VECTOR float3(0,1,0)

View File

@@ -2,7 +2,6 @@
struct Attributes struct Attributes
{ {
float4 positionOS : POSITION; float4 positionOS : POSITION;
float4 uv : TEXCOORD0;
float4 normalOS : NORMAL; float4 normalOS : NORMAL;
float4 tangentOS : TANGENT; float4 tangentOS : TANGENT;
@@ -11,8 +10,6 @@ struct Attributes
struct Varyings struct Varyings
{ {
float4 uv : TEXCOORD0;
half4 fogFactorAndVertexLight : TEXCOORD1; // x: fogFactor, yzw: vertex light half4 fogFactorAndVertexLight : TEXCOORD1; // x: fogFactor, yzw: vertex light
//wPos.x in w-component //wPos.x in w-component
@@ -37,18 +34,12 @@ Varyings LitPassVertex(Attributes input)
UNITY_SETUP_INSTANCE_ID(input); UNITY_SETUP_INSTANCE_ID(input);
UNITY_TRANSFER_INSTANCE_ID(input, output); UNITY_TRANSFER_INSTANCE_ID(input, output);
output.uv.xy = input.uv.xy;
output.uv.z = _TimeParameters.x;
output.uv.w = 0;
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz); float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS.xyz, input.tangentOS); VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS.xyz, input.tangentOS);
float2 uv = positionWS.xz;
//WaveInfo waves = GetWaveInfo(uv, TIME_VERTEX * _WaveSpeed, _WaveHeight, lerp(1, 0, vertexColor.b), _WaveFadeDistance.x, _WaveFadeDistance.y); //WaveInfo waves = GetWaveInfo(uv, TIME_VERTEX * _WaveSpeed, _WaveHeight, lerp(1, 0, vertexColor.b), _WaveFadeDistance.x, _WaveFadeDistance.y);
WaveInfo waves = GetWaveInfo(uv, TIME_VERTEX * _WaveSpeed, _WaveHeight, 1, _WaveFadeDistance.x, _WaveFadeDistance.y); WaveInfo waves = GetWaveInfo(positionWS.xz, TIME_VERTEX * _WaveSpeed, _WaveHeight, 1, _WaveFadeDistance.x, _WaveFadeDistance.y);
//waves.normal = normalInput.normalWS; //waves.normal = normalInput.normalWS;
//waves.position = 0; //waves.position = 0;