先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
65 lines
1.6 KiB
HLSL
65 lines
1.6 KiB
HLSL
|
|
#ifndef 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.
|
|
//#define TIME_FRAG_INPUT input.uv.z
|
|
//#define TIME_VERTEX_OUTPUT output.uv.z
|
|
|
|
//#define TIME ((TIME_FRAG_INPUT * _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 UP_VECTOR float3(0,1,0)
|
|
#define RAD2DEGREE 57.29578
|
|
|
|
struct WaterSurface
|
|
{
|
|
float3 positionWS;
|
|
float3 viewDelta; //Un-normalized view direction,
|
|
float3 viewDir;
|
|
|
|
//Normal from the base geometry, in world-space
|
|
float3 vertexNormal;
|
|
float3 tangentNormal;
|
|
float3 tangentWorldNormal;
|
|
|
|
float3 albedo;
|
|
float3 offset;
|
|
float alpha;
|
|
float fog;
|
|
float edgeFade;
|
|
float intersection;
|
|
|
|
float3 reflections;
|
|
float reflectionMask;
|
|
};
|
|
|
|
struct SceneDepth
|
|
{
|
|
float raw;
|
|
float linear01;
|
|
float eye;
|
|
};
|
|
|
|
#define FAR_CLIP _ProjectionParams.z
|
|
#define NEAR_CLIP _ProjectionParams.y
|
|
//Scale linear values to the clipping planes for orthographic projection (unity_OrthoParams.w = 1 = orthographic)
|
|
#define DEPTH_SCALAR (FAR_CLIP - NEAR_CLIP)
|
|
|
|
//Return depth based on the used technique (buffer, vertex color, baked texture)
|
|
SceneDepth SampleDepth(float2 uv)
|
|
{
|
|
SceneDepth depth = (SceneDepth)0;
|
|
|
|
float raw = SampleSceneDepth(uv);
|
|
depth.raw = raw;
|
|
depth.eye = LinearEyeDepth(raw, _ZBufferParams);
|
|
depth.linear01 = Linear01Depth(raw, _ZBufferParams) * DEPTH_SCALAR;
|
|
|
|
return depth;
|
|
}
|
|
|
|
#endif
|