先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
65 lines
1.7 KiB
HLSL
65 lines
1.7 KiB
HLSL
|
|
struct Attributes
|
|
{
|
|
float4 positionOS : POSITION;
|
|
float4 normalOS : NORMAL;
|
|
float4 tangentOS : TANGENT;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct Varyings
|
|
{
|
|
half fogFactor : TEXCOORD1;
|
|
//wPos.x in w-component
|
|
float4 normalWS : NORMAL;
|
|
//wPos.y in w-component
|
|
float4 tangent : TANGENT;
|
|
//wPos.z in w-component
|
|
float4 bitangent : TEXCOORD4;
|
|
|
|
float4 positionNDC : TEXCOORD5;
|
|
|
|
float4 positionCS : SV_POSITION;
|
|
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
|
|
Varyings LitPassVertex(Attributes input)
|
|
{
|
|
Varyings output = (Varyings)0;
|
|
|
|
UNITY_SETUP_INSTANCE_ID(input);
|
|
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
|
|
|
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
|
|
|
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS.xyz, input.tangentOS);
|
|
|
|
//WaveInfo waves = GetWaveInfo(uv, TIME_VERTEX * _WaveSpeed, _WaveHeight, lerp(1, 0, vertexColor.b), _WaveFadeDistance.x, _WaveFadeDistance.y);
|
|
WaveInfo waves = GetWaveInfo(positionWS.xz, TIME_VERTEX * _WaveSpeed, _WaveHeight, 1, _WaveFadeDistance.x, _WaveFadeDistance.y);
|
|
|
|
//waves.normal = normalInput.normalWS;
|
|
//waves.position = 0;
|
|
|
|
//Apply vertex displacements
|
|
positionWS += waves.position.xyz;
|
|
|
|
float4 positionCS = TransformWorldToHClip(positionWS);
|
|
|
|
output.positionCS = positionCS;
|
|
|
|
float4 ndc = positionCS * 0.5f;
|
|
ndc.xy = float2(ndc.x, ndc.y * _ProjectionParams.x) + ndc.w;
|
|
ndc.zw = positionCS.zw;
|
|
output.positionNDC = ndc;
|
|
|
|
output.normalWS = float4(waves.normal, positionWS.x);
|
|
output.tangent = float4(normalInput.tangentWS, positionWS.y);
|
|
output.bitangent = float4(normalInput.bitangentWS, positionWS.z);
|
|
output.fogFactor = ComputeFogFactor(positionCS.z);
|
|
|
|
return output;
|
|
}
|