(Update) Clean Projet
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9db55a1b83504125914c796208e3c3e9
|
||||
timeCreated: 1718465470
|
||||
@@ -0,0 +1,38 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#define THREAD_GROUPS 64
|
||||
#pragma kernel SampleOffsets
|
||||
|
||||
#include "..\Libraries\Height.hlsl"
|
||||
|
||||
//Input
|
||||
StructuredBuffer<float3> positions;
|
||||
uint sampleCount; //Length of 'positions' array
|
||||
|
||||
//Output
|
||||
RWStructuredBuffer<float> offsets;
|
||||
|
||||
[numthreads(THREAD_GROUPS,1,1)]
|
||||
void SampleOffsets(uint id : SV_DispatchThreadID)
|
||||
{
|
||||
//Early out when no more positions are left to process
|
||||
//Important for the Metal API, as it avoids accessing unbound array elements!
|
||||
if(id > sampleCount) return;
|
||||
|
||||
const uint index = (uint)(id);
|
||||
|
||||
//Input positions to sample at
|
||||
const float3 positionWS = positions[index];
|
||||
|
||||
//Position, relative to rendering bounds (normalized 0-1)
|
||||
const float2 uv = WorldToHeightUV(positionWS);
|
||||
|
||||
//Texel value at coordinates
|
||||
float2 heights = SampleHeightBuffer(uv).rg;
|
||||
|
||||
//Output
|
||||
offsets[index] = heights.r + heights.g;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 768e0c28dfdbc6b429fd59518fa03f2d
|
||||
ComputeShaderImporter:
|
||||
externalObjects: {}
|
||||
currentAPIMask: 4
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Compute/HeightSampler.compute
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,51 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#pragma kernel CSMain
|
||||
|
||||
Texture2D<float4> _InputTexture;
|
||||
RWTexture2D<float> _OutputTexture;
|
||||
|
||||
float _MaxDistance;
|
||||
|
||||
uint2 _TextureSize;
|
||||
|
||||
[numthreads(8, 8, 1)]
|
||||
void CSMain (uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
if (id.x >= _TextureSize.x || id.y >= _TextureSize.y) return;
|
||||
|
||||
float pixel = _InputTexture[id.xy].r;
|
||||
bool isBackground = pixel.r > 0.5; //Assume white is the background
|
||||
|
||||
float minDistance = _MaxDistance;
|
||||
|
||||
//Reduced search window based on _MaxDistance
|
||||
int searchRadius = int(_MaxDistance);
|
||||
int2 start = max(int2(0, 0), int2(id.xy) - searchRadius);
|
||||
int2 end = min(_TextureSize, int2(id.xy) + searchRadius + 1);
|
||||
|
||||
for (int y = start.y; y < end.y; y++)
|
||||
{
|
||||
for (int x = start.x; x < end.x; x++)
|
||||
{
|
||||
float sample = _InputTexture[int2(x, y)].r;
|
||||
bool sampleIsBackground = sample.r > 0.5;
|
||||
|
||||
if(sampleIsBackground == isBackground || sample < pixel) continue;
|
||||
//if (sampleIsBackground != isBackground && sample > pixel)
|
||||
{
|
||||
float2 diff = float2(x, y) - id.xy;
|
||||
float distance = length(diff);
|
||||
if (distance < minDistance)
|
||||
{
|
||||
minDistance = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_OutputTexture[id.xy] = 1-(minDistance / _MaxDistance); // Normalize
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ed6fcf8ffe9497086e18655ba389d39
|
||||
timeCreated: 1718465479
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Compute/SDF.compute
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c38e8ec34f13e94c86c2b8272d1d0a5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" //SRGBToLinear
|
||||
#include "Common.hlsl"
|
||||
|
||||
//Set through SetupConstants pass
|
||||
bool _CausticsProjectionAvailable;
|
||||
float4x4 CausticsProjection;
|
||||
|
||||
TEXTURE2D(_CausticsTex);
|
||||
SAMPLER(sampler_CausticsTex);
|
||||
|
||||
float2 CalculateTriPlanarProjection(in float3 positionWS, in float3 normalWS)
|
||||
{
|
||||
float3 faceNormal = round(abs(normalWS));
|
||||
|
||||
float2 compA = lerp(positionWS.yz, positionWS.xz, faceNormal.y);
|
||||
float2 compB = lerp(compA, positionWS.xy, faceNormal.z);
|
||||
|
||||
return compB;
|
||||
}
|
||||
|
||||
void CalculateTriPlanarProjection_float(in float3 positionWS, in float3 normalWS, out float2 uv)
|
||||
{
|
||||
uv = CalculateTriPlanarProjection(positionWS, normalWS);
|
||||
}
|
||||
|
||||
//Normal is expected to be that of the geometry not the water surface
|
||||
float2 GetCausticsProjection(in float4 positionCS, in float3 lightDir, float3 positionWS, float3 sceneWorldNormal, bool directional, inout half attenuation)
|
||||
{
|
||||
//return CalculateTriPlanarProjection(positionWS, sceneWorldNormal);
|
||||
|
||||
#if !_DISABLE_DEPTH_TEX
|
||||
if(directional && _CausticsProjectionAvailable)
|
||||
{
|
||||
const half NdotL = saturate(dot(sceneWorldNormal, lightDir));
|
||||
attenuation *= NdotL;
|
||||
|
||||
//CausticsProjection matrix set up through scripting
|
||||
return mul(CausticsProjection, float4(positionWS, 1.0)).xy;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
return positionWS.xz;
|
||||
}
|
||||
|
||||
float3 SampleCaustics(float2 uv, float2 time, float tiling, float chromance)
|
||||
{
|
||||
float3 caustics = 0;
|
||||
|
||||
float2 coords = uv * tiling;
|
||||
float2 uv1 = coords + (time.xy);
|
||||
|
||||
#if defined(CAUSTICS_SINGLE_LAYER)
|
||||
caustics = SAMPLE_TEXTURE2D(_CausticsTex, sampler_CausticsTex, uv1).rgb;
|
||||
#else
|
||||
|
||||
float2 uv2 = coords * 0.6 - time.xy;
|
||||
|
||||
float3 caustics1 = SAMPLE_TEXTURE2D_LOD(_CausticsTex, sampler_CausticsTex, uv1, 0).rgb;
|
||||
float3 caustics2 = SAMPLE_TEXTURE2D_LOD(_CausticsTex, sampler_CausticsTex, uv2, 0).rgb;
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
caustics1 = SRGBToLinear(caustics1);
|
||||
caustics2 = SRGBToLinear(caustics2);
|
||||
#endif
|
||||
|
||||
caustics = min(caustics1, caustics2) * 2.0;
|
||||
#endif
|
||||
|
||||
return lerp(caustics.rrr, caustics.rgb, chromance);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0aed6463372ad04c98d23600c33f16f
|
||||
timeCreated: 1623320383
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Caustics.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,248 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_COMMON_INCLUDED
|
||||
#define WATER_COMMON_INCLUDED
|
||||
|
||||
#define SW_VERSION 322
|
||||
|
||||
//As per the "Shader" section of the documentation, this is primarily used for synchronizing animations in networked applications.
|
||||
float _CustomTime;
|
||||
#define TIME_FRAG_INPUT _CustomTime > 0 ? _CustomTime : input.uv.z
|
||||
#define TIME_VERTEX_OUTPUT _CustomTime > 0 ? _CustomTime : output.uv.z
|
||||
|
||||
#define TIME ((TIME_FRAG_INPUT * _Speed))
|
||||
#define TIME_VERTEX ((TIME_VERTEX_OUTPUT * _Speed))
|
||||
|
||||
#define HORIZONTAL_DISPLACEMENT_SCALAR 0.01
|
||||
#define UP_VECTOR float3(0,1,0)
|
||||
#define RAD2DEGREE 57.29578
|
||||
|
||||
struct WaterSurface
|
||||
{
|
||||
uint vFace;
|
||||
float3 positionWS;
|
||||
float3 viewDelta; //Un-normalized view direction,
|
||||
float3 viewDir;
|
||||
|
||||
//Normal from the base geometry, in world-space
|
||||
float3 vertexNormal;
|
||||
//Normal of geometry + waves
|
||||
float3 waveNormal;
|
||||
half3x3 tangentToWorldMatrix;
|
||||
//Tangent-space normal
|
||||
float3 tangentNormal;
|
||||
//World-space normal, include geometry+waves+normal map
|
||||
float3 tangentWorldNormal;
|
||||
//The normal used for diffuse lighting.
|
||||
float3 diffuseNormal;
|
||||
//Per-pixel offset vector
|
||||
float4 refractionOffset;
|
||||
|
||||
float3 albedo;
|
||||
float3 reflections;
|
||||
float3 caustics;
|
||||
float3 specular;
|
||||
half reflectionMask;
|
||||
half reflectionLighting;
|
||||
|
||||
float3 offset;
|
||||
float slope;
|
||||
float waveCrest;
|
||||
|
||||
float fog;
|
||||
float intersection;
|
||||
float foam;
|
||||
|
||||
float alpha;
|
||||
float edgeFade;
|
||||
float shadowMask;
|
||||
};
|
||||
|
||||
//Set through the public static C# parameter: StylizedWater3.WaterObject.PositionOffset
|
||||
float3 _WaterPositionOffset;
|
||||
|
||||
float2 GetSourceUV(float2 uv, float2 wPos, float state)
|
||||
{
|
||||
#ifdef _RIVER
|
||||
//World-space tiling is useless in this case
|
||||
return uv;
|
||||
#endif
|
||||
|
||||
float2 output = lerp(uv, wPos - _WaterPositionOffset.xz, state);
|
||||
|
||||
//Pixelize
|
||||
#ifdef PIXELIZE_UV
|
||||
output.x = (int)((output.x / 0.5) + 0.5) * 0.5;
|
||||
output.y = (int)((output.y / 0.5) + 0.5) * 0.5;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 GetVertexColor(float4 inputColor, float4 mask)
|
||||
{
|
||||
return inputColor * mask;
|
||||
}
|
||||
|
||||
float DepthDistance(float3 wPos, float3 viewPos, float3 normal)
|
||||
{
|
||||
return length((wPos - viewPos) * normal);
|
||||
}
|
||||
|
||||
float2 TileOffsetUV(float2 uv, float2 tiling, float2 time, float2 speed)
|
||||
{
|
||||
return (uv.xy * tiling.xy) + (time.xy * speed.xy);
|
||||
}
|
||||
|
||||
float4 PackedUV(float2 sourceUV, float2 tiling, float2 time, float speed, float subTiling, float subSpeed)
|
||||
{
|
||||
float2 uv1 = TileOffsetUV(sourceUV, tiling, time, speed.xx * tiling);
|
||||
|
||||
float2 tiling_uv2 = tiling * subTiling;
|
||||
float2 uv2 = TileOffsetUV(sourceUV, tiling_uv2, time, (speed.xx * subSpeed * tiling_uv2));
|
||||
|
||||
return float4(uv1.xy, uv2.xy);
|
||||
}
|
||||
|
||||
float DistanceFadeMask(float3 positionWS, float start, float end, float vFace = 1.0)
|
||||
{
|
||||
float3 delta = GetCameraPositionWS().xyz - positionWS.xyz;
|
||||
|
||||
#if UNDERWATER_ENABLED
|
||||
//Use vertical distance only for backfaces (underwater). This ensures tiling is reduced when moving deeper into the water, vertically
|
||||
delta.y = lerp(0, delta.y, vFace);
|
||||
#endif
|
||||
|
||||
float pixelDist = length(delta);
|
||||
|
||||
float fadeFactor = saturate((end - pixelDist) / (end - start));
|
||||
|
||||
return fadeFactor;
|
||||
}
|
||||
|
||||
//Edge feathering, used by SSR currently
|
||||
float ScreenEdgeMask(float2 screenPos, float length)
|
||||
{
|
||||
float lengthRcp = 1.0f/length;
|
||||
float2 t = Remap10(abs(screenPos.xy * 2.0 - 1.0), lengthRcp, lengthRcp);
|
||||
return Smoothstep01(t.x) * Smoothstep01(t.y);
|
||||
}
|
||||
|
||||
struct SurfaceNormalData
|
||||
{
|
||||
float3 geometryNormalWS;
|
||||
float3 pixelNormalWS;
|
||||
float lightingStrength;
|
||||
float mask;
|
||||
};
|
||||
|
||||
float CalculateSlopeMask(float3 normalWS, float threshold, float falloff)
|
||||
{
|
||||
const float surfaceAngle = acos(dot(normalWS, UP_VECTOR) * 2.0 - 1.0) * RAD2DEGREE;
|
||||
|
||||
const float start = surfaceAngle - threshold;
|
||||
const float end = threshold - falloff;
|
||||
|
||||
return saturate((end - start) / (end - threshold));
|
||||
}
|
||||
|
||||
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 lerp(1.0, FAR_CLIP - NEAR_CLIP, unity_OrthoParams.w)
|
||||
|
||||
//Linear depth difference between scene and current (transparent) geometry pixel
|
||||
float SurfaceDepth(SceneDepth depth, float4 positionCS)
|
||||
{
|
||||
const float sceneDepth = (unity_OrthoParams.w == 0) ? depth.eye : LinearDepthToEyeDepth(depth.raw);
|
||||
const float clipSpaceDepth = (unity_OrthoParams.w == 0) ? LinearEyeDepth(positionCS.z, _ZBufferParams) : LinearDepthToEyeDepth(positionCS.z / positionCS.w);
|
||||
|
||||
return sceneDepth - clipSpaceDepth;
|
||||
}
|
||||
|
||||
//Return depth based on the used technique (buffer, vertex color, baked texture)
|
||||
SceneDepth SampleDepth(float4 screenPos)
|
||||
{
|
||||
SceneDepth depth = (SceneDepth)0;
|
||||
|
||||
#if !defined(_DISABLE_DEPTH_TEX) && defined(UNITY_DECLARE_DEPTH_TEXTURE_INCLUDED)
|
||||
screenPos.xyz /= screenPos.w;
|
||||
|
||||
depth.raw = SampleSceneDepth(screenPos.xy);
|
||||
depth.eye = LinearEyeDepth(depth.raw, _ZBufferParams);
|
||||
depth.linear01 = Linear01Depth(depth.raw, _ZBufferParams) * DEPTH_SCALAR;
|
||||
#else
|
||||
depth.raw = 1.0;
|
||||
depth.eye = 1.0;
|
||||
depth.linear01 = 1.0;
|
||||
#endif
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
#define ORTHOGRAPHIC_SUPPORT
|
||||
|
||||
#if defined(USING_STEREO_MATRICES)
|
||||
//Will never be used in VR, saves a per-fragment matrix multiplication
|
||||
#undef ORTHOGRAPHIC_SUPPORT
|
||||
#endif
|
||||
|
||||
//Reconstruct world-space position from depth.
|
||||
float3 ReconstructWorldPosition(float4 screenPos, float3 viewDir, SceneDepth sceneDepth)
|
||||
{
|
||||
#if UNITY_REVERSED_Z
|
||||
real rawDepth = sceneDepth.raw;
|
||||
#else
|
||||
// Adjust z to match NDC for OpenGL
|
||||
real rawDepth = lerp(UNITY_NEAR_CLIP_VALUE, 1, sceneDepth.raw);
|
||||
#endif
|
||||
|
||||
//return ComputeWorldSpacePosition(screenPos.xy / screenPos.w, rawDepth, UNITY_MATRIX_I_VP);
|
||||
|
||||
#if defined(ORTHOGRAPHIC_SUPPORT)
|
||||
//View to world position
|
||||
float4 viewPos = float4((screenPos.xy/screenPos.w) * 2.0 - 1.0, rawDepth, 1.0);
|
||||
float4x4 viewToWorld = UNITY_MATRIX_I_VP;
|
||||
#if UNITY_REVERSED_Z //Wrecked since 7.3.1 "fix" and causes warping, invert second row https://issuetracker.unity3d.com/issues/shadergraph-inverse-view-projection-transformation-matrix-is-not-the-inverse-of-view-projection-transformation-matrix
|
||||
//Commit https://github.com/Unity-Technologies/Graphics/pull/374/files
|
||||
viewToWorld._12_22_32_42 = -viewToWorld._12_22_32_42;
|
||||
#endif
|
||||
float4 viewWorld = mul(viewToWorld, viewPos);
|
||||
float3 viewWorldPos = viewWorld.xyz / viewWorld.w;
|
||||
#endif
|
||||
|
||||
//Projection to world position
|
||||
float3 camPos = GetCameraPositionWS().xyz;
|
||||
float3 worldPos = sceneDepth.eye * (viewDir/screenPos.w) - camPos;
|
||||
float3 perspWorldPos = -worldPos;
|
||||
|
||||
#if defined(ORTHOGRAPHIC_SUPPORT)
|
||||
return lerp(perspWorldPos, viewWorldPos, unity_OrthoParams.w);
|
||||
#else
|
||||
return perspWorldPos;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/NormalReconstruction.hlsl"
|
||||
|
||||
half3 ReconstructWorldNormal(float2 screenPos)
|
||||
{
|
||||
//NormalReconstruction library scales the screen position by the screen size, so counter this first
|
||||
screenPos.xy *= _ScreenSize.xy;
|
||||
|
||||
half3 normalVS = ReconstructNormalTap3(screenPos.xy);
|
||||
|
||||
return normalVS;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc7a6b3bb8994234db1fb3d0fc03345c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Common.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,151 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_FOAM_INCLUDED
|
||||
#define WATER_FOAM_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" //SRGBToLinear
|
||||
#include "Common.hlsl" //PackedUV
|
||||
|
||||
TEXTURE2D(_FoamTex);
|
||||
SAMPLER(sampler_FoamTex);
|
||||
|
||||
//WIP
|
||||
//#define DISTANCE_FOAM 1
|
||||
|
||||
float CalculateFoamWeight(float gradient, float input)
|
||||
{
|
||||
gradient = saturate(1.0 - gradient);
|
||||
return smoothstep(gradient, gradient + 1.0, input);
|
||||
}
|
||||
|
||||
float CalculateCrestFoam(float minHeight, float maxHeight, float waveHeight)
|
||||
{
|
||||
return smoothstep(minHeight, maxHeight, waveHeight);
|
||||
}
|
||||
|
||||
float2 SampleFoamLayer(TEXTURE2D_PARAM(tex, samplerName), float2 uv, float2 tiling, float2 time, float speed, float subTiling, float subSpeed)
|
||||
{
|
||||
float4 uvs = PackedUV(uv, tiling, time, speed, subTiling, subSpeed);
|
||||
|
||||
float2 f1 = SAMPLE_TEXTURE2D(tex, samplerName, uvs.xy).rg;
|
||||
float2 f2 = SAMPLE_TEXTURE2D(tex, samplerName, uvs.zw).rg;
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
f1 = SRGBToLinear(f1);
|
||||
f2 = SRGBToLinear(f2);
|
||||
#endif
|
||||
|
||||
float2 foam = saturate(f1 + f2);
|
||||
|
||||
return foam;
|
||||
}
|
||||
|
||||
float2 SampleFoamTexture(TEXTURE2D_PARAM(tex, samplerName), float3 positionWS, float2 uv, float2 tiling, float subTiling, float2 time, float speed, float subSpeed, float slopeMask, float slopeSpeed, float slopeStretch,
|
||||
bool slopeFoamOn, bool distanceFoamOn, float distanceStart, float distanceEnd, float distanceTiling)
|
||||
{
|
||||
float2 foam = SampleFoamLayer(TEXTURE2D_ARGS(tex, samplerName), uv, tiling, time, speed, subTiling, subSpeed);
|
||||
|
||||
#if _SURFACE_FOAM_DUAL
|
||||
UNITY_BRANCH
|
||||
if(distanceFoamOn)
|
||||
{
|
||||
float fadeFactor = DistanceFadeMask(positionWS, distanceStart, distanceEnd);
|
||||
float distanceSpeed = speed * 0.1;
|
||||
|
||||
float4 distanceUV = PackedUV(uv, tiling * distanceTiling, time, speed * distanceSpeed, subTiling * distanceTiling, subSpeed * distanceSpeed);
|
||||
|
||||
#if _ADVANCED_SHADING
|
||||
float2 distanceFoam = SampleFoamLayer(TEXTURE2D_ARGS(tex, samplerName), uv, tiling * distanceTiling, time, speed * distanceSpeed, subTiling * distanceTiling, subSpeed * distanceSpeed);
|
||||
#else
|
||||
float2 distanceFoam = SAMPLE_TEXTURE2D(tex, samplerName, distanceUV.xy).rg;
|
||||
//distanceFoam *= 2.0;
|
||||
#endif
|
||||
|
||||
foam = lerp(distanceFoam, foam, fadeFactor);
|
||||
//foam = distanceFoam;
|
||||
}
|
||||
#endif
|
||||
|
||||
UNITY_BRANCH
|
||||
if(slopeFoamOn)
|
||||
{
|
||||
float2 slopeUV = uv;
|
||||
//Stretch UV vertically on slope
|
||||
slopeUV.y *= 1-slopeStretch;
|
||||
|
||||
const half2 slopeFoam = SampleFoamLayer(TEXTURE2D_ARGS(_FoamTex, sampler_FoamTex), slopeUV, tiling, time, speed * slopeSpeed, subTiling, subSpeed * slopeSpeed);
|
||||
|
||||
foam = lerp(foam, slopeFoam, slopeMask);
|
||||
}
|
||||
|
||||
return foam;
|
||||
}
|
||||
|
||||
//Backwards compatibility for Dynamic Effects v3.0.2
|
||||
float2 SampleFoamTexture(TEXTURE2D_PARAM(tex, samplerName), float3 positionWS, float2 uv, float2 tiling, float subTiling, float2 time, float speed, float subSpeed, float slopeMask, float slopeSpeed, float slopeStretch,
|
||||
bool slopeFoamOn, bool distanceFoamOn)
|
||||
{
|
||||
return SampleFoamTexture(TEXTURE2D_ARGS(_FoamTex, sampler_FoamTex), positionWS, uv, tiling, subTiling, time, speed, subSpeed, slopeMask, slopeSpeed, slopeStretch, slopeFoamOn, distanceFoamOn, 100, 350, 0.1);
|
||||
}
|
||||
|
||||
float2 SampleFoamTexture(float3 positionWS, float2 uv, float2 tiling, float subTiling, float2 time, float speed, float subSpeed, float slopeMask, float slopeSpeed, half slopeStretch, bool slopeFoamOn, bool distanceFoamOn, float distanceStart, float distanceEnd, float distanceTiling)
|
||||
{
|
||||
return SampleFoamTexture(TEXTURE2D_ARGS(_FoamTex, sampler_FoamTex), positionWS, uv, tiling, subTiling, time, speed, subSpeed, slopeMask, slopeSpeed, slopeStretch, slopeFoamOn, distanceFoamOn, distanceStart, distanceEnd, distanceTiling);
|
||||
}
|
||||
|
||||
TEXTURE2D(_IntersectionNoise);
|
||||
SAMPLER(sampler_IntersectionNoise);
|
||||
|
||||
float SampleIntersection(TEXTURE2D_PARAM(noiseTex, samplerName), float2 uv, float2 time, float tiling, float gradient, float falloff, float speed, half rippleDistance, float rippleStrength, float rippleSpeed, float clipping, bool sharp)
|
||||
{
|
||||
float intersection = 0;
|
||||
float dist = saturate(gradient / falloff);
|
||||
|
||||
float2 nUV = uv * tiling;
|
||||
half noise1 = SAMPLE_TEXTURE2D(noiseTex, samplerName, nUV + (time.xy * speed)).r;
|
||||
|
||||
half noise2 = 0;
|
||||
#if _ADVANCED_SHADING
|
||||
noise2 = SAMPLE_TEXTURE2D(noiseTex, samplerName, (nUV * 0.8) - (time.xy * speed)).r;
|
||||
#endif
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
noise1 = SRGBToLinear(noise1);
|
||||
noise2 = SRGBToLinear(noise2);
|
||||
#endif
|
||||
|
||||
float sine = sin((time.y * rippleSpeed) - (gradient * rippleDistance)) * rippleStrength;
|
||||
|
||||
half noise = saturate((max(noise1, noise2) + sine) * dist);
|
||||
|
||||
UNITY_BRANCH
|
||||
if(sharp)
|
||||
{
|
||||
noise += dist;
|
||||
intersection = step(clipping, noise);
|
||||
}
|
||||
else
|
||||
{
|
||||
intersection = saturate(noise + dist) * dist;
|
||||
}
|
||||
|
||||
return intersection;
|
||||
}
|
||||
|
||||
//Shader Graph
|
||||
#if defined(UNITY_TEXTURE_INCLUDED) && !SHADERGRAPH_PREVIEW
|
||||
void SampleIntersection_float(UnityTexture2D noiseTex, UnitySamplerState samplerName, float2 uv, float2 time, float tiling, float gradient, float falloff, float speed, half rippleDistance, float rippleStrength, float rippleSpeed, float clipping, bool sharp,
|
||||
out float intersectionFoam)
|
||||
{
|
||||
#if SHADERGRAPH_PREVIEW
|
||||
intersectionFoam = 0;
|
||||
#else
|
||||
intersectionFoam = SampleIntersection(TEXTURE2D_ARGS(noiseTex.tex, samplerName.samplerstate), uv, time, tiling, gradient, falloff, speed, rippleDistance, rippleStrength, rippleSpeed, clipping, sharp);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fa352f658cc26c41a5020a8fd148bee
|
||||
timeCreated: 1686819225
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Foam.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,96 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
float _WaterFogDisabled;
|
||||
|
||||
//Authors of third-party fog solutions can reach out to have their method integrated here
|
||||
|
||||
#ifdef SCPostEffects
|
||||
//Macros normally used for cross-RP compatibility
|
||||
#define LINEAR_DEPTH(depth) Linear01Depth(depth, _ZBufferParams)
|
||||
|
||||
//Legacy (pre v2.2.1)
|
||||
#define DECLARE_TEX(textureName) TEXTURE2D(textureName);
|
||||
#define DECLARE_RT(textureName) TEXTURE2D_X(textureName);
|
||||
#define SAMPLE_TEX(textureName, samplerName, uv) SAMPLE_TEXTURE2D_LOD(textureName, samplerName, uv, 0)
|
||||
#define SAMPLE_RT_LOD(textureName, samplerName, uv, mip) SAMPLE_TEXTURE2D_X_LOD(textureName, samplerName, uv, mip)
|
||||
#endif
|
||||
|
||||
#ifdef AtmosphericHeightFog
|
||||
//For versions older than 3.2.0, uncomment this
|
||||
//bool AHF_Enabled;
|
||||
#endif
|
||||
|
||||
//Fragment stage. Note: Screen position passed here is not normalized (divided by w-component)
|
||||
void ApplyFog(inout float3 color, float fogFactor, float4 screenPos, float3 positionWS, float vFace)
|
||||
{
|
||||
float3 foggedColor = color;
|
||||
|
||||
float2 normalizedUV = screenPos.xy / screenPos.w;
|
||||
#ifdef UnityFog
|
||||
foggedColor = MixFog(color.rgb, fogFactor);
|
||||
#endif
|
||||
|
||||
#ifdef Colorful
|
||||
if(_DensityParams.x > 0) foggedColor.rgb = ApplyFog(color.rgb, fogFactor, positionWS, normalizedUV);
|
||||
#endif
|
||||
|
||||
#ifdef Enviro
|
||||
//Distance/height fog enabled?
|
||||
if (_EnviroParams.y > 0 || _EnviroParams.z > 0)
|
||||
{
|
||||
foggedColor.rgb = TransparentFog(float4(color.rgb, 1.0), positionWS, normalizedUV, fogFactor).rgb;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Enviro3
|
||||
if(_EnviroFogParameters.z > 0) //Fog density 1
|
||||
{
|
||||
foggedColor.rgb = ApplyFogAndVolumetricLights(color.rgb, normalizedUV, positionWS, 0);
|
||||
foggedColor.rgb = ApplyClouds(foggedColor.rgb, normalizedUV, positionWS);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Azure
|
||||
foggedColor.rgb = ApplyAzureFog(float4(color.rgb, 1.0), positionWS).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef AtmosphericHeightFog
|
||||
if (AHF_Enabled)
|
||||
{
|
||||
float4 fogParams = GetAtmosphericHeightFog(positionWS.xyz);
|
||||
foggedColor.rgb = lerp(color.rgb, fogParams.rgb, fogParams.a);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SCPostEffects
|
||||
//Distance or height fog enabled
|
||||
if(_DistanceParams.z == 1 || _DistanceParams.w == 1)
|
||||
{
|
||||
ApplyTransparencyFog(positionWS, normalizedUV, foggedColor.rgb);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef COZY
|
||||
foggedColor = BlendStylizedFog(positionWS, float4(color.rgb, 1.0)).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef Buto
|
||||
#if defined(BUTO_API_VERSION_2) //Buto 2022
|
||||
float3 positionVS = TransformWorldToView(positionWS);
|
||||
foggedColor = ButoFogBlend(normalizedUV, -positionVS.z, color.rgb);
|
||||
#else //Buto 2021
|
||||
foggedColor = ButoFogBlend(normalizedUV, color.rgb);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef UnityFog
|
||||
//Allow fog to be disabled for water globally by setting the value through script
|
||||
foggedColor = lerp(foggedColor, color, _WaterFogDisabled);
|
||||
#endif
|
||||
|
||||
//Fog only applies to the front faces, otherwise affects underwater rendering
|
||||
color.rgb = lerp(color.rgb, foggedColor.rgb, vFace);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c7938bab5e4b6e46af2d3d65e75fe34
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Fog.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,117 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_GERSTNER_INCLUDED
|
||||
#define WATER_GERSTNER_INCLUDED
|
||||
|
||||
#define MAX_AMPLITUDE 5.0
|
||||
#define GRAVITY 9.8f
|
||||
|
||||
float3 _GlobalWaveOriginOffset;
|
||||
|
||||
#if !defined(UNITY_CORE_SAMPLERS_INCLUDED)
|
||||
//Do not want linear interpolation between texels, forcing the usage of a point sampler
|
||||
SamplerState sampler_PointClamp;
|
||||
#endif
|
||||
|
||||
struct WaveParameters
|
||||
{
|
||||
uint enabled;
|
||||
float amplitude;
|
||||
float waveLength;
|
||||
float steepness;
|
||||
uint mode;
|
||||
float direction;
|
||||
float2 origin;
|
||||
};
|
||||
|
||||
//Sample parameters from LUT, stored in two horizontal rows
|
||||
void SampleWaveParameters(inout WaveParameters data, uint index, Texture2D tex, uint columns)
|
||||
{
|
||||
//Each layer's data is stored in a texel, from left to right. The horizontal position corresponds to the array element, so that's the UV
|
||||
const float2 lutUV = float2((float)index / (float)columns, 0);
|
||||
|
||||
const float4 row0 = SAMPLE_TEXTURE2D_LOD(tex, sampler_PointClamp, lutUV, 0);
|
||||
data.amplitude = row0.x;
|
||||
data.waveLength = row0.y;
|
||||
data.direction = row0.z; //Rotation angle in radians
|
||||
data.enabled = row0.w;
|
||||
|
||||
const float4 row1 = SAMPLE_TEXTURE2D_LOD(tex, sampler_PointClamp, lutUV + float2(0, 0.5), 0);
|
||||
data.origin = row1.xy + _GlobalWaveOriginOffset.xz;
|
||||
data.mode = row1.z;
|
||||
data.steepness = row1.w;
|
||||
}
|
||||
|
||||
//LUT texture is passed in as a parameter, since it may differ on a per-material basis
|
||||
void CalculateGerstnerWaves_float(in Texture2D<float4> lutTex, in uint layerCount, in float2 position, in float frequency, in float time, in float normalStrength, in float2 baseDirection, in uint count, out float3 offset, out float3 tangent, out float3 bitangent)
|
||||
{
|
||||
//Defaults
|
||||
offset = float3(0,0,0);
|
||||
tangent = float3(1,0,0);
|
||||
bitangent = float3(0,0,1);
|
||||
|
||||
//Clamp to maximum number of layers
|
||||
count = min(count - 1, layerCount);
|
||||
|
||||
WaveParameters layer = (WaveParameters)0;
|
||||
|
||||
uint waveCount = 0;
|
||||
for(uint i = 0; i <= count; i++)
|
||||
{
|
||||
SampleWaveParameters(layer, i, lutTex, layerCount);
|
||||
|
||||
if(layer.enabled > 0)
|
||||
{
|
||||
waveCount += 1;
|
||||
|
||||
const float w = TWO_PI / (layer.waveLength * frequency);
|
||||
const float freq = sqrt(GRAVITY * w);
|
||||
//As amplitude scales down, so should the steepness
|
||||
half ampRCP = (layer.amplitude/MAX_AMPLITUDE);
|
||||
//Both divide and scale by amplitude
|
||||
float steepness = (layer.steepness / layer.amplitude) * ampRCP;
|
||||
|
||||
//Rotation already pre-converted into radians
|
||||
float2 direction = float2(sin(layer.direction), cos(layer.direction)) * baseDirection;
|
||||
|
||||
//Radial mode
|
||||
if(layer.mode == 1)
|
||||
{
|
||||
direction = (position - layer.origin);
|
||||
direction = normalize(direction);
|
||||
}
|
||||
|
||||
const float dir = dot(direction, position - (layer.origin * layer.mode));
|
||||
|
||||
const float t = dir * w + (freq * -time);
|
||||
|
||||
float proximalSine = sin(t); //Y
|
||||
float lateralSine = cos(t); //XZ
|
||||
|
||||
//Relative XYZ offsets
|
||||
offset.x += direction.x * layer.amplitude * lateralSine * steepness;
|
||||
offset.y += proximalSine * layer.amplitude;
|
||||
offset.z += direction.y * layer.amplitude * lateralSine * steepness;
|
||||
|
||||
tangent += float3(
|
||||
-direction.x * direction.x * (steepness * proximalSine),
|
||||
offset.x,
|
||||
-direction.x * direction.y * (steepness * proximalSine)
|
||||
);
|
||||
|
||||
bitangent += float3(
|
||||
-direction.x * direction.y * (steepness * proximalSine),
|
||||
offset.z,
|
||||
-direction.y * -direction.y * (steepness * proximalSine)
|
||||
);
|
||||
}
|
||||
}
|
||||
waveCount = max(waveCount, 1);
|
||||
|
||||
tangent = lerp(float3(1,0,0), tangent, normalStrength / waveCount);
|
||||
bitangent = lerp(float3(0,0,1), bitangent, normalStrength / waveCount);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c34798f0964a3e42997b7f7ec3408da
|
||||
timeCreated: 1715773949
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Gerstner.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,109 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#include "Projection.hlsl"
|
||||
|
||||
uniform bool _WaterHeightPrePassAvailable;
|
||||
#define VOID_THRESHOLD -1000 //Same value as in HeightPrePass class
|
||||
|
||||
uniform float3 _WaterHeightCoords;
|
||||
//XY: Bounds min
|
||||
//Z: Bounds size
|
||||
uniform Texture2D _WaterHeightBuffer;
|
||||
//RED: Geometry world height
|
||||
//GREEN: Relative world height (displacement effects)
|
||||
|
||||
#ifndef UNITY_CORE_SAMPLERS_INCLUDED
|
||||
SamplerState sampler_LinearClamp;
|
||||
#endif
|
||||
|
||||
//Position, relative to rendering bounds (normalized 0-1)
|
||||
float2 WorldToHeightUV(float3 positionWS)
|
||||
{
|
||||
return WorldToProjectionUV(positionWS, _WaterHeightCoords.xy, _WaterHeightCoords.z);
|
||||
}
|
||||
|
||||
//May be used to validate if the sampled (summed) height is actually from a water surface
|
||||
bool HasHitWaterSurface(float height)
|
||||
{
|
||||
return height > VOID_THRESHOLD;
|
||||
}
|
||||
|
||||
float2 SampleHeightBuffer(float2 uv)
|
||||
{
|
||||
//if(_WaterHeightPrePassAvailable == false) return VOID_THRESHOLD;
|
||||
|
||||
float2 heightData = _WaterHeightBuffer.SampleLevel(sampler_LinearClamp, uv, 0).rg;
|
||||
|
||||
return heightData;
|
||||
}
|
||||
|
||||
//Main function
|
||||
float2 SampleWaterHeight(float3 positionWS)
|
||||
{
|
||||
return SampleHeightBuffer(WorldToHeightUV(positionWS));
|
||||
}
|
||||
|
||||
//Alternative version
|
||||
void SampleWaterHeights(float3 positionWS, out float geometryHeight, out float displacement)
|
||||
{
|
||||
float2 heights = SampleHeightBuffer(WorldToHeightUV(positionWS));
|
||||
|
||||
geometryHeight = heights.r;
|
||||
displacement = heights.g;
|
||||
}
|
||||
|
||||
//Derive a world-space normal from the height data
|
||||
float3 CalculateWaterNormal(float3 positionWS, float strength)
|
||||
{
|
||||
if(_WaterHeightPrePassAvailable == false) return float3(0,1,0);
|
||||
|
||||
//Note: not using the buffer's texel size so that the sampled result remains consistent across different resolutions.
|
||||
const float radius = 1.0 / _WaterHeightCoords.z;
|
||||
|
||||
float2 uv = WorldToHeightUV(positionWS);
|
||||
|
||||
const float2 xMinSample = SampleHeightBuffer(float2(uv.x - radius, uv.y)).rg;
|
||||
const float xLeft = xMinSample.r + xMinSample.g;
|
||||
const float2 xMaxSample = SampleHeightBuffer(float2(uv.x + radius, uv.y)).rg;
|
||||
const float xRight = xMaxSample.r + xMaxSample.g;
|
||||
|
||||
const float2 yMaxSample = SampleHeightBuffer(float2(uv.x, uv.y + radius)).rg;
|
||||
const float yUp = yMaxSample.r + yMaxSample.g;
|
||||
const float2 yMinSample = SampleHeightBuffer(float2(uv.x, uv.y - radius)).rg;
|
||||
const float yDown = yMinSample.r + yMinSample.g;
|
||||
|
||||
float xDelta = (xLeft - xRight) * strength;
|
||||
float zDelta = (yDown - yUp) * strength;
|
||||
|
||||
float3 normal = float3(xDelta, 1.0, zDelta);
|
||||
|
||||
//return float3(0,xLeft,0);
|
||||
|
||||
return normalize(normal.xyz);
|
||||
}
|
||||
|
||||
//Shader Graph
|
||||
void SampleWaterHeight_float(float3 positionWS, out float geometryHeight, out float displacement)
|
||||
{
|
||||
#if defined(SHADERGRAPH_PREVIEW)
|
||||
geometryHeight = positionWS.y;
|
||||
displacement = 0.0;
|
||||
#else
|
||||
float2 heights = SampleWaterHeight(positionWS);
|
||||
geometryHeight = heights.r;
|
||||
displacement = heights.g;
|
||||
#endif
|
||||
}
|
||||
|
||||
//Shader Graph
|
||||
void CalculateWaterNormal_float(float3 positionWS, float strength, out float3 normal)
|
||||
{
|
||||
#if defined(SHADERGRAPH_PREVIEW)
|
||||
normal = float3(0,1,0);
|
||||
#else
|
||||
normal = CalculateWaterNormal(positionWS, strength);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4453c99908d0997428446580ee1d8bd0
|
||||
timeCreated: 1701267893
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Height.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,149 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_INPUT_INCLUDED
|
||||
#define WATER_INPUT_INCLUDED
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
float4 _ShallowColor;
|
||||
float4 _BaseColor;
|
||||
half _ColorAbsorption;
|
||||
|
||||
//float _Smoothness;
|
||||
//float _Metallic;
|
||||
|
||||
float4 _IntersectionColor;
|
||||
uint _FogSource;
|
||||
float _DepthVertical;
|
||||
float _DepthHorizontal;
|
||||
float _WorldSpaceUV;
|
||||
float2 _NormalTiling;
|
||||
float _NormalSubTiling;
|
||||
float _NormalSpeed;
|
||||
float _NormalSubSpeed;
|
||||
half _NormalStrength;
|
||||
|
||||
half2 _DistanceNormalsFadeDist;
|
||||
half _DistanceNormalsTiling;
|
||||
|
||||
half _TranslucencyStrength;
|
||||
half _TranslucencyStrengthDirect;
|
||||
half _TranslucencyExp;
|
||||
half _TranslucencyCurvatureMask;
|
||||
half _EdgeFade;
|
||||
float4 _HorizonColor;
|
||||
half _HorizonDistance;
|
||||
float _SparkleIntensity;
|
||||
half _SparkleSize;
|
||||
half _SunReflectionDistortion;
|
||||
half _SunReflectionSize;
|
||||
float _SunReflectionStrength;
|
||||
bool _SunReflectionSharp;
|
||||
|
||||
float _PointSpotLightReflectionStrength;
|
||||
half _PointSpotLightReflectionSize;
|
||||
half _PointSpotLightReflectionDistortion;
|
||||
bool _PointSpotLightReflectionSharp;
|
||||
|
||||
|
||||
float _ReflectionDistortion;
|
||||
float _ReflectionBlur;
|
||||
float _ReflectionFresnel;
|
||||
float _ReflectionStrength;
|
||||
half _ReflectionLighting;
|
||||
bool _PlanarReflectionsEnabled;
|
||||
bool _ScreenSpaceReflectionsEnabled;
|
||||
half _ShadowStrength;
|
||||
float2 _Direction;
|
||||
float _Speed;
|
||||
|
||||
half _SlopeStretching;
|
||||
half _SlopeSpeed;
|
||||
half _SlopeAngleThreshold;
|
||||
half _SlopeAngleFalloff;
|
||||
half _SlopeFoam;
|
||||
|
||||
//Foam
|
||||
float4 _FoamColor;
|
||||
float _FoamSpeed;
|
||||
float _FoamSubSpeed;
|
||||
float2 _FoamTiling;
|
||||
float _FoamSubTiling;
|
||||
half _FoamBaseAmount;
|
||||
half _FoamStrength;
|
||||
half _FoamClipping;
|
||||
half2 _FoamCrestMinMaxHeight;
|
||||
half _FoamBubblesSpread;
|
||||
half _FoamBubblesStrength;
|
||||
half _FoamDistortion;
|
||||
half2 _DistanceFoamFadeDist;
|
||||
float _DistanceFoamTiling;
|
||||
|
||||
float _FoamTilingDynamic;
|
||||
float _FoamSubTilingDynamic;
|
||||
float _FoamSpeedDynamic;
|
||||
float _FoamSubSpeedDynamic;
|
||||
half _FoamClippingDynamic;
|
||||
|
||||
//Intersection
|
||||
half _IntersectionSource;
|
||||
half _IntersectionLength;
|
||||
half _IntersectionFalloff;
|
||||
half _IntersectionTiling;
|
||||
half _IntersectionDistortion;
|
||||
half _IntersectionRippleDist;
|
||||
half _IntersectionRippleStrength;
|
||||
float _IntersectionRippleSpeed;
|
||||
half _IntersectionClipping;
|
||||
bool _IntersectionSharp;
|
||||
float _IntersectionSpeed;
|
||||
|
||||
//Waves
|
||||
half _WaveHeight;
|
||||
float _WaveFrequency;
|
||||
half _WaveNormalStr;
|
||||
float _WaveDistance;
|
||||
half2 _WaveFadeDistance;
|
||||
float _WaveSteepness;
|
||||
uint _WaveMaxLayers;
|
||||
half4 _WaveDirection;
|
||||
float _WaveSpeed;
|
||||
|
||||
half _ShoreLineWaveStr;
|
||||
half _ShoreLineWaveDistance;
|
||||
half _ShoreLineLength;
|
||||
|
||||
//Underwater
|
||||
half _CausticsBrightness;
|
||||
half _CausticsChromance;
|
||||
float _CausticsTiling;
|
||||
half _CausticsSpeed;
|
||||
half _RefractionStrength;
|
||||
half _RefractionChromaticAberration;
|
||||
half _CausticsDistortion;
|
||||
bool _EnableDirectionalCaustics;
|
||||
|
||||
half _UnderwaterSurfaceSmoothness;
|
||||
half _UnderwaterRefractionOffset;
|
||||
half _UnderwaterReflectionStrength;
|
||||
|
||||
half _VertexColorTransparency;
|
||||
half _VertexColorWaveFlattening;
|
||||
half _VertexColorFoam;
|
||||
|
||||
bool _ReceiveDynamicEffectsHeight;
|
||||
half _ReceiveDynamicEffectsFoam;
|
||||
bool _ReceiveDynamicEffectsNormal;
|
||||
|
||||
half _WaveTint;
|
||||
float4 _WaveProfile_TexelSize;
|
||||
//#ifdef TESSELLATION_ON
|
||||
float _TessValue;
|
||||
float _TessMin;
|
||||
float _TessMax;
|
||||
//#endif
|
||||
CBUFFER_END
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d200c414efa119f4aa38b83f1f15d281
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Input.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,306 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_LIGHTING_INCLUDED
|
||||
#define WATER_LIGHTING_INCLUDED
|
||||
|
||||
#include "Common.hlsl"
|
||||
#include "Reflections.hlsl"
|
||||
|
||||
#define SPECULAR_POWER_RCP 0.01562 // 1.0/32
|
||||
#define SPECULAR_STEP_THRESHOLD 0.2
|
||||
|
||||
//Reusable for every light
|
||||
struct TranslucencyData
|
||||
{
|
||||
bool directionalLight;
|
||||
float3 subsurfaceColor;
|
||||
float3 lightColor;
|
||||
float3 lightDir;
|
||||
float3 viewDir;
|
||||
float3 normal;
|
||||
float curvature;
|
||||
float mask; //Actually the 'thickness'
|
||||
float strength;
|
||||
float strengthIncident;
|
||||
float exponent;
|
||||
|
||||
};
|
||||
|
||||
TranslucencyData PopulateTranslucencyData(float3 subsurfaceColor, float3 lightDir, float3 lightColor, float3 viewDir, float3 WorldNormal, float3 worldTangentNormal, float mask, float strength, float incidentStrength, float exponent, float offset, bool directionalLight)
|
||||
{
|
||||
TranslucencyData d = (TranslucencyData)0;
|
||||
d.directionalLight = directionalLight;
|
||||
d.subsurfaceColor = subsurfaceColor;
|
||||
d.lightColor = lightColor;
|
||||
d.lightDir = lightDir;
|
||||
|
||||
#if _ADVANCED_SHADING
|
||||
//Slightly include high frequency details
|
||||
d.normal = normalize(WorldNormal + (worldTangentNormal * 0.2));
|
||||
#else
|
||||
d.normal = WorldNormal;
|
||||
#endif
|
||||
d.curvature = offset;
|
||||
d.mask = mask; //Shadows, foam, intersection, etc
|
||||
d.strength = strength;
|
||||
d.strengthIncident = incidentStrength;
|
||||
d.viewDir = viewDir;
|
||||
d.exponent = exponent;
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
//Single channel overlay
|
||||
float BlendOverlay(float a, float b)
|
||||
{
|
||||
return (b < 0.5) ? 2.0 * a * b : 1.0 - 2.0 * (1.0 - a) * (1.0 - b);
|
||||
}
|
||||
|
||||
//RGB overlay
|
||||
float3 BlendOverlay(float3 a, float3 b)
|
||||
{
|
||||
return float3(BlendOverlay(a.r, b.r), BlendOverlay(a.g, b.g), BlendOverlay(a.b, b.b));
|
||||
}
|
||||
|
||||
//In URP light intensity is pre-multiplied with the HDR color, extract via magnitude of color "vector"
|
||||
float GetLightIntensity(float3 lightColor)
|
||||
{
|
||||
//Luminance equals HDR output
|
||||
return (lightColor.r * 0.3 + lightColor.g * 0.59 + lightColor.b * 0.11);
|
||||
}
|
||||
|
||||
float GetLightIntensity(Light light) { return GetLightIntensity(light.color); }
|
||||
|
||||
void ApplyTranslucency(float3 subsurfaceColor, float3 lightDir, float3 lightColor, float3 viewDir, float3 normal, float occlusion, float strength, float incidentStrength, float exponent, float offset, bool directionalLight, inout float3 emission)
|
||||
{
|
||||
//Coefficient describing how much the surface orientation is between the camera and the direction of/to the light
|
||||
half transmittance = saturate(dot(-viewDir, lightDir));
|
||||
//Exponentiate to tighten the falloff
|
||||
transmittance = saturate(pow(transmittance, exponent)) * strength;
|
||||
|
||||
half incident = 0;
|
||||
if(directionalLight)
|
||||
{
|
||||
incident = saturate(dot(lightDir, normal)) * incidentStrength;
|
||||
}
|
||||
|
||||
//Mask by normals facing away from the light (backfaces, in light-space)
|
||||
const half curvature = saturate(lerp(1.0, dot(normal, -lightDir), offset));
|
||||
transmittance *= curvature;
|
||||
|
||||
const float lightIntensity = saturate(GetLightIntensity(lightColor));
|
||||
|
||||
half attenuation = (transmittance + incident) * occlusion * lightIntensity;
|
||||
|
||||
#if _ADVANCED_SHADING
|
||||
if(directionalLight)
|
||||
{
|
||||
//Fade the effect out as the sun approaches the horizon (80 to 90 degrees)
|
||||
half sunAngle = saturate(dot(float3(0, 1, 0), lightDir));
|
||||
half angleMask = saturate(sunAngle * 10); /* 1.0/0.10 = 10 */
|
||||
attenuation *= angleMask;
|
||||
}
|
||||
|
||||
//Modulate with light color to better match dynamic lighting conditions
|
||||
subsurfaceColor = BlendOverlay(saturate(lightColor), subsurfaceColor);
|
||||
|
||||
emission += subsurfaceColor * attenuation;
|
||||
#else //Simple shading
|
||||
emission += lerp(emission, subsurfaceColor, attenuation);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ApplyTranslucency(TranslucencyData translucencyData, inout float3 emission)
|
||||
{
|
||||
ApplyTranslucency(translucencyData.subsurfaceColor, translucencyData.lightDir, translucencyData.lightColor, translucencyData.viewDir, translucencyData.normal, translucencyData.mask, translucencyData.strength, translucencyData.strengthIncident, translucencyData.exponent, translucencyData.curvature, translucencyData.directionalLight, emission);
|
||||
}
|
||||
|
||||
void AdjustShadowStrength(inout Light light, float strength, float vFace)
|
||||
{
|
||||
light.shadowAttenuation = saturate(light.shadowAttenuation + (1.0 - (strength * vFace)));
|
||||
}
|
||||
|
||||
//Specular Blinn-phong reflection in world-space
|
||||
float3 SpecularReflection(Light light, float3 viewDirectionWS, float3 geometryNormalWS, float3 normalWS, float perturbation, float exponent, float intensity, bool sharp)
|
||||
{
|
||||
//Blend between geometry/wave normals and normals from normal map (aka distortion)
|
||||
normalWS = lerp(geometryNormalWS, normalWS, perturbation);
|
||||
|
||||
const float3 halfVec = normalize(light.direction + viewDirectionWS + (normalWS * perturbation));
|
||||
half NdotH = saturate(dot(geometryNormalWS, halfVec));
|
||||
|
||||
float specular = pow(NdotH, exponent);
|
||||
|
||||
if(sharp)
|
||||
{
|
||||
specular = step(SPECULAR_STEP_THRESHOLD, specular);
|
||||
intensity *= 0.5;
|
||||
}
|
||||
|
||||
//Attenuation includes shadows, if available
|
||||
const float3 attenuatedLightColor = light.color * (light.distanceAttenuation * light.shadowAttenuation);
|
||||
|
||||
//Mask reflection by surfaces "visible" by the light only
|
||||
float viewFactor = saturate(dot(geometryNormalWS, light.direction));
|
||||
|
||||
#if _ADVANCED_SHADING
|
||||
//Create a linear gradient a little before the cutoff point, in order to maintain HDR values properly
|
||||
viewFactor = smoothstep(0.0, 0.15, viewFactor);
|
||||
#endif
|
||||
|
||||
float3 specColor = attenuatedLightColor * specular * intensity * viewFactor;
|
||||
|
||||
#if UNITY_COLORSPACE_GAMMA
|
||||
specColor = LinearToSRGB(specColor);
|
||||
#endif
|
||||
|
||||
return specColor;
|
||||
}
|
||||
|
||||
//Based on UniversalFragmentBlinnPhong (no BRDF)
|
||||
float3 ApplyLighting(inout SurfaceData surfaceData, inout float3 sceneColor, Light mainLight, InputData inputData, WaterSurface water, TranslucencyData translucencyData, float shadowStrength, float vFace, bool isMatchingLightLayer)
|
||||
{
|
||||
if(isMatchingLightLayer) ApplyTranslucency(translucencyData, surfaceData.emission.rgb);
|
||||
|
||||
#if _CAUSTICS
|
||||
float causticsAttentuation = 1.0;
|
||||
#endif
|
||||
|
||||
half3 diffuseColor = 0;
|
||||
#if !defined(_UNLIT)
|
||||
#if _CAUSTICS && !defined(LIGHTMAP_ON)
|
||||
if(isMatchingLightLayer)
|
||||
{
|
||||
causticsAttentuation = GetLightIntensity(mainLight) * (mainLight.distanceAttenuation * mainLight.shadowAttenuation);
|
||||
}
|
||||
#endif
|
||||
|
||||
MixRealtimeAndBakedGI(mainLight, water.diffuseNormal, inputData.bakedGI, shadowStrength.xxxx);
|
||||
|
||||
/*
|
||||
//PBR shading
|
||||
BRDFData brdfData;
|
||||
InitializeBRDFData(surfaceData.albedo, surfaceData.metallic, surfaceData.specular, surfaceData.smoothness, surfaceData.alpha, brdfData);
|
||||
|
||||
half3 diffuseColor = GlobalIllumination(brdfData, inputData.bakedGI, shadowStrength, inputData.water.diffuseNormal, inputData.viewDirectionWS);
|
||||
diffuseColor += LightingPhysicallyBased(brdfData, mainLight, water.diffuseNormal, inputData.viewDirectionWS);
|
||||
*/
|
||||
|
||||
half3 directLight = 0;
|
||||
if(isMatchingLightLayer)
|
||||
{
|
||||
//Allow shadow strength to be overridden.
|
||||
AdjustShadowStrength(mainLight, shadowStrength, vFace);
|
||||
|
||||
half3 attenuatedLightColor = mainLight.color * (mainLight.distanceAttenuation * mainLight.shadowAttenuation);
|
||||
directLight = LightingLambert(attenuatedLightColor, mainLight.direction, water.diffuseNormal);
|
||||
}
|
||||
diffuseColor = inputData.bakedGI + directLight;
|
||||
|
||||
#if _ADDITIONAL_LIGHTS //Per pixel lights
|
||||
#ifndef _SPECULARHIGHLIGHTS_OFF
|
||||
half specularPower = (_PointSpotLightReflectionSize * SPECULAR_POWER_RCP);
|
||||
specularPower = lerp(8.0, 1.0, _PointSpotLightReflectionSize) * _PointSpotLightReflectionStrength;
|
||||
#endif
|
||||
|
||||
uint pixelLightCount = GetAdditionalLightsCount();
|
||||
#if _LIGHT_LAYERS
|
||||
uint meshRenderingLayers = GetMeshRenderingLayer();
|
||||
#endif
|
||||
|
||||
#if _TRANSLUCENCY
|
||||
float translucencyStrength = translucencyData.strength;
|
||||
float translucencyExp = translucencyData.exponent;
|
||||
#endif
|
||||
|
||||
LIGHT_LOOP_BEGIN(pixelLightCount)
|
||||
|
||||
Light light = GetAdditionalLight(lightIndex, inputData.positionWS, shadowStrength.xxxx);
|
||||
|
||||
#if _LIGHT_LAYERS
|
||||
if (IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
#endif
|
||||
{
|
||||
#if _ADVANCED_SHADING
|
||||
#if _CAUSTICS && !_LIGHT_COOKIES && defined(_ADDITIONAL_LIGHT_CAUSTICS) //Actually want to skip this when using cookies. Since they can be used for caustics instead
|
||||
//Light attenuation adds caustics, mask by shadows
|
||||
causticsAttentuation += GetLightIntensity(light) * (light.distanceAttenuation * light.shadowAttenuation) * _PointSpotLightReflectionStrength * (1-water.fog);
|
||||
#endif
|
||||
|
||||
#if _TRANSLUCENCY && defined(_ADDITIONAL_LIGHT_TRANSLUCENCY)
|
||||
//Keep settings from main light pass, but override these
|
||||
translucencyData.directionalLight = false;
|
||||
if(water.vFace > 0)
|
||||
{
|
||||
translucencyData.lightDir = light.direction;
|
||||
translucencyData.lightColor = light.color * light.distanceAttenuation;
|
||||
translucencyData.strength = translucencyStrength * light.shadowAttenuation * (water.fog);
|
||||
translucencyData.exponent = translucencyExp * light.distanceAttenuation;
|
||||
|
||||
ApplyTranslucency(translucencyData, surfaceData.emission.rgb);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _ADDITIONAL_LIGHT_SHADOWS //URP 11+
|
||||
AdjustShadowStrength(light, shadowStrength, vFace);
|
||||
#endif
|
||||
|
||||
half3 attenuatedLightColor = light.color * (light.distanceAttenuation * light.shadowAttenuation);
|
||||
diffuseColor += LightingLambert(attenuatedLightColor, light.direction, water.diffuseNormal);
|
||||
|
||||
#ifndef _SPECULARHIGHLIGHTS_OFF
|
||||
//Note: View direction fetched again using the function that takes orthographic projection into account
|
||||
surfaceData.specular += SpecularReflection(light, normalize(GetWorldSpaceViewDir(inputData.positionWS)), water.waveNormal, water.tangentWorldNormal, _PointSpotLightReflectionDistortion, lerp(4096, 64, _PointSpotLightReflectionSize), specularPower, _PointSpotLightReflectionSharp);
|
||||
#endif
|
||||
}
|
||||
LIGHT_LOOP_END
|
||||
#endif
|
||||
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX //Previous calculated in vertex stage
|
||||
diffuseColor += inputData.vertexLighting;
|
||||
#endif
|
||||
|
||||
#else //Unlit
|
||||
diffuseColor = 1.0;
|
||||
#endif
|
||||
|
||||
#if _CAUSTICS
|
||||
surfaceData.emission.rgb += water.caustics * causticsAttentuation * vFace;
|
||||
#endif
|
||||
|
||||
float3 color = (surfaceData.albedo.rgb * diffuseColor) + surfaceData.emission.rgb + surfaceData.specular;
|
||||
|
||||
#ifndef _ENVIRONMENTREFLECTIONS_OFF
|
||||
//Reflections blend in on top of everything
|
||||
color = lerp(color, water.reflections.rgb, water.reflectionMask * water.reflectionLighting * vFace);
|
||||
#endif
|
||||
|
||||
#if _REFRACTION
|
||||
//Ensure the same effects are applied to the underwater scene color. Otherwise not visible on clear water
|
||||
sceneColor += (surfaceData.emission.rgb + surfaceData.specular) * vFace;
|
||||
#endif
|
||||
|
||||
//Debug
|
||||
//return float4(surfaceData.emission.rgb, 1.0);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
//Color of light ray passing through the water, hitting the sea floor (extinction)
|
||||
//This applies to the scene color
|
||||
float LightExtinction(float verticalDepth, float viewDepth, float density)
|
||||
{
|
||||
return exp(-density * (verticalDepth + viewDepth));
|
||||
}
|
||||
|
||||
//Energy loss of ray, as it travels deeper and scatters (absorption)
|
||||
//This applies to the color of the underwater fog
|
||||
float LightAbsorption(float absorption, float viewDepth)
|
||||
{
|
||||
return saturate(exp(-absorption * viewDepth));
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38853322ca865a940b928d6b89c909d4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Lighting.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,76 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
TEXTURE2D(_BumpMap);
|
||||
SAMPLER(sampler_BumpMap);
|
||||
TEXTURE2D(_BumpMapLarge);
|
||||
TEXTURE2D(_BumpMapSlope);
|
||||
|
||||
float3 BlendTangentNormals(float3 a, float3 b)
|
||||
{
|
||||
#if _ADVANCED_SHADING
|
||||
return BlendNormalRNM(a, b);
|
||||
#else
|
||||
return BlendNormal(a, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
float3 SampleNormals(float2 uv, float2 tiling, float subTiling, float3 wPos, float2 time, float speed, float subSpeed, float slope, int vFace)
|
||||
{
|
||||
float4 uvs = PackedUV(uv, tiling, time, speed, subTiling, subSpeed);
|
||||
float3 n1 = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, uvs.xy));
|
||||
float3 n2 = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, uvs.zw));
|
||||
|
||||
float3 blendedNormals = BlendTangentNormals(n1, n2);
|
||||
|
||||
#ifdef QUAD_NORMAL_SAMPLES
|
||||
uvs = PackedUV(uv, tiling, time.yx, speed, subTiling, subSpeed);
|
||||
float3 n4 = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, uvs.xy * 2.0));
|
||||
float3 n5 = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMap, sampler_BumpMap, uvs.zw * 2.0));
|
||||
|
||||
blendedNormals = BlendTangentNormals(blendedNormals, BlendTangentNormals(n4, n5));
|
||||
#endif
|
||||
|
||||
#if _DISTANCE_NORMALS
|
||||
float fadeFactor = DistanceFadeMask(wPos, _DistanceNormalsFadeDist.x, _DistanceNormalsFadeDist.y, vFace);
|
||||
|
||||
float3 largeBlendedNormals;
|
||||
|
||||
half distanceSubSpeed = -0.9;
|
||||
#if _RIVER
|
||||
distanceSubSpeed = 0.9;
|
||||
#endif
|
||||
|
||||
uvs = PackedUV(uv, _DistanceNormalsTiling.xx, time, speed * 2.0, 2.0, distanceSubSpeed);
|
||||
float3 n1b = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMapLarge, sampler_BumpMap, uvs.xy));
|
||||
|
||||
#if _ADVANCED_SHADING //Use 2nd texture sample
|
||||
float3 n2b = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMapLarge, sampler_BumpMap, uvs.zw));
|
||||
largeBlendedNormals = BlendTangentNormals(n1b, n2b);
|
||||
#else
|
||||
largeBlendedNormals = n1b;
|
||||
#endif
|
||||
|
||||
blendedNormals = lerp(largeBlendedNormals, blendedNormals, fadeFactor);
|
||||
#endif
|
||||
|
||||
#if _RIVER
|
||||
uvs = PackedUV(uv, tiling, time, speed * _SlopeSpeed, subTiling, subSpeed * _SlopeSpeed);
|
||||
uvs.xy = uvs.xy * float2(1, 1-_SlopeStretching);
|
||||
float3 n3 = UnpackNormal(SAMPLE_TEXTURE2D(_BumpMapSlope, sampler_BumpMap, uvs.xy));
|
||||
|
||||
#if _ADVANCED_SHADING
|
||||
n3 = BlendTangentNormals(n3, UnpackNormal(SAMPLE_TEXTURE2D(_BumpMapSlope, sampler_BumpMap, uvs.zw)));
|
||||
#endif
|
||||
|
||||
blendedNormals = lerp(blendedNormals, n3, slope);
|
||||
#endif
|
||||
|
||||
#if WAVE_SIMULATION
|
||||
BlendWaveSimulation(wPos, blendedNormals);
|
||||
#endif
|
||||
|
||||
return blendedNormals;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41756f23fe64419bba7b33df20a1769e
|
||||
timeCreated: 1730297021
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Normals.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,30 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef PROJECTION_UTILS_INCLUDED
|
||||
#define PROJECTION_UTILS_INCLUDED
|
||||
|
||||
//Position, relative to rendering bounds (normalized 0-1)
|
||||
float2 WorldToProjectionUV(float3 positionWS, float2 origin, float size)
|
||||
{
|
||||
return (positionWS.xz - origin.xy) / size;
|
||||
}
|
||||
|
||||
float ProjectionEdgeMask(float3 positionWS, float2 origin, float size, float blendDistance)
|
||||
{
|
||||
const float extents = (size * 0.499);
|
||||
|
||||
//Shift to origin
|
||||
positionWS = positionWS - extents;
|
||||
|
||||
const float2 boundsMin = origin.xy - extents;
|
||||
const float2 boundsMax = origin.xy + extents;
|
||||
|
||||
float2 weightDir = min(positionWS.xz - boundsMin, boundsMax - positionWS.xz) / blendDistance;
|
||||
|
||||
return saturate(min(weightDir.x, weightDir.y));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05ebdef3885046e983ec45e7afff5ab9
|
||||
timeCreated: 1721054165
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Projection.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,163 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_REFLECTIONS_INCLUDED
|
||||
#define WATER_REFLECTIONS_INCLUDED
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl"
|
||||
|
||||
#define AIR_RI 1.000293
|
||||
|
||||
//Schlick's BRDF fresnel
|
||||
float ReflectionFresnel(float3 worldNormal, float3 viewDir, float exponent)
|
||||
{
|
||||
float cosTheta = saturate(dot(worldNormal, viewDir));
|
||||
return pow(max(0.0, AIR_RI - cosTheta), exponent);
|
||||
}
|
||||
|
||||
float AttenuateSSR(float2 uv)
|
||||
{
|
||||
float offset = min(1.0 - max(uv.x, uv.y), min(uv.x, uv.y));
|
||||
|
||||
float result = offset / (0.1);
|
||||
result = saturate(result);
|
||||
|
||||
return pow(result, 0.5);
|
||||
}
|
||||
|
||||
|
||||
float4 _WaterSSRParams;
|
||||
//X: Enabled bool
|
||||
//Y: Accept skybox hits
|
||||
|
||||
#define ALLOW_SSR _WaterSSRParams.x > 0.5
|
||||
#define SSR_REFLECT_SKY _WaterSSRParams.y > 0.5
|
||||
|
||||
float4 _WaterSSRSettings;
|
||||
//X: Steps
|
||||
//Y: Step size
|
||||
//Z: Max distance
|
||||
//W: Thickness
|
||||
|
||||
#define SSR_SAMPLES _WaterSSRSettings.x
|
||||
#define SSR_STEPSIZE _WaterSSRSettings.y
|
||||
#define SSR_MAX_DISTANCE _WaterSSRSettings.z
|
||||
#define SSR_THICKNESS _WaterSSRSettings.w
|
||||
|
||||
void RaymarchSSR(float3 positionVS, float3 direction, uint samples, half stepSize, half thickness, out half2 sampleUV, out half valid, out half outOfBounds)
|
||||
{
|
||||
sampleUV = 0;
|
||||
valid = 0;
|
||||
outOfBounds = 0;
|
||||
|
||||
direction *= stepSize;
|
||||
const half rcpStepCount = rcp(samples);
|
||||
|
||||
UNITY_LOOP
|
||||
for(uint i = 0; i < samples; i++)
|
||||
{
|
||||
positionVS += direction;
|
||||
direction *= 1+stepSize;
|
||||
|
||||
//View-space to screen-space UV
|
||||
sampleUV = ComputeNormalizedDeviceCoordinates(positionVS, GetViewToHClipMatrix());
|
||||
|
||||
if (any(sampleUV < 0) || any(sampleUV > 1))
|
||||
{
|
||||
outOfBounds = 1;
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
outOfBounds = AttenuateSSR(sampleUV);
|
||||
|
||||
//Sample Mip0, gradient sampling cannot work with loops
|
||||
float deviceDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, sampleUV, 0).r;
|
||||
|
||||
//Depth is near-infinity. May want to reflect the skybox, if no reflection probes are present
|
||||
if(SSR_REFLECT_SKY && deviceDepth <= 0.00001)
|
||||
{
|
||||
valid = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
//Calculate view-space position from UV and depth
|
||||
//Not using the ComputeViewSpacePosition function, since this negates the Z-component
|
||||
float3 samplePos = ComputeWorldSpacePosition(sampleUV, deviceDepth, UNITY_MATRIX_I_P);
|
||||
|
||||
//Depth mismatch check. Geometry behind the water is invalid. If the difference in depth is large enough, consider it a miss.
|
||||
if (abs(samplePos.z - positionVS.z) > length(direction) * thickness) continue;
|
||||
|
||||
if(samplePos.z > positionVS.z)
|
||||
{
|
||||
valid = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEXTURE2D_X(_PlanarReflection);
|
||||
SAMPLER(sampler_PlanarReflection);
|
||||
|
||||
float3 SampleReflectionProbes(float3 reflectionVector, float3 positionWS, float smoothness, float2 screenPos)
|
||||
{
|
||||
float3 probes = float3(0,0,0);
|
||||
|
||||
probes = GlossyEnvironmentReflection(reflectionVector, positionWS, smoothness, 1.0, screenPos.xy).rgb;
|
||||
|
||||
return probes;
|
||||
}
|
||||
|
||||
float3 SampleReflections(float3 reflectionVector, float smoothness, float4 screenPos, float3 positionWS, float3 normalWS, float3 viewDir, float2 pixelOffset, bool planarReflectionsEnabled, bool ssrEnabled, out float3 renderedReflections)
|
||||
{
|
||||
screenPos.xy += pixelOffset.xy * lerp(1.0, 0.1, unity_OrthoParams.w);
|
||||
screenPos /= screenPos.w;
|
||||
|
||||
const float3 probes = SampleReflectionProbes(reflectionVector, positionWS, smoothness, screenPos.xy);
|
||||
|
||||
float3 reflections = probes;
|
||||
|
||||
//Output separately, for underwater rendering
|
||||
renderedReflections = 0;
|
||||
|
||||
#if !_DISABLE_DEPTH_TEX
|
||||
if(ssrEnabled && ALLOW_SSR)
|
||||
{
|
||||
const float3 positionVS = TransformWorldToView(positionWS);
|
||||
const float3 direction = TransformWorldToViewDir(reflectionVector);
|
||||
|
||||
float2 ssrUV = 0;
|
||||
half ssrRayMask, ssrEdgeMask = 0;
|
||||
|
||||
RaymarchSSR(positionVS, direction, SSR_SAMPLES, SSR_STEPSIZE, SSR_THICKNESS, ssrUV, ssrRayMask, ssrEdgeMask);
|
||||
|
||||
half ssrMask = ssrRayMask * ssrEdgeMask;
|
||||
const float3 reflectionSS = SampleSceneColor(ssrUV);
|
||||
|
||||
reflections = lerp(reflections, reflectionSS, ssrMask);
|
||||
|
||||
renderedReflections += reflectionSS * ssrMask;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !_RIVER //Planar reflections are pointless on curved surfaces, skip
|
||||
if(planarReflectionsEnabled)
|
||||
{
|
||||
float4 planarReflections = SAMPLE_TEXTURE2D_X_LOD(_PlanarReflection, sampler_PlanarReflection, screenPos.xy, 0);
|
||||
//Terrain add-pass can output negative alpha values. Clamp as a safeguard against this
|
||||
planarReflections.a = saturate(planarReflections.a);
|
||||
|
||||
reflections = lerp(reflections, planarReflections.rgb, planarReflections.a);
|
||||
|
||||
renderedReflections = lerp(renderedReflections, planarReflections.rgb, planarReflections.a);
|
||||
}
|
||||
#endif
|
||||
|
||||
return reflections;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88174d9ecc872bc4d9c1479869e92de0
|
||||
timeCreated: 1701010589
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Reflections.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,75 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl"
|
||||
|
||||
#define CHROMASHIFT_SIZE 0.05
|
||||
#define REFRACTION_IOR_RCP 0.7501875 //=1f/1.333f
|
||||
|
||||
float2 RefractionOffset(float2 screenPos, float3 viewDir, float3 normalWS, float strength)
|
||||
{
|
||||
//Normalized to match the more accurate method
|
||||
float2 offset = normalWS.xz * 0.5;
|
||||
|
||||
#if PHYSICAL_REFRACTION
|
||||
//Light direction as traveling towards the eye, through the water surface
|
||||
float3 rayDir = refract(-viewDir, normalWS, REFRACTION_IOR_RCP);
|
||||
//Convert to view-space, because the coordinates are used to sample a screen-space texture
|
||||
float3 viewSpaceRefraction = TransformWorldToViewDir(rayDir);
|
||||
|
||||
//Prevent streaking at the edges, by lerping to non-screenspace coordinates at the screen edges
|
||||
half edgeMask = ScreenEdgeMask(screenPos, length(viewSpaceRefraction.xy));
|
||||
//edgeMask = 1.0; //Test, disable
|
||||
|
||||
offset.xy = lerp(normalWS.xz * 0.5, viewSpaceRefraction.xy, edgeMask);
|
||||
#endif
|
||||
|
||||
return offset * strength;
|
||||
}
|
||||
|
||||
//#define TRANSPARENCY_REFRACTION
|
||||
|
||||
#ifdef TRANSPARENCY_REFRACTION
|
||||
TEXTURE2D_X(_CameraTransparentTexture);
|
||||
#endif
|
||||
|
||||
float3 SampleUnderwaterColor(float2 uv)
|
||||
{
|
||||
#ifdef TRANSPARENCY_REFRACTION
|
||||
float4 transparents = SAMPLE_TEXTURE2D_X(_CameraTransparentTexture, sampler_LinearClamp, uv.xy).rgba;
|
||||
//return transparents.rgb;
|
||||
#endif
|
||||
|
||||
float3 opaque = SampleSceneColor(uv.xy).rgb;
|
||||
|
||||
#ifdef TRANSPARENCY_REFRACTION
|
||||
opaque = opaque + (transparents.rgb * transparents.a);
|
||||
#endif
|
||||
|
||||
return opaque;
|
||||
}
|
||||
|
||||
float3 SampleOpaqueTexture(float4 screenPos, float2 offset, float dispersion)
|
||||
{
|
||||
//Normalize for perspective projection
|
||||
screenPos.xy += offset;
|
||||
screenPos.xy /= screenPos.w;
|
||||
|
||||
float3 sceneColor = SampleUnderwaterColor(screenPos.xy).rgb;
|
||||
|
||||
#if PHYSICAL_REFRACTION //Chromatic part
|
||||
if(dispersion > 0)
|
||||
{
|
||||
float chromaShift = (length(offset) * dispersion) / screenPos.w;
|
||||
//Note: screen buffer texelsize purposely not used, this way the effect is actually consistent across all resolutions
|
||||
float texelOffset = chromaShift * CHROMASHIFT_SIZE;
|
||||
|
||||
sceneColor.r = SampleUnderwaterColor(screenPos.xy + float2(texelOffset, 0)).r;
|
||||
sceneColor.b = SampleUnderwaterColor(screenPos.xy - float2(texelOffset, 0)).b;
|
||||
}
|
||||
#endif
|
||||
|
||||
return sceneColor;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 994c6995798c4c7aba55f4226c747b9b
|
||||
timeCreated: 1730296927
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Refraction.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,91 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#if !defined(SHADERGRAPH_PREVIEW)
|
||||
//#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Core.hlsl"
|
||||
#else
|
||||
SamplerState sampler_LinearClamp;
|
||||
#endif
|
||||
|
||||
#include "Projection.hlsl"
|
||||
|
||||
uniform Texture2D _TerrainHeightBuffer;
|
||||
float4 _TerrainHeightBuffer_TexelSize;
|
||||
uniform float3 _TerrainHeightRenderCoords;
|
||||
//XY: Bounds min
|
||||
//Z: Bounds size
|
||||
bool _TerrainHeightPrePassAvailable;
|
||||
|
||||
uniform Texture2D _WaterTerrainDistanceField;
|
||||
|
||||
|
||||
//Position, relative to rendering bounds (normalized 0-1)
|
||||
float2 WorldToTerrainUV(float3 positionWS)
|
||||
{
|
||||
return WorldToProjectionUV(positionWS, _TerrainHeightRenderCoords.xy, _TerrainHeightRenderCoords.z);
|
||||
}
|
||||
|
||||
float SampleTerrainHeightBuffer(float2 uv)
|
||||
{
|
||||
if(_TerrainHeightPrePassAvailable == false) return 0;
|
||||
return UnpackHeightmap(_TerrainHeightBuffer.SampleLevel(sampler_LinearClamp, uv, 0).r);
|
||||
}
|
||||
|
||||
//Main function
|
||||
float SampleTerrainHeightBuffer(float3 positionWS)
|
||||
{
|
||||
return SampleTerrainHeightBuffer(WorldToTerrainUV(positionWS));
|
||||
}
|
||||
|
||||
float SampleTerrainHeight(float3 positionWS)
|
||||
{
|
||||
return SampleTerrainHeightBuffer(positionWS);
|
||||
}
|
||||
|
||||
//Shader Graph
|
||||
void SampleTerrainHeight_float(float3 positionWS, out float height)
|
||||
{
|
||||
height = SampleTerrainHeightBuffer(positionWS);
|
||||
}
|
||||
|
||||
TEXTURE2D(_WaterTerrainIntersectionMask);
|
||||
float SampleTerrainIntersection(float3 positionWS)
|
||||
{
|
||||
return _WaterTerrainIntersectionMask.SampleLevel(sampler_LinearClamp, WorldToTerrainUV(positionWS), 0).r;
|
||||
}
|
||||
|
||||
float SampleTerrainDepth(float3 positionWS, float falloff)
|
||||
{
|
||||
float terrainHeight = SampleTerrainHeightBuffer(positionWS);
|
||||
|
||||
//Sampling position will correspond to the actual terrain position on the XZ plane
|
||||
float3 terrainPosition = float3(positionWS.x, terrainHeight, positionWS.z);
|
||||
|
||||
//if(terrainPosition.y >= positionWS.y) return 0;
|
||||
|
||||
float dist = abs(distance(positionWS, terrainPosition));
|
||||
|
||||
float attenuation = 1-saturate(dist / falloff);
|
||||
|
||||
//attenuation = saturate(exp(-(dist * falloff)));
|
||||
|
||||
return attenuation;
|
||||
}
|
||||
|
||||
|
||||
//Shader Graph
|
||||
void SampleTerrainDepth_float(float3 positionWS, float falloff, out float attenuation)
|
||||
{
|
||||
attenuation = SampleTerrainDepth(positionWS, falloff);
|
||||
}
|
||||
|
||||
float SampleTerrainSDF(float3 positionWS)
|
||||
{
|
||||
float sdfSample = _WaterTerrainDistanceField.SampleLevel(sampler_LinearClamp, WorldToTerrainUV(positionWS), 0).r;
|
||||
|
||||
float edgeMask = ProjectionEdgeMask(positionWS, _TerrainHeightRenderCoords.xy, _TerrainHeightRenderCoords.z, 15);
|
||||
|
||||
return sdfSample * edgeMask;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65f8cf5469d6447cb798e816e96bccb6
|
||||
timeCreated: 1718300795
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Terrain.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,154 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#if defined(SHADER_API_XBOXONE) || defined(SHADER_API_PSSL)
|
||||
// AMD recommends this value for GCN http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/05/GCNPerformanceTweets.pdf
|
||||
#define MAX_TESSELLATION_FACTORS 15.0
|
||||
#else
|
||||
#define MAX_TESSELLATION_FACTORS 64.0
|
||||
#endif
|
||||
|
||||
#if defined(SHADER_API_GLES2)
|
||||
#warning Current graphics API does not support tessellation, falling back to non-tessellated shader automatically.
|
||||
#else
|
||||
#define UNITY_CAN_COMPILE_TESSELLATION
|
||||
#endif
|
||||
|
||||
struct TessellationFactors
|
||||
{
|
||||
float edge[3] : SV_TessFactor;
|
||||
float inside : SV_InsideTessFactor;
|
||||
};
|
||||
|
||||
struct VertexControl
|
||||
{
|
||||
float4 positionOS : INTERNALTESSPOS;
|
||||
float4 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float4 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
|
||||
#ifdef LIGHTMAP_ON
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#endif
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
VertexControl VertexTessellation(Attributes input)
|
||||
{
|
||||
VertexControl output;
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
|
||||
output.positionOS = input.positionOS;
|
||||
output.normalOS = input.normalOS;
|
||||
output.tangentOS = input.tangentOS;
|
||||
output.uv.xy = input.uv.xy;
|
||||
output.uv.z = _TimeParameters.x;
|
||||
output.uv.w = 0;
|
||||
output.color = input.color;
|
||||
|
||||
#ifdef LIGHTMAP_ON
|
||||
output.staticLightmapUV = input.staticLightmapUV.xy * unity_LightmapST.xy + unity_LightmapST.zw;
|
||||
#endif
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float CalcDistanceTessFactor(float4 positionOS, float minDist, float maxDist, float tess)
|
||||
{
|
||||
float3 positionWS = TransformObjectToWorld(positionOS.xyz).xyz;
|
||||
float dist = distance(positionWS, GetCurrentViewPosition());
|
||||
|
||||
float f = (1.0-saturate((dist - minDist) / (maxDist - minDist)) + 0.001) * tess;
|
||||
|
||||
#if DYNAMIC_EFFECTS_ENABLED
|
||||
//Doesn't seem to work somehow
|
||||
//f += SampleDynamicEffectsDisplacement(positionWS.xyz) * tess;
|
||||
#endif
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
float4 CalcTriEdgeTessFactors (float3 triVertexFactors)
|
||||
{
|
||||
float4 tess;
|
||||
tess.x = 0.5 * (triVertexFactors.y + triVertexFactors.z);
|
||||
tess.y = 0.5 * (triVertexFactors.x + triVertexFactors.z);
|
||||
tess.z = 0.5 * (triVertexFactors.x + triVertexFactors.y);
|
||||
tess.w = (triVertexFactors.x + triVertexFactors.y + triVertexFactors.z) / 3.0f;
|
||||
return tess;
|
||||
}
|
||||
|
||||
float4 DistanceBasedTess(float4 v0, float4 v1, float4 v2, float tess, float minDist, float maxDist)
|
||||
{
|
||||
float3 f;
|
||||
f.x = CalcDistanceTessFactor(v0, minDist, maxDist, tess);
|
||||
f.y = CalcDistanceTessFactor(v1, minDist, maxDist, tess);
|
||||
f.z = CalcDistanceTessFactor(v2, minDist, maxDist, tess);
|
||||
|
||||
//Don't use the Core RP version, creates cracks on edges
|
||||
return CalcTriEdgeTessFactors(f);
|
||||
}
|
||||
|
||||
TessellationFactors HullConstant(InputPatch<VertexControl, 3> patch)
|
||||
{
|
||||
TessellationFactors output;
|
||||
|
||||
float4 tf = DistanceBasedTess(patch[0].positionOS, patch[1].positionOS, patch[2].positionOS, _TessValue, _TessMin, _TessMax);
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(patch[0]);
|
||||
|
||||
output.edge[0] = tf.x;
|
||||
output.edge[1] = tf.y;
|
||||
output.edge[2] = tf.z;
|
||||
output.inside = tf.w;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
[maxtessfactor(MAX_TESSELLATION_FACTORS)]
|
||||
[domain("tri")]
|
||||
[partitioning("fractional_odd")]
|
||||
[outputtopology("triangle_cw")]
|
||||
[patchconstantfunc("HullConstant")]
|
||||
[outputcontrolpoints(3)]
|
||||
VertexControl Hull(InputPatch<VertexControl, 3> input, uint id : SV_OutputControlPointID)
|
||||
{
|
||||
return input[id];
|
||||
}
|
||||
|
||||
#define TESSELLATION_INTERPOLATE_BARY_URP(name, bary) output.name = input[0].name * bary.x + input[1].name * bary.y + input[2].name * bary.z
|
||||
|
||||
[domain("tri")]
|
||||
Varyings Domain(TessellationFactors factors, OutputPatch<VertexControl, 3> input, float3 baryCoords : SV_DomainLocation)
|
||||
{
|
||||
Attributes output = (Attributes)0;
|
||||
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(positionOS, baryCoords);
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(uv, baryCoords);
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(normalOS, baryCoords);
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(tangentOS, baryCoords);
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(color, baryCoords);
|
||||
|
||||
#if defined(LIGHTMAP_ON)
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(staticLightmapUV, baryCoords);
|
||||
#endif
|
||||
#if defined(DYNAMICLIGHTMAP_ON)
|
||||
TESSELLATION_INTERPOLATE_BARY_URP(dynamicLightmapUV, baryCoords);
|
||||
#endif
|
||||
|
||||
//Tessellation does not work entirely correct with GPU instancing
|
||||
UNITY_TRANSFER_INSTANCE_ID(input[0], output);
|
||||
|
||||
return LitPassVertex(output);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed4a75978e3fdcd4b90ca0ef549ad541
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Tesselation.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,31 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef PIPELINE_INCLUDED
|
||||
#define PIPELINE_INCLUDED
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl"
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
|
||||
|
||||
#ifndef _DISABLE_DEPTH_TEX
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#endif
|
||||
|
||||
#if _REFRACTION
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareOpaqueTexture.hlsl"
|
||||
#endif
|
||||
|
||||
// Deprecated in URP 11+ https://github.com/Unity-Technologies/Graphics/pull/2529. Keep function for backwards compatibility
|
||||
// Compute Normalized Device Coordinate here (this is normally done in GetVertexPositionInputs, but clip and world-space coords are done manually already)
|
||||
#if UNITY_VERSION >= 202110 && !defined(UNITY_SHADER_VARIABLES_FUNCTIONS_DEPRECATED_INCLUDED)
|
||||
float4 ComputeScreenPos(float4 positionCS)
|
||||
{
|
||||
return ComputeNormalizedDeviceCoordinates(positionCS);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19aa2a2f5f8eea540b3c3574d7dfe2d0
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/URP.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,185 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float4 normalOS : NORMAL;
|
||||
float4 tangentOS : TANGENT;
|
||||
float4 color : COLOR0;
|
||||
float2 staticLightmapUV : TEXCOORD1;
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD2;
|
||||
#endif
|
||||
|
||||
#if _FLOWMAP
|
||||
float2 uv2 : TEXCOORD2;
|
||||
#endif
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 uv : TEXCOORD0;
|
||||
|
||||
half4 fogFactorAndVertexLight : TEXCOORD1; // x: fogFactor, yzw: vertex light
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) //No shadow cascades
|
||||
float4 shadowCoord : TEXCOORD2;
|
||||
#endif
|
||||
|
||||
//wPos.x in w-component
|
||||
float4 normalWS : NORMAL;
|
||||
#if REQUIRES_TANGENT_TO_WORLD
|
||||
//wPos.y in w-component
|
||||
float4 tangent : TANGENT;
|
||||
//wPos.z in w-component
|
||||
float4 bitangent : TEXCOORD3;
|
||||
#else
|
||||
float3 positionWS : TEXCOORD3;
|
||||
#endif
|
||||
|
||||
float4 screenPos : TEXCOORD4;
|
||||
|
||||
DECLARE_LIGHTMAP_OR_SH(staticLightmapUV, vertexSH, 5);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
float2 dynamicLightmapUV : TEXCOORD6; // Dynamic lightmap UVs
|
||||
#endif
|
||||
|
||||
#if _FLOWMAP
|
||||
float2 uv2 : TEXCOORD7;
|
||||
#endif
|
||||
|
||||
#ifdef USE_APV_PROBE_OCCLUSION
|
||||
float4 probeOcclusion : TEXCOORD10;
|
||||
#endif
|
||||
|
||||
float4 positionCS : SV_POSITION;
|
||||
float4 color : COLOR0;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings LitPassVertex(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
#if defined(CURVEDWORLD_NORMAL_TRANSFORMATION_ON)
|
||||
CURVEDWORLD_TRANSFORM_VERTEX_AND_NORMAL(input.positionOS, input.normalOS.xyz, input.tangentOS)
|
||||
#else
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(input.positionOS)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
output.uv.xy = input.uv.xy;
|
||||
output.uv.z = _TimeParameters.x;
|
||||
output.uv.w = 0;
|
||||
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
float3 offset = 0;
|
||||
|
||||
VertexNormalInputs normalInput = GetVertexNormalInputs(input.normalOS.xyz, input.tangentOS);
|
||||
|
||||
if(_WorldSpaceUV > 0)
|
||||
{
|
||||
//Tangents are to be in world-space as well. Otherwise the rotation of the water plane also rotates the tangents
|
||||
normalInput.tangentWS = real3(1.0, 0.0, 0.0);
|
||||
normalInput.bitangentWS = real3(0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
float4 vertexColor = GetVertexColor(input.color.rgba, float4(_IntersectionSource > 0 ? 1 : 0, _FogSource > 1 ? 0 : 1, _VertexColorWaveFlattening, _VertexColorFoam));
|
||||
|
||||
#if !defined(SHADERPASS_HEIGHT) || (defined(SHADERPASS_HEIGHT) && defined(DISPLACEMENT_BUFFER_PER_VERTEX))//Displacement will be calculated per pixel
|
||||
#if _WAVES
|
||||
float2 uv = GetSourceUV(input.uv.xy, positionWS.xz, _WorldSpaceUV);
|
||||
|
||||
float3 waveOffset = float3(0,0,0);
|
||||
float3 waveNormal = float3(0,1,0);
|
||||
|
||||
CalculateWaves(_WaveProfile, _WaveProfile_TexelSize.z, _WaveMaxLayers, uv.xy, _WaveFrequency, positionWS.xyz, _Direction.xy, normalInput.normalWS, (TIME_VERTEX * _Speed) * _WaveSpeed, vertexColor.b, float3(_WaveSteepness, _WaveHeight, _WaveSteepness),
|
||||
_WaveNormalStr, _WaveFadeDistance.x, _WaveFadeDistance.y,
|
||||
//Out
|
||||
waveOffset, waveNormal);
|
||||
|
||||
#if _RIVER
|
||||
//Zero out any vertical offsets and mask the values with the upward normal
|
||||
waveOffset.xyz = waveOffset.yyy;
|
||||
waveOffset.xyz *= normalInput.normalWS;
|
||||
#endif
|
||||
|
||||
offset.xyz += waveOffset.xyz;
|
||||
|
||||
//normalInput.tangentWS = waveNormal;
|
||||
#endif
|
||||
|
||||
//SampleWaveSimulationVertex(positionWS, positionWS.y);
|
||||
|
||||
#if DYNAMIC_EFFECTS_ENABLED
|
||||
if(_ReceiveDynamicEffectsHeight)
|
||||
{
|
||||
float4 effectsData = SampleDynamicEffectsData(positionWS.xyz + offset.xyz);
|
||||
|
||||
half falloff = 1.0;
|
||||
#if defined(TESSELLATION_ON)
|
||||
//falloff = saturate(1.0 - (distance(positionWS.xyz, GetCameraPositionWS() - _TessMin)) / (_TessMax - _TessMin));
|
||||
#endif
|
||||
|
||||
offset.y += effectsData[DE_HEIGHT_CHANNEL] * falloff;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Apply vertex displacements
|
||||
positionWS += offset;
|
||||
|
||||
output.positionCS = TransformWorldToHClip(positionWS);
|
||||
half fogFactor = InitializeInputDataFog(float4(positionWS, 1.0), output.positionCS.z);
|
||||
|
||||
output.screenPos = ComputeScreenPos(output.positionCS);
|
||||
|
||||
output.normalWS = float4(normalInput.normalWS, positionWS.x);
|
||||
#if REQUIRES_TANGENT_TO_WORLD
|
||||
output.tangent = float4(normalInput.tangentWS, positionWS.y);
|
||||
output.bitangent = float4(normalInput.bitangentWS, positionWS.z);
|
||||
#else
|
||||
output.positionWS = positionWS.xyz;
|
||||
#endif
|
||||
|
||||
//Lambert shading
|
||||
half3 vertexLight = 0;
|
||||
#ifdef _ADDITIONAL_LIGHTS_VERTEX
|
||||
vertexLight = VertexLighting(positionWS, normalInput.normalWS);
|
||||
#endif
|
||||
|
||||
output.fogFactorAndVertexLight = half4(fogFactor, vertexLight);
|
||||
output.color = vertexColor;
|
||||
|
||||
OUTPUT_LIGHTMAP_UV(input.staticLightmapUV, unity_LightmapST, output.staticLightmapUV);
|
||||
#ifdef DYNAMICLIGHTMAP_ON
|
||||
output.dynamicLightmapUV = input.dynamicLightmapUV.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
|
||||
#endif
|
||||
|
||||
OUTPUT_SH4(positionWS, output.normalWS.xyz, GetWorldSpaceNormalizeViewDir(positionWS), output.vertexSH, output.probeOcclusion);
|
||||
|
||||
#if _FLOWMAP
|
||||
output.uv2 = input.uv2;
|
||||
#endif
|
||||
|
||||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
|
||||
VertexPositionInputs vertexInput = (VertexPositionInputs)0;
|
||||
vertexInput.positionWS = positionWS;
|
||||
vertexInput.positionCS = output.positionCS;
|
||||
output.shadowCoord = GetShadowCoord(vertexInput);
|
||||
#endif
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93ab439cdc704a34d97fc4d18c37a8aa
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Vertex.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,58 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#ifndef WATER_WAVES_INCLUDED
|
||||
#define WATER_WAVES_INCLUDED
|
||||
|
||||
#include "Gerstner.hlsl"
|
||||
TEXTURE2D(_WaveProfile);
|
||||
|
||||
void CalculateWaves(in Texture2D<float4> lutTex, in uint layerCount, in uint maxCount, float2 uv, float frequency, float3 positionWS, float2 baseDir, float3 normalWS, float time, float mask, float3 scale,
|
||||
in float normalStrength, float fadeStart, float fadeEnd, out float3 waveOffset, out float3 waveNormalWS)
|
||||
{
|
||||
waveOffset = float3(0,0,0);
|
||||
float3 waveTangent = float3(1,0,0);
|
||||
float3 waveBiTangent = float3(0,0,1);
|
||||
|
||||
float2 waveDir = baseDir;
|
||||
|
||||
#if _RIVER
|
||||
waveDir.x = 1;
|
||||
waveDir.y = -1;
|
||||
#endif
|
||||
|
||||
CalculateGerstnerWaves_float(lutTex, layerCount, uv, frequency, time, normalStrength, waveDir, maxCount,
|
||||
//Out
|
||||
waveOffset, waveTangent, waveBiTangent);
|
||||
|
||||
waveNormalWS = cross(waveBiTangent, waveTangent);
|
||||
|
||||
//waveNormal = float3(0,0,1);
|
||||
//Tangent- to world-space
|
||||
//half3x3 waveTangentToWorldMatrix = half3x3(waveTangent, waveBiTangent, normal);
|
||||
//waveNormalWS = TransformTangentToWorld(waveNormalWS, waveTangentToWorldMatrix);
|
||||
|
||||
//Flatten by blue vertex color weight
|
||||
float waveMask = lerp(1.0, 0.0, mask);
|
||||
|
||||
//Distance based scalar
|
||||
float fadeFactor = DistanceFadeMask(positionWS, fadeStart, fadeEnd, 1.0);
|
||||
|
||||
waveMask *= fadeFactor;
|
||||
waveMask = saturate(max(0.0001, waveMask));
|
||||
//return float4(waveMask.xxx, 1.0);
|
||||
|
||||
//Scaling
|
||||
waveOffset.y *= scale.y * waveMask;
|
||||
waveOffset.xz *= scale.xz * waveMask;
|
||||
|
||||
//Fading
|
||||
waveNormalWS = lerp(normalWS, waveNormalWS, waveMask * scale.y);
|
||||
waveNormalWS = normalize(waveNormalWS);
|
||||
|
||||
//water.offset.xyz += waveOffset;
|
||||
//water.waveNormal = waveNormalWS;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af0851f7b3122dd4da9461dc75f659e9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Libraries/Waves.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e28a2c3dbab45808c1ed3f5b9309f6d
|
||||
timeCreated: 1718705128
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82e93b09a1224254f9bbb9e6bd497b58
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Passes/ForwardPass.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,98 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "../Libraries/Common.hlsl"
|
||||
#include "../Libraries/Waves.hlsl"
|
||||
#include "../Libraries/Projection.hlsl"
|
||||
#include "../Libraries/Height.hlsl"
|
||||
|
||||
struct HeightPassAttributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float4 uv : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct HeightPassVaryings
|
||||
{
|
||||
float4 positionWS : TEXCOORD0;
|
||||
//XYZ: World Position
|
||||
//W: Displacement offset
|
||||
float4 positionCS : SV_POSITION;
|
||||
float4 uv : TEXCOORD1; //Needs to be defined for Common.hlsl
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
HeightPassVaryings HeightPassVertex(HeightPassAttributes input)
|
||||
{
|
||||
HeightPassVaryings output = (HeightPassVaryings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(input.positionOS)
|
||||
#endif
|
||||
|
||||
float3 positionWS = TransformObjectToWorld(input.positionOS.xyz);
|
||||
float3 offset = 0;
|
||||
|
||||
output.uv = float4(input.uv.xy, _TimeParameters.x, 0);
|
||||
|
||||
#if _WAVES
|
||||
float2 uv = GetSourceUV(input.uv.xy, positionWS.xz, _WorldSpaceUV);
|
||||
|
||||
float3 waveOffset = float3(0,0,0);
|
||||
float3 waveNormal = float3(0,1,0);
|
||||
|
||||
CalculateWaves(_WaveProfile, _WaveProfile_TexelSize.z, _WaveMaxLayers, uv.xy, _WaveFrequency, positionWS.xyz, _Direction.xy, float3(0,1,0), (TIME_VERTEX * _Speed) * _WaveSpeed, input.color.b * _VertexColorWaveFlattening, float3(_WaveSteepness, _WaveHeight, _WaveSteepness),
|
||||
_WaveNormalStr, _WaveFadeDistance.x, _WaveFadeDistance.y,
|
||||
//Out
|
||||
waveOffset, waveNormal);
|
||||
|
||||
offset.xyz += waveOffset.xyz;
|
||||
#endif
|
||||
|
||||
#if DYNAMIC_EFFECTS_ENABLED
|
||||
if(_ReceiveDynamicEffectsHeight)
|
||||
{
|
||||
float4 effectsData = SampleDynamicEffectsData(positionWS.xyz);
|
||||
|
||||
half falloff = 1.0;
|
||||
#if defined(TESSELLATION_ON)
|
||||
//falloff = saturate(1.0 - (distance(positionWS.xyz, GetCurrentViewPosition() - _TessMin)) / (_TessMax - _TessMin));
|
||||
#endif
|
||||
|
||||
offset.y += effectsData[DE_HEIGHT_CHANNEL] * falloff;
|
||||
}
|
||||
#endif
|
||||
|
||||
output.positionCS = TransformWorldToHClip(positionWS);
|
||||
output.positionWS.xyz = positionWS.xyz;
|
||||
output.positionWS.w = offset.y;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 HeightFragment(HeightPassVaryings input) : SV_TARGET
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float3 positionWS = input.positionWS.xyz;
|
||||
float height = input.positionWS.w;
|
||||
|
||||
//float projectionEdgeMask = ProjectionEdgeMask(positionWS, _WaterHeightCoords.xy, _WaterHeightCoords.z, 15);
|
||||
|
||||
//positionWS.y = lerp(VOID_THRESHOLD, positionWS.y, projectionEdgeMask);
|
||||
|
||||
return float4(positionWS.y, height, 0.0, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9417554152a5431cbb22f67dfea63312
|
||||
timeCreated: 1718705139
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Passes/HeightPrePass.hlsl
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a0c3077859e4304ad84eb1a25e8c36b
|
||||
timeCreated: 1718458025
|
||||
@@ -0,0 +1,128 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
Shader "Hidden/StylizedWater3/HeightProcessor"
|
||||
{
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
|
||||
HLSLINCLUDE
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Height To Normal"
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment frag
|
||||
|
||||
float4 _HeightToNormalParams;
|
||||
//X: Strength
|
||||
//Y: Channel
|
||||
//Z: Miplevel
|
||||
|
||||
float4 frag (Varyings input) : SV_Target
|
||||
{
|
||||
float2 uv = input.texcoord;
|
||||
float radius = _BlitTexture_TexelSize.x; //1f/width
|
||||
|
||||
float strength = _HeightToNormalParams.x * 2.0;
|
||||
int channel = _HeightToNormalParams.y;
|
||||
uint mip = _HeightToNormalParams.z;
|
||||
|
||||
if(uv.x >= (1-radius) || uv.y >= (1-radius)
|
||||
|| uv.x <= (radius) || uv.y <= (radius)
|
||||
) return float4(1,1,1,1);
|
||||
|
||||
const float xLeft = (SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearClamp, float2(uv.xy - float2(radius, 0.0)), mip)[channel]) * strength;
|
||||
const float xRight = (SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearClamp, float2(uv.xy + float2(radius, 0.0)), mip)[channel]) * strength;
|
||||
|
||||
const float yUp = (SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearClamp, float2(uv.xy - float2(0.0, radius)), mip)[channel]) * strength;
|
||||
const float yDown = (SAMPLE_TEXTURE2D_X_LOD(_BlitTexture, sampler_LinearClamp, float2(uv.xy + float2(0.0, radius)), mip)[channel]) * strength;
|
||||
|
||||
float xDelta = ((xLeft - xRight) + 1.0) * 0.5f;
|
||||
float yDelta = ((yUp - yDown) + 1.0) * 0.5f;
|
||||
|
||||
float4 normals = float4(xDelta, yDelta, 0.0, 0);
|
||||
|
||||
return normals;
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Terrain Intersection Mask"
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma vertex Vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "../Libraries/Height.hlsl"
|
||||
#include "../Libraries/Terrain.hlsl"
|
||||
|
||||
float _TerrainIntersectionMaskOffset;
|
||||
|
||||
float4 frag (Varyings input) : SV_Target
|
||||
{
|
||||
float2 uv = input.texcoord;
|
||||
|
||||
//Snap texels to terrain height buffer grid to avoid texel swimming
|
||||
float cellSize = 2;
|
||||
|
||||
//uv = floor(uv / cellSize) * cellSize;
|
||||
float3 positionWS = float3(
|
||||
_TerrainHeightRenderCoords.x + (uv.x * _TerrainHeightRenderCoords.z),
|
||||
0,
|
||||
_TerrainHeightRenderCoords.y + (uv.y * _TerrainHeightRenderCoords.z));
|
||||
|
||||
|
||||
float3 terrainHeightSamplePos = positionWS;
|
||||
terrainHeightSamplePos.x = floor(positionWS.x / cellSize) * cellSize;
|
||||
terrainHeightSamplePos.z = floor(positionWS.z / cellSize) * cellSize;
|
||||
terrainHeightSamplePos = floor(positionWS / cellSize) * (cellSize) + (cellSize * 0.5f);
|
||||
|
||||
/*
|
||||
int resolution = 256.0f;
|
||||
float3 origin = float3(_TerrainHeightRenderCoords.x, 0, _TerrainHeightRenderCoords.y);
|
||||
origin = origin * resolution / 2.0f;
|
||||
float3 roundedOrigin = round(origin);
|
||||
float3 roundOffset = roundedOrigin - origin;
|
||||
|
||||
//Need to fix the pixel swimming. SDF mask renders at a lower resolution than the terrain height prepass
|
||||
roundOffset = roundOffset * 2.0f / resolution;
|
||||
positionWS += roundOffset;
|
||||
*/
|
||||
|
||||
float2 waterHeights = SampleWaterHeight(positionWS);
|
||||
float waterHeight = waterHeights.x;
|
||||
|
||||
//Factor in displacement effects?
|
||||
//waterHeight += waterHeights.g;
|
||||
|
||||
if(HasHitWaterSurface(waterHeight) == false) return 0;
|
||||
|
||||
//TODO: Implement padding to shift the SDF inwards a bit
|
||||
waterHeight += _TerrainIntersectionMaskOffset;
|
||||
|
||||
const float terrainHeight = SampleTerrainHeight(terrainHeightSamplePos);
|
||||
|
||||
float delta = waterHeight - terrainHeight;
|
||||
|
||||
//Soft
|
||||
//float mask = 1-saturate(delta * 32);
|
||||
//Boolean
|
||||
float mask = waterHeight < terrainHeight ? 1 : 0;
|
||||
|
||||
return float4(mask, 0.0, 0.0, 1.0);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1cfcf2c2c8140c084fb10845093540e
|
||||
timeCreated: 1718458047
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Rendering/HeightProcessor.shader
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,97 @@
|
||||
Shader "Hidden/StylizedWater3/TerrainHeight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[MainTexture] _BaseMap("Texture", 2D) = "black" {}
|
||||
[MainColor] _BaseColor("Color", Color) = (1, 1, 1, 1)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Opaque"
|
||||
"IgnoreProjector" = "True"
|
||||
"UniversalMaterialType" = "Unlit"
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
LOD 100
|
||||
|
||||
ZWrite Off
|
||||
Cull Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Output terrain height"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma target 2.0
|
||||
|
||||
#pragma vertex UnlitPassVertex
|
||||
#pragma fragment UnlitPassFragment
|
||||
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.universal/Shaders/UnlitInput.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" //UnpackHeightmap
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" //UnpackHeightmap
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 positionCS : SV_POSITION;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
Varyings UnlitPassVertex(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
output.uv = input.uv;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
TEXTURE2D_FLOAT(_TerrainHeightmap);
|
||||
float4 _TerrainHeightRange;
|
||||
//X: Bottom y-position
|
||||
//Y: Max height (heightmap scale)
|
||||
|
||||
void UnlitPassFragment(Varyings input, out half4 outColor : SV_Target0)
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
half2 uv = input.uv;
|
||||
|
||||
float scale = (_TerrainHeightRange.y);
|
||||
float heightMap = UnpackHeightmap(SAMPLE_TEXTURE2D(_TerrainHeightmap, sampler_LinearRepeat, uv).r);
|
||||
heightMap *= scale * 1;
|
||||
|
||||
float worldHeight = (_TerrainHeightRange.x + heightMap);
|
||||
|
||||
//worldHeight = PackHeightmap(worldHeight);
|
||||
|
||||
outColor = float4(worldHeight.xxx, 1.0);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
|
||||
FallBack "Hidden/Universal Render Pipeline/FallbackError"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 457f526f44254ef78348e3d0b1cc07ec
|
||||
timeCreated: 1718291858
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Rendering/TerrainHeight.shader
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,514 @@
|
||||
// Stylized Water 3 by Staggart Creations (http://staggart.xyz)
|
||||
// COPYRIGHT PROTECTED UNDER THE UNITY ASSET STORE EULA (https://unity.com/legal/as-terms)
|
||||
// • Copying or referencing source code for the production of new asset store, or public, content is strictly prohibited!
|
||||
// • Uploading this file to a public repository will subject it to an automated DMCA takedown request.
|
||||
|
||||
%asset_version%
|
||||
%unity_version%
|
||||
%compiler_version%
|
||||
|
||||
%shader_name%
|
||||
{
|
||||
Properties
|
||||
{
|
||||
//Rendering
|
||||
[Toggle] _ZWrite("Depth writing", Float) = 0
|
||||
[Toggle] _ZClip("Camera frustum clipping", Float) = 1
|
||||
[Enum(Both,0,Back,1,Front,2)] _Cull("Render faces", Float) = 2
|
||||
[MaterialEnum(Performance, 0,Appearance, 1)] _ShadingMode("Shading mode", Float) = 1
|
||||
|
||||
[MaterialEnum(Mesh UV,0,World XZ projected ,1)]_WorldSpaceUV("UV Coordinates", Float) = 1
|
||||
_Direction("Animation direction", Vector) = (0,-1,0,0)
|
||||
_Speed("Animation Speed", Float) = 1
|
||||
|
||||
_SlopeAngleThreshold("Angle° threshold", Range(0 , 90)) = 15
|
||||
_SlopeAngleFalloff("Angle° falloff", Range(15 , 90)) = 25
|
||||
_SlopeStretching("Slope UV stretch", Range(0 , 1)) = 0.5
|
||||
_SlopeSpeed("Slope speed multiplier", Float) = 2
|
||||
_SlopeFoam("River slope foam", Range(0 , 3)) = 1
|
||||
|
||||
//Color + Transparency
|
||||
[HDR]_BaseColor("Deep", Color) = (0, 0.44, 0.62, 1)
|
||||
[HDR]_ShallowColor("Shallow", Color) = (0.1, 0.9, 0.89, 0.02)
|
||||
[PowerSlider(3)] _ColorAbsorption("Color Absorption", Range(0 , 1)) = 0
|
||||
_WaveTint("Wave tint", Range( -0.1 , 0.1)) = 0
|
||||
[HDR]_HorizonColor("Horizon", Color) = (0.84, 1, 1, 0.15)
|
||||
_HorizonDistance("Horizon Distance", Range(0.01 , 32)) = 8
|
||||
[Toggle] _VertexColorTransparency("Vertex color (G) transparency", Float) = 0
|
||||
[MaterialEnum(Depth Texture,0,Vertex Color (G),1)] _FogSource("Fog source", Float) = 0
|
||||
_DepthVertical("View Depth", Range(0.01 , 16)) = 4
|
||||
_DepthHorizontal("Vertical Height Depth", Range(0.01 , 8)) = 1
|
||||
_EdgeFade("Edge Fade", Float) = 0.1
|
||||
_ShadowStrength("Shadow Strength", Range(0 , 1)) = 1
|
||||
|
||||
//_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.9
|
||||
//_Metallic("Metallic", Range(0.0, 1.0)) = 0.0
|
||||
|
||||
_TranslucencyStrength("Translucency Strength", Range(0 , 3)) = 1
|
||||
_TranslucencyStrengthDirect("Translucency Strength (Direct)", Range(0 , 0.5)) = 0.05
|
||||
_TranslucencyExp("Translucency Exponent", Range(1 , 32)) = 4
|
||||
_TranslucencyCurvatureMask("Translucency Curvature mask", Range(0, 1)) = 0.75
|
||||
_TranslucencyReflectionMask("Translucency Reflection mask", Range(0, 1)) = 1
|
||||
|
||||
//Underwater
|
||||
_CausticsBrightness("Brightness", Float) = 2
|
||||
_CausticsChromance("Chromance", Range(0, 1)) = 1
|
||||
_CausticsTiling("Tiling", Float) = 0.5
|
||||
_CausticsSpeed("Speed multiplier", Float) = 0.1
|
||||
_CausticsDistortion("Distortion", Range(0, 1)) = 0.15
|
||||
[NoScaleOffset][SingleLineTexture]_CausticsTex("Texture", 2D) = "black" {}
|
||||
[Toggle] _EnableDirectionalCaustics("Directional Caustics", Float) = 0
|
||||
|
||||
_UnderwaterSurfaceSmoothness("Underwater Surface Smoothness", Range(0, 1)) = 0.8
|
||||
_UnderwaterRefractionOffset("Underwater Refraction Offset", Range(-1, 1)) = 0.2
|
||||
_UnderwaterReflectionStrength("Underwater Reflection Strength", Range(0, 1)) = 0.5
|
||||
|
||||
_RefractionStrength("Refraction Strength", Range(0, 1)) = 0.1
|
||||
_RefractionChromaticAberration("Refraction Chromatic Aberration)", Range(0, 1)) = 1
|
||||
|
||||
//Intersection Foam
|
||||
[MaterialEnum(Depth Texture,0,Vertex Color (R),1,Depth Texture and Vertex Color,2)] _IntersectionSource("Intersection source", Float) = 0
|
||||
|
||||
[NoScaleOffset][SingleLineTexture]_IntersectionNoise("Intersection noise", 2D) = "white" {}
|
||||
_IntersectionColor("Color", Color) = (1,1,1,1)
|
||||
_IntersectionLength("Distance", Range(0.01 , 10)) = 3
|
||||
_IntersectionFalloff("Falloff", Range(0.01 , 1)) = 0.5
|
||||
[Toggle] _IntersectionSharp("Sharp", float) = 1
|
||||
_IntersectionClipping("Cutoff", Range(0.01, 1)) = 0.5
|
||||
_IntersectionTiling("Noise Tiling", float) = 0.2
|
||||
_IntersectionSpeed("Speed multiplier", float) = 0.1
|
||||
_IntersectionRippleDist("Ripple frequency", float) = 32
|
||||
_IntersectionRippleStrength("Ripple Strength", Range(0 , 1)) = 0.5
|
||||
_IntersectionRippleSpeed("Ripple Speed", float) = 2
|
||||
_IntersectionDistortion("Distortion", Range(0 , 1)) = 0.2
|
||||
|
||||
//Surface Foam
|
||||
[NoScaleOffset][SingleLineTexture]_FoamTex("Foam Mask", 2D) = "black" {}
|
||||
_FoamColor("Color", Color) = (1,1,1,1)
|
||||
_FoamSpeed("Speed multiplier", float) = 0.1
|
||||
_FoamSubSpeed("Speed multiplier (sub-layer)", float) = -0.25
|
||||
_FoamBaseAmount("Base amount", Range(0 , 1)) = 0
|
||||
_FoamClipping("Clipping", Range(0 , 0.999)) = 0
|
||||
_FoamStrength("Strength", float) = 1
|
||||
[MinMaxSlider(0, 3)]
|
||||
_FoamCrestMinMaxHeight("Wave crest min/max height", Vector) = (1, 2, 0, 0)
|
||||
[MinMaxSlider(10, 500)]
|
||||
_DistanceFoamFadeDist("Distance foam blend (Start/End)", Vector) = (100, 350, 0, 0)
|
||||
_DistanceFoamTiling("Distance foam: Tiling multiplier", Float) = 0.2
|
||||
|
||||
//[PowerSlider(0.1)] _FoamCrestExponent("Wave crest min/max height", Range(1, 8)) = 4
|
||||
_FoamBubblesSpread("Foam bubbles spread", Range(0, 2)) = 1
|
||||
_FoamBubblesStrength("Foam ubbles", Range(0, 1)) = 0.1
|
||||
|
||||
_FoamTiling("Tiling", Vector) = (0.1, 0.1, 0, 0)
|
||||
_FoamSubTiling("Tiling (sub-layer)", float) = 0.5
|
||||
_FoamDistortion("Distortion", Range(0, 3)) = 0
|
||||
[Toggle] _VertexColorFoam("Vertex color (A) foam", Float) = 0
|
||||
|
||||
[NoScaleOffset][SingleLineTexture] _FoamTexDynamic("Foam (Dynamic)", 2D) = "white" {}
|
||||
_FoamTilingDynamic("Tiling (Dynamic)", float) = 0.1
|
||||
_FoamSubTilingDynamic("Tiling (sub-layer)", float) = 2
|
||||
_FoamSpeedDynamic("Speed multiplier", float) = 0.1
|
||||
_FoamSubSpeedDynamic("Speed multiplier (sub-layer)", float) = -0.1
|
||||
_FoamClippingDynamic("SClipping", Range(0 , 0.999)) = 0
|
||||
|
||||
//Normals
|
||||
[NoScaleOffset][Normal][SingleLineTexture]_BumpMap("Normals", 2D) = "bump" {}
|
||||
[NoScaleOffset][Normal][SingleLineTexture]_BumpMapSlope("Normals (River slopes)", 2D) = "bump" {}
|
||||
_NormalTiling("Tiling", Vector) = (0.5, 0.5, 0, 0)
|
||||
_NormalSubTiling("Tiling (sub-layer)", Float) = 0.5
|
||||
_NormalStrength("Strength", Range(0 , 1)) = 0.135
|
||||
_NormalSpeed("Speed multiplier", Float) = 1
|
||||
_NormalSubSpeed("Speed multiplier (sub-layer)", Float) = -0.5
|
||||
|
||||
[NoScaleOffset][Normal][SingleLineTexture]_BumpMapLarge("Normals (Distance)", 2D) = "bump" {}
|
||||
_DistanceNormalsFadeDist("Distance normals blend (Start/End)", Vector) = (100, 300, 0, 0)
|
||||
_DistanceNormalsTiling("Distance normals: Tiling multiplier", Float) = 0.15
|
||||
|
||||
_SparkleIntensity("Sparkle Intensity", Range(0 , 10)) = 00
|
||||
_SparkleSize("Sparkle Size", Range( 0 , 1)) = 0.280
|
||||
|
||||
//Light Reflections
|
||||
[PowerSlider(0.1)] _SunReflectionSize("Sun Size", Range(0 , 1)) = 0.5
|
||||
_SunReflectionStrength("Sun Strength", Float) = 10
|
||||
_SunReflectionDistortion("Sun Distortion", Range(0 ,2)) = 0.49
|
||||
[Toggle] _SunReflectionSharp("Sun Sharpness", Float) = 0
|
||||
|
||||
_PointSpotLightReflectionStrength("Point/spot light strength", Float) = 10
|
||||
[PowerSlider(0.1)] _PointSpotLightReflectionSize("Point/spot light size", Range(0 , 1)) = 0
|
||||
_PointSpotLightReflectionDistortion("Point/spot light distortion", Range(0, 1)) = 0.5
|
||||
[Toggle] _PointSpotLightReflectionSharp("Point/spot light Sharp", Float) = 0
|
||||
|
||||
//World Reflections
|
||||
_ReflectionStrength("Strength", Range(0, 1)) = 1
|
||||
_ReflectionDistortion("Distortion", Range(0, 1)) = 0.05
|
||||
_ReflectionBlur("Probe Blur Factor", Range(0, 1)) = 0
|
||||
_ReflectionFresnel("Curvature mask", Range(0.01, 20)) = 5
|
||||
_ReflectionLighting("Lighting influence", Range(0, 1)) = 0
|
||||
_PlanarReflection("Planar Reflections", 2D) = "" {} //Instanced
|
||||
[Toggle] _ScreenSpaceReflectionsEnabled("Screen-space Reflections", float) = 0
|
||||
_PlanarReflectionsEnabled("Planar Enabled", float) = 0 //Instanced
|
||||
|
||||
//Waves
|
||||
[WaveProfile] _WaveProfile("Wave Profile", 2D) = "black" {}
|
||||
|
||||
_WaveSpeed("Speed", Float) = 2
|
||||
_WaveFrequency("Frequency", Float) = 1
|
||||
_WaveHeight("Height Scale", Range(0 , 2)) = 0.15
|
||||
[Toggle] _VertexColorWaveFlattening("Vertex color (B) wave flattening", Float) = 0
|
||||
|
||||
_WaveNormalStr("Normal Strength", Range(0 , 32)) = 0.1
|
||||
_WaveFadeDistance("Wave fade distance (Start/End)", Vector) = (150, 500, 0, 0)
|
||||
|
||||
_WaveSteepness("Steepness", Range(0 , 5)) = 0.1
|
||||
_WaveMaxLayers("Maximum Layers", Range(1 , 64)) = 64
|
||||
_WaveDirection("Direction", vector) = (1,1,1,1)
|
||||
|
||||
//Keyword states
|
||||
[ToggleOff(_UNLIT)] _LightingOn("Enable lighting", Float) = 1
|
||||
[ToggleOff(_RECEIVE_SHADOWS_OFF)] _ReceiveShadows("Recieve Shadows", Float) = 1
|
||||
|
||||
[Toggle(_FLAT_SHADING)] _FlatShadingOn("Flat shading", Float) = 0
|
||||
[Toggle(_TRANSLUCENCY)] _TranslucencyOn("Enable translucency shading", Float) = 1
|
||||
[Toggle(_REFRACTION)] _RefractionOn("Refraction", Float) = 1
|
||||
[Toggle(_RIVER)] _RiverModeOn("River Mode", Float) = 0
|
||||
[Toggle(_CAUSTICS)] _CausticsOn("Caustics ON", Float) = 1
|
||||
[ToggleOff(_SPECULARHIGHLIGHTS_OFF)] _SpecularReflectionsOn("Specular Reflections", Float) = 1
|
||||
[ToggleOff(_ENVIRONMENTREFLECTIONS_OFF)] _EnvironmentReflectionsOn("Environment Reflections", Float) = 1
|
||||
[Toggle(_NORMALMAP)] _NormalMapOn("Normal maps", Float) = 1
|
||||
[Toggle(_INTERSECTION_FOAM)] _IntersectionFoamOn("Enable intersection foam", float) = 1
|
||||
[Toggle(_DISTANCE_NORMALS)] _DistanceNormalsOn("Distance normal map", Float) = 0
|
||||
[Toggle] _FoamOn("Surface Foam", Float) = 1
|
||||
[Toggle] _FoamDistanceOn("Surface Foam Distance", Float) = 0
|
||||
[Toggle(_DISABLE_DEPTH_TEX)] _DisableDepthTexture("Disable depth texture", Float) = 0
|
||||
[Toggle(_WAVES)] _WavesOn("Waves", Float) = 0
|
||||
[Toggle] _ReceiveDynamicEffectsHeight("Receive Dynamic Effects Height", Float) = 1
|
||||
_ReceiveDynamicEffectsFoam("Receive Dynamic Effects Foam", Float) = 1
|
||||
[Toggle] _ReceiveDynamicEffectsNormal("Receive Dynamic Effects Normals", Float) = 1
|
||||
|
||||
%tessellation_properties%
|
||||
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0,5|1|1", Vector) = (0, 0, 0, 0)
|
||||
|
||||
//Purely here so the _BaseColor gets multiplied with a white color during lightmapping
|
||||
[MainTexture] [HideInInspector] _BaseMap("Albedo", 2D) = "white" {}
|
||||
|
||||
[HideInInspector][NoScaleOffset]unity_Lightmaps("unity_Lightmaps", 2DArray) = "" {}
|
||||
[HideInInspector][NoScaleOffset]unity_LightmapsInd("unity_LightmapsInd", 2DArray) = "" {}
|
||||
[HideInInspector][NoScaleOffset]unity_ShadowMasks("unity_ShadowMasks", 2DArray) = "" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Transparent"
|
||||
"RenderPipeline" = "UniversalPipeline"
|
||||
"UniversalMaterialType" = "Lit"
|
||||
"IgnoreProjector" = "True"
|
||||
"Queue" = "Transparent+%render_queue_offset%"
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
//Custom directives:
|
||||
%custom_directives%
|
||||
%global_defines%
|
||||
|
||||
//Curved World 2020 directives:
|
||||
//#pragma shader_feature_local CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE CURVEDWORLD_BEND_TYPE_LITTLEPLANET_Y
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#pragma shader_feature_local CURVEDWORLD_NORMAL_TRANSFORMATION_ON
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ForwardLit"
|
||||
Tags { "LightMode"="UniversalForwardOnly" }
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha, One OneMinusSrcAlpha
|
||||
ZWrite [_ZWrite]
|
||||
Cull [_Cull]
|
||||
ZTest LEqual
|
||||
ZClip [_ZClip]
|
||||
|
||||
Stencil { Ref %stencilID% Comp Always Pass Replace }
|
||||
|
||||
HLSLPROGRAM
|
||||
%pragma_target%
|
||||
%pragma_renderers%
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
||||
|
||||
#define _SURFACE_TYPE_TRANSPARENT 1
|
||||
#define SHADERPASS_FORWARD
|
||||
//#define _FLOWMAP 1
|
||||
%defines%
|
||||
|
||||
// Material Keywords
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local _WAVES
|
||||
#pragma shader_feature_local _RECEIVE_SHADOWS_OFF
|
||||
#pragma shader_feature_local _RIVER
|
||||
#pragma shader_feature_local _REFRACTION
|
||||
#pragma shader_feature_local_fragment _DISABLE_DEPTH_TEX
|
||||
#pragma shader_feature_local_fragment _ADVANCED_SHADING
|
||||
#pragma shader_feature_local_fragment _UNLIT
|
||||
#pragma shader_feature_local_fragment _CAUSTICS
|
||||
#pragma shader_feature_local_fragment _DISTANCE_NORMALS
|
||||
#pragma shader_feature_local_fragment _SURFACE_FOAM_SINGLE
|
||||
#pragma shader_feature_local_fragment _SURFACE_FOAM_DUAL
|
||||
#pragma shader_feature_local_fragment _TRANSLUCENCY
|
||||
#pragma shader_feature_local_fragment _SPECULARHIGHLIGHTS_OFF
|
||||
#pragma shader_feature_local_fragment _ENVIRONMENTREFLECTIONS_OFF
|
||||
#pragma shader_feature_local_fragment _INTERSECTION_FOAM
|
||||
#pragma shader_feature_local_fragment _FLAT_SHADING
|
||||
|
||||
//Multi-compile variants for installed extensions
|
||||
%multi_compile underwater rendering%
|
||||
%multi_compile dynamic effects%
|
||||
|
||||
#if UNDERWATER_ENABLED && _RIVER
|
||||
#undef UNDERWATER_ENABLED
|
||||
#define UNDERWATER_ENABLED 0
|
||||
#endif
|
||||
|
||||
#include_library "Libraries/URP.hlsl"
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
|
||||
#if _SURFACE_FOAM_SINGLE || _SURFACE_FOAM_DUAL
|
||||
#define _SURFACE_FOAM 1
|
||||
#endif
|
||||
|
||||
//Tying specific features and operations to advanced shading
|
||||
#if _ADVANCED_SHADING
|
||||
#define RESAMPLE_REFRACTION_DEPTH 1
|
||||
#define PHYSICAL_REFRACTION 1
|
||||
#if _CAUSTICS
|
||||
#define RECONSTRUCT_WORLD_NORMAL
|
||||
#endif
|
||||
//#define HQ_CAUSTICS 1
|
||||
|
||||
#if _REFRACTION //Requires opaque texture
|
||||
#define COLOR_ABSORPTION 1
|
||||
#endif
|
||||
|
||||
//Mask caustics by shadows cast on scene geometry. Doubles the shadow sampling cost
|
||||
//Note: needs depth texture to reconstruct the world position from depth
|
||||
#if _CAUSTICS && defined(MAIN_LIGHT_CALCULATE_SHADOWS) && !_DISABLE_DEPTH_TEX
|
||||
#define SCENE_SHADOWMASK 1
|
||||
#endif
|
||||
|
||||
#if !_DISABLE_DEPTH_TEX && _CAUSTICS || UNDERWATER_ENABLED
|
||||
//Compose a mask for pixels against the skybox
|
||||
#define DEPTH_MASK 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if _NORMALMAP || _WAVES
|
||||
#define REQUIRES_TANGENT_TO_WORLD 1
|
||||
#endif
|
||||
|
||||
//Universal Pipeline keywords
|
||||
%multi_compile_light_cookies%
|
||||
|
||||
#pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE _MAIN_LIGHT_SHADOWS_SCREEN
|
||||
#pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT
|
||||
#pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS //URP 11+
|
||||
|
||||
//URP 12+ only (2021.2+)
|
||||
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING
|
||||
#pragma multi_compile_fragment _ _REFLECTION_PROBE_BOX_PROJECTION
|
||||
#pragma multi_compile_fragment _ DEBUG_DISPLAY
|
||||
#pragma multi_compile _ _LIGHT_LAYERS
|
||||
|
||||
//Unity 6.0
|
||||
#if (UNITY_VERSION >= 60000023) && (UNITY_VERSION < 60010000)
|
||||
#pragma multi_compile _ _CLUSTERED_RENDERING
|
||||
#pragma multi_compile _ _FORWARD_PLUS
|
||||
#endif
|
||||
|
||||
//Unity 6.1+
|
||||
#if (UNITY_VERSION >= 60010000)
|
||||
#pragma multi_compile _ _CLUSTER_LIGHT_LOOP
|
||||
#pragma multi_compile_fragment _ _REFLECTION_PROBE_ATLAS
|
||||
#endif
|
||||
|
||||
//URP 15+ (2023.1+)
|
||||
#pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX
|
||||
|
||||
//Unity defined keywords
|
||||
#pragma multi_compile _ LIGHTMAP_SHADOW_MIXING
|
||||
#pragma multi_compile _ SHADOWS_SHADOWMASK
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DYNAMICLIGHTMAP_ON
|
||||
#pragma multi_compile _ USE_LEGACY_LIGHTMAPS
|
||||
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl"
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
|
||||
|
||||
%tessellation_directives%
|
||||
|
||||
#include_library "Libraries/Input.hlsl"
|
||||
#include_library "Libraries/Common.hlsl"
|
||||
|
||||
//Fog rendering (integration)
|
||||
%define_fog_integration%
|
||||
%include_fog_integration_library%
|
||||
|
||||
#include_library "Libraries/Fog.hlsl"
|
||||
#include_library "Libraries/Terrain.hlsl"
|
||||
|
||||
#include_library "Libraries/Waves.hlsl"
|
||||
//Not needed, but registers it as a dependency
|
||||
#include_library "Libraries/Gerstner.hlsl"
|
||||
#include_library "Libraries/Lighting.hlsl"
|
||||
#include_library "Libraries/Reflections.hlsl"
|
||||
#include_library "Libraries/Refraction.hlsl"
|
||||
|
||||
#ifdef DYNAMIC_EFFECTS_ENABLED
|
||||
#include_library "DynamicEffects/DynamicEffects.hlsl"
|
||||
#endif
|
||||
|
||||
#ifdef UNDERWATER_ENABLED
|
||||
#include_library "Underwater/UnderwaterFog.hlsl"
|
||||
#include_library "Underwater/UnderwaterShading.hlsl"
|
||||
#include_library "Underwater/UnderwaterMask.hlsl"
|
||||
#include_library "Underwater/UnderwaterLighting.hlsl"
|
||||
#endif
|
||||
|
||||
#include_library "Libraries/Normals.hlsl"
|
||||
#include_library "Libraries/Foam.hlsl"
|
||||
#include_library "Libraries/Caustics.hlsl"
|
||||
|
||||
#include_library "Libraries/Vertex.hlsl"
|
||||
|
||||
#if defined(TESSELLATION_ON)
|
||||
#include_library "Libraries/Tesselation.hlsl"
|
||||
#define VertexOutput VertexControl
|
||||
#else
|
||||
#define VertexOutput Varyings
|
||||
#endif
|
||||
|
||||
#pragma vertex Vertex
|
||||
VertexOutput Vertex(Attributes v)
|
||||
{
|
||||
#if defined(TESSELLATION_ON)
|
||||
return VertexTessellation(v);
|
||||
#else
|
||||
return LitPassVertex(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
#pragma fragment ForwardPassFragment
|
||||
#include_library "Passes/ForwardPass.hlsl"
|
||||
|
||||
//#include "UnityCG.cginc" //Test
|
||||
#if defined(UNITY_SHADER_VARIABLES_INCLUDED) || defined(UNITY_CG_INCLUDED)
|
||||
#error "Fatal error: a shader library from the Built-in Render Pipeline was compiled into the shader. This is most likely caused by the fog integration, make absolutely sure it is URP-compatible!"
|
||||
#endif
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
//Currently not used, but may be used by custom transparency-depth passes
|
||||
Pass
|
||||
{
|
||||
Name "Depth"
|
||||
Tags { "LightMode" = "DepthOnly" }
|
||||
|
||||
ZWrite On
|
||||
//ColorMask R
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
%pragma_target%
|
||||
%pragma_renderers%
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
|
||||
#include_library "Libraries/URP.hlsl"
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
|
||||
#pragma shader_feature_local _WAVES
|
||||
|
||||
#define SHADERPASS_DEPTHONLY
|
||||
|
||||
#include_library "Libraries/Input.hlsl"
|
||||
#include_library "Libraries/Common.hlsl"
|
||||
#include_library "Libraries/Waves.hlsl"
|
||||
|
||||
%multi_compile dynamic effects%
|
||||
#ifdef DYNAMIC_EFFECTS_ENABLED
|
||||
#include_library "DynamicEffects/DynamicEffects.hlsl"
|
||||
#endif
|
||||
|
||||
#include_library "Passes/HeightPrePass.hlsl"
|
||||
|
||||
#pragma vertex HeightPassVertex
|
||||
|
||||
#pragma fragment DepthOnlyFragment
|
||||
float4 DepthOnlyFragment(HeightPassVaryings input) : SV_TARGET
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
return float4(input.positionCS.z, 0, 0, 1);
|
||||
}
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Height"
|
||||
Tags { "LightMode" = "WaterHeight" }
|
||||
|
||||
ZWrite On
|
||||
//ColorMask RG
|
||||
Cull Off
|
||||
|
||||
HLSLPROGRAM
|
||||
%pragma_target%
|
||||
%pragma_renderers%
|
||||
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
|
||||
#include_library "Libraries/URP.hlsl"
|
||||
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
|
||||
#pragma shader_feature_local _WAVES
|
||||
%multi_compile dynamic effects%
|
||||
#pragma multi_compile _ WATER_HEIGHT_PASS
|
||||
|
||||
//If set, the displacement effects are not calculated in the vertex shader, which would be a waste.
|
||||
#define SHADERPASS_HEIGHT
|
||||
|
||||
#include_library "Libraries/Input.hlsl"
|
||||
#include_library "Libraries/Common.hlsl"
|
||||
#include_library "Libraries/Waves.hlsl"
|
||||
#ifdef DYNAMIC_EFFECTS_ENABLED
|
||||
#include_library "DynamicEffects/DynamicEffects.hlsl"
|
||||
#endif
|
||||
|
||||
#pragma vertex HeightPassVertex
|
||||
#pragma fragment HeightFragment
|
||||
|
||||
#include_library "Passes/HeightPrePass.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
%passes%
|
||||
}
|
||||
|
||||
CustomEditor "StylizedWater3.MaterialUI"
|
||||
Fallback "Hidden/Universal Render Pipeline/FallbackError"
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 823f6b206953b674a9a64f9e3ec57752
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: fb104378e2fbf2942ae8b66abb7a1d57, type: 3}
|
||||
template: {instanceID: 0}
|
||||
settings:
|
||||
shaderName: Standard
|
||||
hidden: 0
|
||||
type: 0
|
||||
autoIntegration: 1
|
||||
fogIntegration: 1
|
||||
lightCookies: 0
|
||||
additionalLightCaustics: 1
|
||||
additionalLightTranslucency: 1
|
||||
singleCausticsLayer: 0
|
||||
customIncludeDirectives:
|
||||
- enabled: 1
|
||||
type: 0
|
||||
value: float _MyParameter;
|
||||
- enabled: 0
|
||||
type: 4
|
||||
value: QUAD_NORMAL_SAMPLES
|
||||
- enabled: 0
|
||||
type: 4
|
||||
value: PIXELIZE_UV
|
||||
- enabled: 0
|
||||
type: 4
|
||||
value: INTERSECTION_REFRACTION
|
||||
additionalPasses: []
|
||||
dependencies:
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Passes/Underwater/UnderwaterMaskPass.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/URP.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Input.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Common.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Fog.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Terrain.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Waves.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Gerstner.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Lighting.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Reflections.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Refraction.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/DynamicEffects/DynamicEffects.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Underwater/UnderwaterFog.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Underwater/UnderwaterShading.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Underwater/UnderwaterMask.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Underwater/UnderwaterLighting.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Normals.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Foam.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Caustics.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Vertex.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Libraries/Tesselation.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Passes/ForwardPass.hlsl
|
||||
- Packages/com.staggartcreations.stylizedwater3/Shaders/Passes/HeightPrePass.hlsl
|
||||
configurationState:
|
||||
underwaterRendering: 1
|
||||
dynamicEffects: 1
|
||||
fogIntegration:
|
||||
name: Default Unity
|
||||
asset: 1
|
||||
libraryGUID:
|
||||
url:
|
||||
underwaterCompatible: 1
|
||||
thumbnailBytes:
|
||||
thumbnail: {fileID: 7123690520299862052, guid: 0000000000000000d000000000000000,
|
||||
type: 0}
|
||||
installed: 1
|
||||
includeWithPragmas: 1
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/StylizedWater3_Standard.watershader3
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a97b5835e4f7ca742ad395297b5c3219
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+2104
File diff suppressed because it is too large
Load Diff
+17
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e59939267e932d743a974e7016b7a3fd
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/SubGraphs/Align Transform To Water.shadersubgraph
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,5 @@
|
||||
These sub-graphs require the Stylized Water 3 render feature to be active and the "Height Prepass" functionality enabled on it.
|
||||
|
||||
If so, the water geometry's height (including any displacement effects) are rendered into a buffer.
|
||||
|
||||
This allows other shaders to sample the water's height information this way. May be used for various effects
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7eca78e4fea00134695bf1c79a52d086
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/SubGraphs/Readme.txt
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,571 @@
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||
"m_ObjectId": "76d35e7e619d42e2aaafebc8ef6f3093",
|
||||
"m_Properties": [
|
||||
{
|
||||
"m_Id": "26abb75110b74b5788e84f3884bb5b9b"
|
||||
}
|
||||
],
|
||||
"m_Keywords": [],
|
||||
"m_Dropdowns": [],
|
||||
"m_CategoryData": [
|
||||
{
|
||||
"m_Id": "180fc64b34054e409bb3cb076f3c929a"
|
||||
}
|
||||
],
|
||||
"m_Nodes": [
|
||||
{
|
||||
"m_Id": "480dd4e30e674d20adf554f043aec179"
|
||||
},
|
||||
{
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
{
|
||||
"m_Id": "5169eb9d62a84eaf9cb37762b34fdaba"
|
||||
},
|
||||
{
|
||||
"m_Id": "946f01d678804a5596f01f9296b62387"
|
||||
}
|
||||
],
|
||||
"m_GroupDatas": [],
|
||||
"m_StickyNoteDatas": [
|
||||
{
|
||||
"m_Id": "22fe41e0edba44469681ff48f924d5b7"
|
||||
}
|
||||
],
|
||||
"m_Edges": [
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "5169eb9d62a84eaf9cb37762b34fdaba"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "946f01d678804a5596f01f9296b62387"
|
||||
},
|
||||
"m_SlotId": 2
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "480dd4e30e674d20adf554f043aec179"
|
||||
},
|
||||
"m_SlotId": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "480dd4e30e674d20adf554f043aec179"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "946f01d678804a5596f01f9296b62387"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
"m_SlotId": 2
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "480dd4e30e674d20adf554f043aec179"
|
||||
},
|
||||
"m_SlotId": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "e31739b3fc354a59b9d0f62f82928767"
|
||||
},
|
||||
"m_SlotId": 2
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "946f01d678804a5596f01f9296b62387"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"m_VertexContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"m_Blocks": []
|
||||
},
|
||||
"m_FragmentContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"m_Blocks": []
|
||||
},
|
||||
"m_PreviewData": {
|
||||
"serializedMesh": {
|
||||
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||
"m_Guid": ""
|
||||
},
|
||||
"preventRotation": false
|
||||
},
|
||||
"m_Path": "Sub Graphs",
|
||||
"m_GraphPrecision": 1,
|
||||
"m_PreviewMode": 2,
|
||||
"m_OutputNode": {
|
||||
"m_Id": "480dd4e30e674d20adf554f043aec179"
|
||||
},
|
||||
"m_SubDatas": [],
|
||||
"m_ActiveTargets": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
|
||||
"m_ObjectId": "180fc64b34054e409bb3cb076f3c929a",
|
||||
"m_Name": "",
|
||||
"m_ChildObjectList": [
|
||||
{
|
||||
"m_Id": "26abb75110b74b5788e84f3884bb5b9b"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
|
||||
"m_ObjectId": "1b94de1aea0c4ead8bd56879877ecce6",
|
||||
"m_Id": 2,
|
||||
"m_DisplayName": "Out",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Out",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.StickyNoteData",
|
||||
"m_ObjectId": "22fe41e0edba44469681ff48f924d5b7",
|
||||
"m_Title": "Usage note",
|
||||
"m_Content": "For this to return any data the Stylized Water 3 render feature must be active on the current renderer.\n\nAnd the \"Height Prepass\" option must be enabled.",
|
||||
"m_TextSize": 0,
|
||||
"m_Theme": 0,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -586.0,
|
||||
"y": -275.0,
|
||||
"width": 259.0,
|
||||
"height": 135.0
|
||||
},
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector3ShaderProperty",
|
||||
"m_ObjectId": "26abb75110b74b5788e84f3884bb5b9b",
|
||||
"m_Guid": {
|
||||
"m_GuidSerialized": "9edc1bf0-53e0-4109-84bc-f54bcd72a140"
|
||||
},
|
||||
"m_Name": "World Position",
|
||||
"m_DefaultRefNameVersion": 1,
|
||||
"m_RefNameGeneratedByDisplayName": "World Position",
|
||||
"m_DefaultReferenceName": "_World_Position",
|
||||
"m_OverrideReferenceName": "",
|
||||
"m_GeneratePropertyBlock": true,
|
||||
"m_UseCustomSlotLabel": false,
|
||||
"m_CustomSlotLabel": "",
|
||||
"m_DismissedVersion": 0,
|
||||
"m_Precision": 0,
|
||||
"overrideHLSLDeclaration": false,
|
||||
"hlslDeclarationOverride": 0,
|
||||
"m_Hidden": false,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "458cb2d5e1f04648898ab1a5b122e5a1",
|
||||
"m_Id": 2,
|
||||
"m_DisplayName": "displacement",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "displacement",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
|
||||
"m_ObjectId": "480dd4e30e674d20adf554f043aec179",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Output",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 4.0,
|
||||
"y": -133.0,
|
||||
"width": 144.0,
|
||||
"height": 125.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "f33f512079204c0e89eba50545cd41c8"
|
||||
},
|
||||
{
|
||||
"m_Id": "8a0e06128f264a14abacd34b1936548a"
|
||||
},
|
||||
{
|
||||
"m_Id": "e291f092c863417da659d700154c2ddd"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 1,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"IsFirstSlotValid": true
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||
"m_ObjectId": "5169eb9d62a84eaf9cb37762b34fdaba",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Property",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -755.0,
|
||||
"y": -90.0,
|
||||
"width": 152.0,
|
||||
"height": 34.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "7031ac0f15d6433193753c90272138f5"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_Property": {
|
||||
"m_Id": "26abb75110b74b5788e84f3884bb5b9b"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "52641796acf649749df15cc33341ec7b",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "geometryHeight",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "geometryHeight",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
|
||||
"m_ObjectId": "629abe611e774e0eb2976fd11a4867b2",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "B",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "B",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "635824bf074747859de54a01319623c7",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "positionWS",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "positionWS",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "7031ac0f15d6433193753c90272138f5",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "World Position",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Out",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "8a0e06128f264a14abacd34b1936548a",
|
||||
"m_Id": 2,
|
||||
"m_DisplayName": "Displacement",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Displacement",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.AddNode",
|
||||
"m_ObjectId": "946f01d678804a5596f01f9296b62387",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Add",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -246.0,
|
||||
"y": -39.0,
|
||||
"width": 126.0,
|
||||
"height": 118.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "adebfeeb94f042ddb7f9122331284c75"
|
||||
},
|
||||
{
|
||||
"m_Id": "629abe611e774e0eb2976fd11a4867b2"
|
||||
},
|
||||
{
|
||||
"m_Id": "1b94de1aea0c4ead8bd56879877ecce6"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"addition",
|
||||
"sum",
|
||||
"plus"
|
||||
],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": false,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
|
||||
"m_ObjectId": "adebfeeb94f042ddb7f9122331284c75",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "A",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "A",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "e291f092c863417da659d700154c2ddd",
|
||||
"m_Id": 3,
|
||||
"m_DisplayName": "Summed",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Summed",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
|
||||
"m_ObjectId": "e31739b3fc354a59b9d0f62f82928767",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SampleWaterHeight (Custom Function)",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -591.0,
|
||||
"y": -133.0,
|
||||
"width": 267.0,
|
||||
"height": 118.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "635824bf074747859de54a01319623c7"
|
||||
},
|
||||
{
|
||||
"m_Id": "52641796acf649749df15cc33341ec7b"
|
||||
},
|
||||
{
|
||||
"m_Id": "458cb2d5e1f04648898ab1a5b122e5a1"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"code",
|
||||
"HLSL"
|
||||
],
|
||||
"m_Precision": 1,
|
||||
"m_PreviewExpanded": false,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SourceType": 0,
|
||||
"m_FunctionName": "SampleWaterHeight",
|
||||
"m_FunctionSource": "4453c99908d0997428446580ee1d8bd0",
|
||||
"m_FunctionBody": "Enter function body here..."
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "f33f512079204c0e89eba50545cd41c8",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "Geometry_Height",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Geometry_Height",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 317aa34f54c227b40ac3b256efd70af2
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/SubGraphs/Sample Water Height.shadersubgraph
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,479 @@
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||
"m_ObjectId": "79baefe926db4bdc95dde0e7bf153a5b",
|
||||
"m_Properties": [
|
||||
{
|
||||
"m_Id": "b56c3cd5bf51474d9ebd66c89c3a60f8"
|
||||
},
|
||||
{
|
||||
"m_Id": "67545535255d46e8a37e112032509ece"
|
||||
}
|
||||
],
|
||||
"m_Keywords": [],
|
||||
"m_Dropdowns": [],
|
||||
"m_CategoryData": [
|
||||
{
|
||||
"m_Id": "1a9dbd658f2c465b950b1b7b3c81539c"
|
||||
}
|
||||
],
|
||||
"m_Nodes": [
|
||||
{
|
||||
"m_Id": "20a5f56d8cb646e98711c9e99cadc079"
|
||||
},
|
||||
{
|
||||
"m_Id": "18caaddd35ec4ba4bec4325869d0f7d1"
|
||||
},
|
||||
{
|
||||
"m_Id": "74cf7b5db3e3470bba20ca095571ccfc"
|
||||
},
|
||||
{
|
||||
"m_Id": "7070b49bd03047769d69ac806a7917ca"
|
||||
}
|
||||
],
|
||||
"m_GroupDatas": [],
|
||||
"m_StickyNoteDatas": [
|
||||
{
|
||||
"m_Id": "1cd229b21f8e487eaf805ae82d43b9da"
|
||||
}
|
||||
],
|
||||
"m_Edges": [
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "18caaddd35ec4ba4bec4325869d0f7d1"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "20a5f56d8cb646e98711c9e99cadc079"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "7070b49bd03047769d69ac806a7917ca"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "18caaddd35ec4ba4bec4325869d0f7d1"
|
||||
},
|
||||
"m_SlotId": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "74cf7b5db3e3470bba20ca095571ccfc"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "18caaddd35ec4ba4bec4325869d0f7d1"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"m_VertexContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"m_Blocks": []
|
||||
},
|
||||
"m_FragmentContext": {
|
||||
"m_Position": {
|
||||
"x": 0.0,
|
||||
"y": 0.0
|
||||
},
|
||||
"m_Blocks": []
|
||||
},
|
||||
"m_PreviewData": {
|
||||
"serializedMesh": {
|
||||
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||
"m_Guid": ""
|
||||
},
|
||||
"preventRotation": false
|
||||
},
|
||||
"m_Path": "Sub Graphs",
|
||||
"m_GraphPrecision": 1,
|
||||
"m_PreviewMode": 2,
|
||||
"m_OutputNode": {
|
||||
"m_Id": "20a5f56d8cb646e98711c9e99cadc079"
|
||||
},
|
||||
"m_SubDatas": [],
|
||||
"m_ActiveTargets": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
|
||||
"m_ObjectId": "18caaddd35ec4ba4bec4325869d0f7d1",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "CalculateWaterNormal (Custom Function)",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -136.0,
|
||||
"y": -59.0,
|
||||
"width": 272.0,
|
||||
"height": 117.99999237060547
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "c7c774db45164b74b848afee176ff60d"
|
||||
},
|
||||
{
|
||||
"m_Id": "3f72d043072d438b9e5de0c50914cfc3"
|
||||
},
|
||||
{
|
||||
"m_Id": "b432dbf838594471ad8d0c364016db67"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"code",
|
||||
"HLSL"
|
||||
],
|
||||
"m_Precision": 1,
|
||||
"m_PreviewExpanded": false,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SourceType": 0,
|
||||
"m_FunctionName": "CalculateWaterNormal",
|
||||
"m_FunctionSource": "4453c99908d0997428446580ee1d8bd0",
|
||||
"m_FunctionBody": "Enter function body here..."
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
|
||||
"m_ObjectId": "1a9dbd658f2c465b950b1b7b3c81539c",
|
||||
"m_Name": "",
|
||||
"m_ChildObjectList": [
|
||||
{
|
||||
"m_Id": "b56c3cd5bf51474d9ebd66c89c3a60f8"
|
||||
},
|
||||
{
|
||||
"m_Id": "67545535255d46e8a37e112032509ece"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.StickyNoteData",
|
||||
"m_ObjectId": "1cd229b21f8e487eaf805ae82d43b9da",
|
||||
"m_Title": "Usage note",
|
||||
"m_Content": "For this to return any data the Stylized Water 3 render feature must be active on the current renderer.\n\nAnd the \"Height Prepass\" option must be enabled.",
|
||||
"m_TextSize": 0,
|
||||
"m_Theme": 0,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -133.0,
|
||||
"y": -198.0,
|
||||
"width": 259.0,
|
||||
"height": 135.0
|
||||
},
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
|
||||
"m_ObjectId": "20a5f56d8cb646e98711c9e99cadc079",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Output",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 167.99998474121095,
|
||||
"y": -59.0000114440918,
|
||||
"width": 128.00001525878907,
|
||||
"height": 77.00001525878906
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "aa0b8a51e019409d8299c85f65a67d1e"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"IsFirstSlotValid": true
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "29f8d9d264394d1cb6348563ec659269",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "World Position",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Out",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "3f72d043072d438b9e5de0c50914cfc3",
|
||||
"m_Id": 2,
|
||||
"m_DisplayName": "strength",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "strength",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.10000000149011612,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty",
|
||||
"m_ObjectId": "67545535255d46e8a37e112032509ece",
|
||||
"m_Guid": {
|
||||
"m_GuidSerialized": "a2a6a878-916d-42ca-9ca4-cec3b9d27505"
|
||||
},
|
||||
"m_Name": "Strength",
|
||||
"m_DefaultRefNameVersion": 1,
|
||||
"m_RefNameGeneratedByDisplayName": "Strength",
|
||||
"m_DefaultReferenceName": "_Strength",
|
||||
"m_OverrideReferenceName": "",
|
||||
"m_GeneratePropertyBlock": true,
|
||||
"m_UseCustomSlotLabel": false,
|
||||
"m_CustomSlotLabel": "",
|
||||
"m_DismissedVersion": 0,
|
||||
"m_Precision": 0,
|
||||
"overrideHLSLDeclaration": false,
|
||||
"hlslDeclarationOverride": 0,
|
||||
"m_Hidden": false,
|
||||
"m_Value": 1.0,
|
||||
"m_FloatType": 0,
|
||||
"m_RangeValues": {
|
||||
"x": 0.0,
|
||||
"y": 1.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||
"m_ObjectId": "7070b49bd03047769d69ac806a7917ca",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Property",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -312.0,
|
||||
"y": 8.99998664855957,
|
||||
"width": 121.00001525878906,
|
||||
"height": 34.00001525878906
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "bc14f0c334c3406d9e01aeb9fdfd81d5"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_Property": {
|
||||
"m_Id": "67545535255d46e8a37e112032509ece"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||
"m_ObjectId": "74cf7b5db3e3470bba20ca095571ccfc",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Property",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -343.9999694824219,
|
||||
"y": -25.000011444091798,
|
||||
"width": 152.99998474121095,
|
||||
"height": 34.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "29f8d9d264394d1cb6348563ec659269"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_Property": {
|
||||
"m_Id": "b56c3cd5bf51474d9ebd66c89c3a60f8"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "aa0b8a51e019409d8299c85f65a67d1e",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "World_Normal",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "World_Normal",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "b432dbf838594471ad8d0c364016db67",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "normal",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "normal",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector3ShaderProperty",
|
||||
"m_ObjectId": "b56c3cd5bf51474d9ebd66c89c3a60f8",
|
||||
"m_Guid": {
|
||||
"m_GuidSerialized": "5af9a8ae-055b-47f9-a79c-a71dbc400123"
|
||||
},
|
||||
"m_Name": "World Position",
|
||||
"m_DefaultRefNameVersion": 1,
|
||||
"m_RefNameGeneratedByDisplayName": "World Position",
|
||||
"m_DefaultReferenceName": "_World_Position",
|
||||
"m_OverrideReferenceName": "",
|
||||
"m_GeneratePropertyBlock": true,
|
||||
"m_UseCustomSlotLabel": false,
|
||||
"m_CustomSlotLabel": "",
|
||||
"m_DismissedVersion": 0,
|
||||
"m_Precision": 0,
|
||||
"overrideHLSLDeclaration": false,
|
||||
"hlslDeclarationOverride": 0,
|
||||
"m_Hidden": false,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "bc14f0c334c3406d9e01aeb9fdfd81d5",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Strength",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Out",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "c7c774db45164b74b848afee176ff60d",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "positionWS",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "positionWS",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 337b2beec8b3090478e4826787999253
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/SubGraphs/Sample Water Normal.shadersubgraph
|
||||
uploadId: 895866
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5da8e34fcbc64721b185986ff6d6d02
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/Water Decal.shadergraph
|
||||
uploadId: 895866
|
||||
@@ -0,0 +1,70 @@
|
||||
Shader "Stylized Water 3/Cutout"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
//[CurvedWorldBendSettings] _CurvedWorldBendSettings("0|1|1", Vector) = (0, 0, 0, 0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
PackageRequirements
|
||||
{
|
||||
"com.unity.render-pipelines.core": "10.3.2"
|
||||
"com.unity.render-pipelines.universal": "10.3.2"
|
||||
}
|
||||
Tags { "RenderPipeline" = "UniversalPipeline" "Queue" = "Transparent-1" }
|
||||
ColorMask 0
|
||||
ZWrite On
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Depth mask"
|
||||
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "Libraries/URP.hlsl"
|
||||
//#define CURVEDWORLD_BEND_TYPE_CLASSICRUNNER_X_POSITIVE
|
||||
//#define CURVEDWORLD_BEND_ID_1
|
||||
//#pragma shader_feature_local CURVEDWORLD_DISABLED_ON
|
||||
//#include "Assets/Amazing Assets/Curved World/Shaders/Core/CurvedWorldTransform.cginc"
|
||||
|
||||
struct Attributes
|
||||
{
|
||||
float4 positionOS : POSITION;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct Varyings
|
||||
{
|
||||
float4 positionCS : SV_POSITION;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
Varyings vert(Attributes input)
|
||||
{
|
||||
Varyings output = (Varyings)0;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
#if defined(CURVEDWORLD_IS_INSTALLED) && !defined(CURVEDWORLD_DISABLED_ON)
|
||||
CURVEDWORLD_TRANSFORM_VERTEX(input.positionOS)
|
||||
#endif
|
||||
|
||||
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag() : SV_Target { return 0; }
|
||||
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 762e7e7f839e8f64b94faf1669178a2a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 287769
|
||||
packageName: Stylized Water 3
|
||||
packageVersion: 3.2.6
|
||||
assetPath: Assets/Stylized Water 3/Shaders/WaterCutoutMask.shader
|
||||
uploadId: 895866
|
||||
Reference in New Issue
Block a user