移除水
This commit is contained in:
@@ -1,257 +0,0 @@
|
||||
// Crest Water System
|
||||
|
||||
// This file is subject to the Unity Companion License:
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/7ff8fd444c179fd9bb380d61f4865be6935b47dd/LICENSE.md
|
||||
|
||||
// Adds functions from SRP.
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/8f54e6591e93fb3bf8e9879a0e43665dfbe2f629/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
|
||||
|
||||
#ifndef UNITY_COMMON_INCLUDED
|
||||
#define UNITY_COMMON_INCLUDED
|
||||
|
||||
// Add "real" alias for "fixed". Helps with including files downstream.
|
||||
|
||||
#define real fixed
|
||||
#define real2 fixed2
|
||||
#define real3 fixed3
|
||||
#define real4 fixed4
|
||||
|
||||
// Commented lines have no "fixed" equivalent.
|
||||
|
||||
#define real2x2 fixed2x2
|
||||
// #define real2x3 fixed2x3
|
||||
// #define real2x4 fixed2x4
|
||||
// #define real3x2 fixed3x2
|
||||
#define real3x3 fixed3x3
|
||||
// #define real3x4 fixed3x4
|
||||
// #define real4x3 fixed4x3
|
||||
#define real4x4 fixed4x4
|
||||
|
||||
//
|
||||
// MACROS
|
||||
//
|
||||
|
||||
#define ZERO_INITIALIZE(type, name) UNITY_INITIALIZE_OUTPUT(type,name)
|
||||
#define TransformObjectToHClip(positionOS) UnityObjectToClipPos(float4(positionOS, 1.0))
|
||||
|
||||
// Taken from:
|
||||
// com.unity.render-pipelines.core@10.5.0/ShaderLibrary/API/D3D11.hlsl
|
||||
// com.unity.render-pipelines.core@10.5.0/ShaderLibrary/API/Metal.hlsl
|
||||
// com.unity.render-pipelines.core@10.5.0/ShaderLibrary/API/Switch.hlsl
|
||||
// com.unity.render-pipelines.core@10.5.0/ShaderLibrary/API/Vulkan.hlsl
|
||||
|
||||
// GameCore, PSSL etc require an NDA so hard to confirm how some of these APIs are implemented, but the PPv2 package has
|
||||
// some of APIs (the ones we use) and they are the same:
|
||||
// com.unity.postprocessing/PostProcessing/Shaders/API/
|
||||
|
||||
// Texture abstraction.
|
||||
|
||||
#define TEXTURE2D(textureName) UNITY_DECLARE_TEX2D_NOSAMPLER(textureName)
|
||||
#define TEXTURE2D_ARRAY(textureName) UNITY_DECLARE_TEX2DARRAY_NOSAMPLER(textureName)
|
||||
#define TEXTURECUBE(textureName) UNITY_DECLARE_TEXCUBE_NOSAMPLER(textureName)
|
||||
// #define TEXTURECUBE_ARRAY(textureName) TextureCubeArray textureName
|
||||
// #define TEXTURE3D(textureName) Texture3D textureName
|
||||
|
||||
// #ifdef SHADER_API_D3D11
|
||||
|
||||
// #define TEXTURE2D_FLOAT(textureName) TEXTURE2D(textureName)
|
||||
// #define TEXTURE2D_ARRAY_FLOAT(textureName) TEXTURE2D_ARRAY(textureName)
|
||||
// #define TEXTURECUBE_FLOAT(textureName) TEXTURECUBE(textureName)
|
||||
// #define TEXTURECUBE_ARRAY_FLOAT(textureName) TEXTURECUBE_ARRAY(textureName)
|
||||
// #define TEXTURE3D_FLOAT(textureName) TEXTURE3D(textureName)
|
||||
|
||||
// #define TEXTURE2D_HALF(textureName) TEXTURE2D(textureName)
|
||||
// #define TEXTURE2D_ARRAY_HALF(textureName) TEXTURE2D_ARRAY(textureName)
|
||||
// #define TEXTURECUBE_HALF(textureName) TEXTURECUBE(textureName)
|
||||
// #define TEXTURECUBE_ARRAY_HALF(textureName) TEXTURECUBE_ARRAY(textureName)
|
||||
// #define TEXTURE3D_HALF(textureName) TEXTURE3D(textureName)
|
||||
|
||||
// #else // !SHADER_API_D3D11
|
||||
|
||||
// #define TEXTURE2D_FLOAT(textureName) Texture2D_float textureName
|
||||
// #define TEXTURE2D_ARRAY_FLOAT(textureName) Texture2DArray_float textureName
|
||||
// #define TEXTURECUBE_FLOAT(textureName) TextureCube_float textureName
|
||||
// #define TEXTURECUBE_ARRAY_FLOAT(textureName) TextureCubeArray_float textureName
|
||||
// #define TEXTURE3D_FLOAT(textureName) Texture3D_float textureName
|
||||
|
||||
// #define TEXTURE2D_HALF(textureName) Texture2D_half textureName
|
||||
// #define TEXTURE2D_ARRAY_HALF(textureName) Texture2DArray_half textureName
|
||||
// #define TEXTURECUBE_HALF(textureName) TextureCube_half textureName
|
||||
// #define TEXTURECUBE_ARRAY_HALF(textureName) TextureCubeArray_half textureName
|
||||
// #define TEXTURE3D_HALF(textureName) Texture3D_half textureName
|
||||
|
||||
// #endif // SHADER_API_D3D11
|
||||
|
||||
// #define TEXTURE2D_SHADOW(textureName) TEXTURE2D(textureName)
|
||||
// #define TEXTURE2D_ARRAY_SHADOW(textureName) TEXTURE2D_ARRAY(textureName)
|
||||
// #define TEXTURECUBE_SHADOW(textureName) TEXTURECUBE(textureName)
|
||||
// #define TEXTURECUBE_ARRAY_SHADOW(textureName) TEXTURECUBE_ARRAY(textureName)
|
||||
|
||||
#define RW_TEXTURE2D(type, textureName) RWTexture2D<type> textureName
|
||||
#define RW_TEXTURE2D_ARRAY(type, textureName) RWTexture2DArray<type> textureName
|
||||
// #define RW_TEXTURE3D(type, textureName) RWTexture3D<type> textureName
|
||||
|
||||
#define SAMPLER(samplerName) SamplerState samplerName
|
||||
// #define SAMPLER_CMP(samplerName) SamplerComparisonState samplerName
|
||||
// #define ASSIGN_SAMPLER(samplerName, samplerValue) samplerName = samplerValue
|
||||
|
||||
// #define TEXTURE2D_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER(samplerName)
|
||||
// #define TEXTURE2D_ARRAY_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER(samplerName)
|
||||
// #define TEXTURECUBE_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER(samplerName)
|
||||
// #define TEXTURECUBE_ARRAY_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER(samplerName)
|
||||
// #define TEXTURE3D_PARAM(textureName, samplerName) TEXTURE3D(textureName), SAMPLER(samplerName)
|
||||
|
||||
// #define TEXTURE2D_SHADOW_PARAM(textureName, samplerName) TEXTURE2D(textureName), SAMPLER_CMP(samplerName)
|
||||
// #define TEXTURE2D_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURE2D_ARRAY(textureName), SAMPLER_CMP(samplerName)
|
||||
// #define TEXTURECUBE_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE(textureName), SAMPLER_CMP(samplerName)
|
||||
// #define TEXTURECUBE_ARRAY_SHADOW_PARAM(textureName, samplerName) TEXTURECUBE_ARRAY(textureName), SAMPLER_CMP(samplerName)
|
||||
|
||||
// #define TEXTURE2D_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURE2D_ARRAY_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURECUBE_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURECUBE_ARRAY_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURE3D_ARGS(textureName, samplerName) textureName, samplerName
|
||||
|
||||
// #define TEXTURE2D_SHADOW_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURE2D_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURECUBE_SHADOW_ARGS(textureName, samplerName) textureName, samplerName
|
||||
// #define TEXTURECUBE_ARRAY_SHADOW_ARGS(textureName, samplerName) textureName, samplerName
|
||||
|
||||
// We cannot use Unity's macros because they change the samplerName and it needs to be unchanged.
|
||||
#define SAMPLE_TEXTURE2D(textureName, samplerName, coord2) textureName.Sample(samplerName, coord2)
|
||||
#define SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod) textureName.SampleLevel(samplerName, coord2, lod)
|
||||
// #define SAMPLE_TEXTURE2D_BIAS(textureName, samplerName, coord2, bias) textureName.SampleBias(samplerName, coord2, bias)
|
||||
// #define SAMPLE_TEXTURE2D_GRAD(textureName, samplerName, coord2, dpdx, dpdy) textureName.SampleGrad(samplerName, coord2, dpdx, dpdy)
|
||||
#define SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Sample(samplerName, float3(coord2, index))
|
||||
// #define SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, index, lod) textureName.SampleLevel(samplerName, float3(coord2, index), lod)
|
||||
// #define SAMPLE_TEXTURE2D_ARRAY_BIAS(textureName, samplerName, coord2, index, bias) textureName.SampleBias(samplerName, float3(coord2, index), bias)
|
||||
// #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy) textureName.SampleGrad(samplerName, float3(coord2, index), dpdx, dpdy)
|
||||
// #define SAMPLE_TEXTURECUBE(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)
|
||||
// #define SAMPLE_TEXTURECUBE_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod)
|
||||
// #define SAMPLE_TEXTURECUBE_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias)
|
||||
// #define SAMPLE_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Sample(samplerName, float4(coord3, index))
|
||||
// #define SAMPLE_TEXTURECUBE_ARRAY_LOD(textureName, samplerName, coord3, index, lod) textureName.SampleLevel(samplerName, float4(coord3, index), lod)
|
||||
// #define SAMPLE_TEXTURECUBE_ARRAY_BIAS(textureName, samplerName, coord3, index, bias) textureName.SampleBias(samplerName, float4(coord3, index), bias)
|
||||
// #define SAMPLE_TEXTURE3D(textureName, samplerName, coord3) textureName.Sample(samplerName, coord3)
|
||||
// #define SAMPLE_TEXTURE3D_LOD(textureName, samplerName, coord3, lod) textureName.SampleLevel(samplerName, coord3, lod)
|
||||
|
||||
// #define SAMPLE_TEXTURE2D_SHADOW(textureName, samplerName, coord3) textureName.SampleCmpLevelZero(samplerName, (coord3).xy, (coord3).z)
|
||||
// #define SAMPLE_TEXTURE2D_ARRAY_SHADOW(textureName, samplerName, coord3, index) textureName.SampleCmpLevelZero(samplerName, float3((coord3).xy, index), (coord3).z)
|
||||
// #define SAMPLE_TEXTURECUBE_SHADOW(textureName, samplerName, coord4) textureName.SampleCmpLevelZero(samplerName, (coord4).xyz, (coord4).w)
|
||||
// #define SAMPLE_TEXTURECUBE_ARRAY_SHADOW(textureName, samplerName, coord4, index) textureName.SampleCmpLevelZero(samplerName, float4((coord4).xyz, index), (coord4).w)
|
||||
|
||||
#undef SAMPLE_DEPTH_TEXTURE
|
||||
// #undef SAMPLE_DEPTH_TEXTURE_LOD
|
||||
#define SAMPLE_DEPTH_TEXTURE(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2).r
|
||||
// #define SAMPLE_DEPTH_TEXTURE_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod).r
|
||||
|
||||
#define LOAD_TEXTURE2D(textureName, unCoord2) textureName.Load(int3(unCoord2, 0))
|
||||
// #define LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod) textureName.Load(int3(unCoord2, lod))
|
||||
// #define LOAD_TEXTURE2D_MSAA(textureName, unCoord2, sampleIndex) textureName.Load(unCoord2, sampleIndex)
|
||||
#define LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, index) textureName.Load(int4(unCoord2, index, 0))
|
||||
// #ifndef SHADER_API_SWITCH
|
||||
// #define LOAD_TEXTURE2D_ARRAY_MSAA(textureName, unCoord2, index, sampleIndex) textureName.Load(int3(unCoord2, index), sampleIndex)
|
||||
// #endif
|
||||
// #define LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, index, lod) textureName.Load(int4(unCoord2, index, lod))
|
||||
// #define LOAD_TEXTURE3D(textureName, unCoord3) textureName.Load(int4(unCoord3, 0))
|
||||
// #define LOAD_TEXTURE3D_LOD(textureName, unCoord3, lod) textureName.Load(int4(unCoord3, lod))
|
||||
|
||||
// #define GATHER_TEXTURE2D(textureName, samplerName, coord2) textureName.Gather(samplerName, coord2)
|
||||
// #define GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, index) textureName.Gather(samplerName, float3(coord2, index))
|
||||
// #define GATHER_TEXTURECUBE(textureName, samplerName, coord3) textureName.Gather(samplerName, coord3)
|
||||
// #define GATHER_TEXTURECUBE_ARRAY(textureName, samplerName, coord3, index) textureName.Gather(samplerName, float4(coord3, index))
|
||||
// #define GATHER_RED_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherRed(samplerName, coord2)
|
||||
// #define GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherGreen(samplerName, coord2)
|
||||
// #define GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherBlue(samplerName, coord2)
|
||||
// #define GATHER_ALPHA_TEXTURE2D(textureName, samplerName, coord2) textureName.GatherAlpha(samplerName, coord2)
|
||||
|
||||
// Generates a triangle in homogeneous clip space, s.t.
|
||||
// v0 = (-1, -1, 1), v1 = (3, -1, 1), v2 = (-1, 3, 1).
|
||||
float2 GetFullScreenTriangleTexCoord(uint vertexID)
|
||||
{
|
||||
#if UNITY_UV_STARTS_AT_TOP
|
||||
return float2((vertexID << 1) & 2, 1.0 - (vertexID & 2));
|
||||
#else
|
||||
return float2((vertexID << 1) & 2, vertexID & 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
float4 GetFullScreenTriangleVertexPosition(uint vertexID, float z = UNITY_NEAR_CLIP_VALUE)
|
||||
{
|
||||
float2 uv = float2((vertexID << 1) & 2, vertexID & 2);
|
||||
return float4(uv * 2.0 - 1.0, z, 1.0);
|
||||
}
|
||||
|
||||
#endif // UNITY_COMMON_INCLUDED
|
||||
|
||||
//
|
||||
// FUNCTIONS
|
||||
//
|
||||
|
||||
// Keep the following unguarded
|
||||
|
||||
// Taken and modified from:
|
||||
// com.unity.render-pipelines.core@12.0.0/ShaderLibrary/Common.hlsl
|
||||
float4 CrestComputeClipSpacePosition(float2 positionNDC, float deviceDepth)
|
||||
{
|
||||
float4 positionCS = float4(positionNDC * 2.0 - 1.0, deviceDepth, 1.0);
|
||||
// positionCS.y was flipped here but that is SRP specific to solve flip baked into matrix.
|
||||
return positionCS;
|
||||
}
|
||||
|
||||
// Taken and modified from:
|
||||
// com.unity.render-pipelines.core@12.0.0/ShaderLibrary/Common.hlsl
|
||||
float3 CrestComputeWorldSpacePosition(float2 positionNDC, float deviceDepth, float4x4 invViewProjMatrix)
|
||||
{
|
||||
float4 positionCS = CrestComputeClipSpacePosition(positionNDC, deviceDepth);
|
||||
float4 hpositionWS = mul(invViewProjMatrix, positionCS);
|
||||
return hpositionWS.xyz / hpositionWS.w;
|
||||
}
|
||||
|
||||
// Taken from:
|
||||
// com.unity.render-pipelines.core@12.0.0/ShaderLibrary/Common.hlsl
|
||||
float3 CrestComputeWorldSpacePosition(float4 positionCS, float4x4 invViewProjMatrix)
|
||||
{
|
||||
float4 hpositionWS = mul(invViewProjMatrix, positionCS);
|
||||
return hpositionWS.xyz / hpositionWS.w;
|
||||
}
|
||||
|
||||
#undef ComputeClipSpacePosition
|
||||
#undef ComputeWorldSpacePosition
|
||||
|
||||
// Replace these with our own as ComputeClipSpacePosition flips the Y which is not correct for BIRP.
|
||||
#define ComputeClipSpacePosition CrestComputeClipSpacePosition
|
||||
#define ComputeWorldSpacePosition CrestComputeWorldSpacePosition
|
||||
|
||||
// Taken from:
|
||||
// com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl
|
||||
real3 CrestUnpackNormalmapRGorAG(real4 packednormal)
|
||||
{
|
||||
// This do the trick
|
||||
packednormal.x *= packednormal.w;
|
||||
|
||||
real3 normal;
|
||||
normal.xy = packednormal.xy * 2 - 1;
|
||||
normal.z = sqrt(1 - saturate(dot(normal.xy, normal.xy)));
|
||||
return normal;
|
||||
}
|
||||
|
||||
// Taken from:
|
||||
// com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl
|
||||
inline real3 CrestUnpackNormal(real4 packednormal)
|
||||
{
|
||||
#if defined(UNITY_NO_DXT5nm)
|
||||
return packednormal.xyz * 2 - 1;
|
||||
#elif defined(UNITY_ASTC_NORMALMAP_ENCODING)
|
||||
return UnpackNormalDXT5nm(packednormal);
|
||||
#else
|
||||
return CrestUnpackNormalmapRGorAG(packednormal);
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef UnpackNormal
|
||||
|
||||
// Replace these to solve Unity bug "ambiguous call to 'UnpackNormalmapRGorAG'"
|
||||
#define UnpackNormal CrestUnpackNormal
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff429977add540198b8820ff8f0cd7a
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,75 +0,0 @@
|
||||
// Crest Water System
|
||||
|
||||
// This file is subject to the Unity Companion License:
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/7ff8fd444c179fd9bb380d61f4865be6935b47dd/LICENSE.md
|
||||
|
||||
// Adds functions from SRP.
|
||||
|
||||
// Adapted from:
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/8f54e6591e93fb3bf8e9879a0e43665dfbe2f629/com.unity.shadergraph/Editor/Generation/Targets/BuiltIn/ShaderLibrary/Core.hlsl
|
||||
// https://github.com/Unity-Technologies/Graphics/blob/7ff8fd444c179fd9bb380d61f4865be6935b47dd/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/TextureXR.hlsl
|
||||
|
||||
#ifndef BUILTIN_PIPELINE_CORE_INCLUDED
|
||||
#define BUILTIN_PIPELINE_CORE_INCLUDED
|
||||
|
||||
#include "Packages/com.waveharmonic.crest/Runtime/Shaders/Library/Utility/Legacy/Common.hlsl"
|
||||
|
||||
// Stereo-related bits
|
||||
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
||||
|
||||
#define SLICE_ARRAY_INDEX unity_StereoEyeIndex
|
||||
|
||||
#define COORD_TEXTURE2D_X(pixelCoord) uint3(pixelCoord, SLICE_ARRAY_INDEX)
|
||||
|
||||
#define TEXTURE2D_X(textureName) TEXTURE2D_ARRAY(textureName)
|
||||
// #define TEXTURE2D_X_PARAM(textureName, samplerName) TEXTURE2D_ARRAY_PARAM(textureName, samplerName)
|
||||
// #define TEXTURE2D_X_ARGS(textureName, samplerName) TEXTURE2D_ARRAY_ARGS(textureName, samplerName)
|
||||
// #define TEXTURE2D_X_HALF(textureName) TEXTURE2D_ARRAY_HALF(textureName)
|
||||
// #define TEXTURE2D_X_FLOAT(textureName) TEXTURE2D_ARRAY_FLOAT(textureName)
|
||||
|
||||
#define RW_TEXTURE2D_X(type, textureName) RW_TEXTURE2D_ARRAY(type, textureName)
|
||||
|
||||
#define LOAD_TEXTURE2D_X(textureName, unCoord2) LOAD_TEXTURE2D_ARRAY(textureName, unCoord2, SLICE_ARRAY_INDEX)
|
||||
// #define LOAD_TEXTURE2D_X_LOD(textureName, unCoord2, lod) LOAD_TEXTURE2D_ARRAY_LOD(textureName, unCoord2, SLICE_ARRAY_INDEX, lod)
|
||||
#define SAMPLE_TEXTURE2D_X(textureName, samplerName, coord2) SAMPLE_TEXTURE2D_ARRAY(textureName, samplerName, coord2, SLICE_ARRAY_INDEX)
|
||||
// #define SAMPLE_TEXTURE2D_X_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, samplerName, coord2, SLICE_ARRAY_INDEX, lod)
|
||||
// #define GATHER_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_TEXTURE2D_ARRAY(textureName, samplerName, coord2, SLICE_ARRAY_INDEX)
|
||||
// #define GATHER_RED_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_RED_TEXTURE2D(textureName, samplerName, float3(coord2, SLICE_ARRAY_INDEX))
|
||||
// #define GATHER_GREEN_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_GREEN_TEXTURE2D(textureName, samplerName, float3(coord2, SLICE_ARRAY_INDEX))
|
||||
// #define GATHER_BLUE_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_BLUE_TEXTURE2D(textureName, samplerName, float3(coord2, SLICE_ARRAY_INDEX))
|
||||
|
||||
#else // UNITY_STEREO
|
||||
|
||||
#define SLICE_ARRAY_INDEX 0
|
||||
|
||||
#define COORD_TEXTURE2D_X(pixelCoord) pixelCoord
|
||||
|
||||
#define TEXTURE2D_X(textureName) TEXTURE2D(textureName)
|
||||
// #define TEXTURE2D_X_PARAM(textureName, samplerName) TEXTURE2D_PARAM(textureName, samplerName)
|
||||
// #define TEXTURE2D_X_ARGS(textureName, samplerName) TEXTURE2D_ARGS(textureName, samplerName)
|
||||
// #define TEXTURE2D_X_HALF(textureName) TEXTURE2D_HALF(textureName)
|
||||
// #define TEXTURE2D_X_FLOAT(textureName) TEXTURE2D_FLOAT(textureName)
|
||||
|
||||
#define RW_TEXTURE2D_X RW_TEXTURE2D
|
||||
|
||||
#define LOAD_TEXTURE2D_X(textureName, unCoord2) LOAD_TEXTURE2D(textureName, unCoord2)
|
||||
// #define LOAD_TEXTURE2D_X_LOD(textureName, unCoord2, lod) LOAD_TEXTURE2D_LOD(textureName, unCoord2, lod)
|
||||
#define SAMPLE_TEXTURE2D_X(textureName, samplerName, coord2) SAMPLE_TEXTURE2D(textureName, samplerName, coord2)
|
||||
// #define SAMPLE_TEXTURE2D_X_LOD(textureName, samplerName, coord2, lod) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, coord2, lod)
|
||||
// #define GATHER_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_TEXTURE2D(textureName, samplerName, coord2)
|
||||
// #define GATHER_RED_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_RED_TEXTURE2D(textureName, samplerName, coord2)
|
||||
// #define GATHER_GREEN_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_GREEN_TEXTURE2D(textureName, samplerName, coord2)
|
||||
// #define GATHER_BLUE_TEXTURE2D_X(textureName, samplerName, coord2) GATHER_BLUE_TEXTURE2D(textureName, samplerName, coord2)
|
||||
|
||||
#endif // UNITY_STEREO
|
||||
|
||||
// Helper macro to assign view index during compute/ray pass (usually from SV_DispatchThreadID or DispatchRaysIndex())
|
||||
#if defined(SHADER_STAGE_COMPUTE) || defined(SHADER_STAGE_RAY_TRACING)
|
||||
#if defined(UNITY_STEREO_INSTANCING_ENABLED)
|
||||
#define UNITY_XR_ASSIGN_VIEW_INDEX(viewIndex) unity_StereoEyeIndex = viewIndex;
|
||||
#else
|
||||
#define UNITY_XR_ASSIGN_VIEW_INDEX(viewIndex)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // BUILTIN_PIPELINE_CORE_INCLUDED
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8501e8dffc440417cb78449e6079d3fa
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,18 +0,0 @@
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
// Defines missing inputs.
|
||||
|
||||
float4x4 _Crest_InverseViewProjection;
|
||||
float4x4 _Crest_InverseViewProjectionRight;
|
||||
|
||||
#undef UNITY_MATRIX_I_VP
|
||||
|
||||
#if defined(STEREO_INSTANCING_ON) || defined(STEREO_MULTIVIEW_ON)
|
||||
#define UNITY_MATRIX_I_VP (unity_StereoEyeIndex == 0 ? _Crest_InverseViewProjection : _Crest_InverseViewProjectionRight)
|
||||
#else
|
||||
#define UNITY_MATRIX_I_VP _Crest_InverseViewProjection
|
||||
#endif
|
||||
|
||||
// Not set and _ScreenParams.zw is "1.0 + 1.0 / _ScreenParams.xy"
|
||||
#define _ScreenSize float4(_ScreenParams.xy, float2(1.0, 1.0) / _ScreenParams.xy)
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e956ca85fd1846899d2a3b106267dcd
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,125 +0,0 @@
|
||||
// Crest Water System
|
||||
|
||||
// Copyright (c) 2016 Unity Technologies
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
// this software and associated documentation files (the "Software"), to deal in
|
||||
// the Software without restriction, including without limitation the rights to
|
||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
||||
// so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// Screen-space shadow helpers.
|
||||
|
||||
// Taken and adapted from:
|
||||
// 2020.3.12f1/DefaultResourcesExtra/Internal-ScreenSpaceShadows.shader
|
||||
|
||||
// Main changes is that now only world position is required. Specialised for the shadow LOD data.
|
||||
|
||||
// Add multi_compile_shadowcollector pragma to get SHADOWS_SPLIT_SPHERES and SHADOWS_SINGLE_CASCADE.
|
||||
// https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html
|
||||
|
||||
// SHADOWS_SCREEN + SHADOWS_CUBE will never be triggered for transparency, but
|
||||
// Unity still compiles the variant which causes compiler errors.
|
||||
#if defined(_SURFACE_TYPE_TRANSPARENT) && !defined(SHADERGRAPH_PREVIEW) && !defined(SHADOWS_SCREEN) && !defined(SHADOWS_CUBE)
|
||||
#define d_Crest_ReceiveShadowsTransparent 1
|
||||
#endif
|
||||
|
||||
#if d_Crest_ReceiveShadowsTransparent
|
||||
|
||||
#include "UnityShadowLibrary.cginc"
|
||||
|
||||
#ifndef SHADOWMAPSAMPLER_DEFINED
|
||||
UNITY_DECLARE_SHADOWMAP(_ShadowMapTexture);
|
||||
#define SHADOWMAPSAMPLER_DEFINED
|
||||
|
||||
#ifndef SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED
|
||||
float4 _ShadowMapTexture_TexelSize;
|
||||
#define SHADOWMAPSAMPLER_AND_TEXELSIZE_DEFINED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Keywords based defines
|
||||
//
|
||||
#if defined (SHADOWS_SPLIT_SPHERES)
|
||||
#define GET_CASCADE_WEIGHTS(wpos) getCascadeWeights_splitSpheres(wpos)
|
||||
#else
|
||||
#define GET_CASCADE_WEIGHTS(wpos) getCascadeWeights(wpos)
|
||||
#endif
|
||||
|
||||
#if defined (SHADOWS_SINGLE_CASCADE)
|
||||
#define GET_SHADOW_COORDINATES(wpos) getShadowCoord_SingleCascade(wpos)
|
||||
#else
|
||||
#define GET_SHADOW_COORDINATES(wpos) getShadowCoord(wpos)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Gets the cascade weights based on the world position of the fragment.
|
||||
* Returns a float4 with only one component set that corresponds to the appropriate cascade.
|
||||
*/
|
||||
inline fixed4 getCascadeWeights(float3 wpos)
|
||||
{
|
||||
// Calculate depth. Normally this would be depth from the depth buffer.
|
||||
float z = dot(wpos - _WorldSpaceCameraPos.xyz, unity_CameraToWorld._m02_m12_m22);
|
||||
fixed4 zNear = float4( z >= _LightSplitsNear );
|
||||
fixed4 zFar = float4( z < _LightSplitsFar );
|
||||
fixed4 weights = zNear * zFar;
|
||||
return weights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cascade weights based on the world position of the fragment and the poisitions of the split spheres for each cascade.
|
||||
* Returns a float4 with only one component set that corresponds to the appropriate cascade.
|
||||
*/
|
||||
inline fixed4 getCascadeWeights_splitSpheres(float3 wpos)
|
||||
{
|
||||
float3 fromCenter0 = wpos.xyz - unity_ShadowSplitSpheres[0].xyz;
|
||||
float3 fromCenter1 = wpos.xyz - unity_ShadowSplitSpheres[1].xyz;
|
||||
float3 fromCenter2 = wpos.xyz - unity_ShadowSplitSpheres[2].xyz;
|
||||
float3 fromCenter3 = wpos.xyz - unity_ShadowSplitSpheres[3].xyz;
|
||||
float4 distances2 = float4(dot(fromCenter0,fromCenter0), dot(fromCenter1,fromCenter1), dot(fromCenter2,fromCenter2), dot(fromCenter3,fromCenter3));
|
||||
fixed4 weights = float4(distances2 < unity_ShadowSplitSqRadii);
|
||||
weights.yzw = saturate(weights.yzw - weights.xyz);
|
||||
return weights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shadowmap coordinates for the given fragment based on the world position and z-depth.
|
||||
* These coordinates belong to the shadowmap atlas that contains the maps for all cascades.
|
||||
*/
|
||||
inline float4 getShadowCoord(float4 wpos)
|
||||
{
|
||||
fixed4 cascadeWeights = GET_CASCADE_WEIGHTS(wpos.xyz);
|
||||
float3 sc0 = mul (unity_WorldToShadow[0], wpos).xyz;
|
||||
float3 sc1 = mul (unity_WorldToShadow[1], wpos).xyz;
|
||||
float3 sc2 = mul (unity_WorldToShadow[2], wpos).xyz;
|
||||
float3 sc3 = mul (unity_WorldToShadow[3], wpos).xyz;
|
||||
float4 shadowMapCoordinate = float4(sc0 * cascadeWeights[0] + sc1 * cascadeWeights[1] + sc2 * cascadeWeights[2] + sc3 * cascadeWeights[3], 1);
|
||||
#if defined(UNITY_REVERSED_Z)
|
||||
float noCascadeWeights = 1 - dot(cascadeWeights, float4(1, 1, 1, 1));
|
||||
shadowMapCoordinate.z += noCascadeWeights;
|
||||
#endif
|
||||
return shadowMapCoordinate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as the getShadowCoord; but optimized for single cascade
|
||||
*/
|
||||
inline float4 getShadowCoord_SingleCascade( float4 wpos )
|
||||
{
|
||||
return float4(mul(unity_WorldToShadow[0], wpos).xyz, 0);
|
||||
}
|
||||
|
||||
#endif // d_Crest_ReceiveShadowsTransparent
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14d63b54d73024767903a5caa23e8e53
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user