2026-04-16 오브젝트 그림자
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
#pragma once
|
||||
|
||||
TEXTURE2D_X(_MainTex);
|
||||
float4 _MainTex_ST;
|
||||
float4 _MainTex_TexelSize;
|
||||
|
||||
float4 _ShadowData;
|
||||
#define SHADOW_SAMPLES _ShadowData.x
|
||||
#define POSTERIZATION _ShadowData.y
|
||||
#define DEPTH_REJECTION _ShadowData.z
|
||||
#define SHADOW_MAX_BLUR_DEPTH _ShadowData.w
|
||||
|
||||
float4 _ShadowData2;
|
||||
#define CONTACT_STRENGTH _ShadowData2.x
|
||||
#define MAX_SHADOW_SPREAD _ShadowData2.y
|
||||
#define SHADOW_MAX_DEPTH _ShadowData2.z
|
||||
#define LIGHT_SIZE _ShadowData2.w
|
||||
|
||||
float4 _ShadowData3;
|
||||
#define BLUR_DEPTH_ATTEN_START _ShadowData3.x
|
||||
#define BLUR_DEPTH_ATTEN_LENGTH _ShadowData3.y
|
||||
#define BLUR_GRAZING_ATTEN_STRENGTH _ShadowData3.z
|
||||
#define BLUR_EDGE_SHARPNESS _ShadowData3.w
|
||||
|
||||
float _BlurSpread;
|
||||
#define BLUR_SPREAD _BlurSpread
|
||||
|
||||
float4 _ShadowData4;
|
||||
#define OCCLUDERS_COUNT _ShadowData4.x
|
||||
#define OCCLUDERS_SEARCH_RADIUS _ShadowData4.y
|
||||
#define CONTACT_STRENGTH_KNEE _ShadowData4.z
|
||||
#define MASK_SCALE _ShadowData4.w
|
||||
|
||||
float _BlurScale;
|
||||
|
||||
float4 _BlendCascadeData;
|
||||
#define BLEND_CASCADE_DATA _BlendCascadeData
|
||||
|
||||
float2 _SourceSize;
|
||||
|
||||
float _ReceiverPlaneAltitude;
|
||||
|
||||
int _EarlyOutSamples;
|
||||
|
||||
#define dot2(x) dot(x,x)
|
||||
|
||||
struct AttributesSimple {
|
||||
float4 positionOS : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
|
||||
struct VaryingsSimple {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
VaryingsSimple VertSimple(AttributesSimple v) {
|
||||
VaryingsSimple o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.positionCS = v.positionOS;
|
||||
o.positionCS.y *= _ProjectionParams.x;
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
float GetLinearDepth(float2 uv) {
|
||||
float rawDepth = SampleSceneDepth(uv);
|
||||
float depthPersp = Linear01Depth(rawDepth, _ZBufferParams);
|
||||
float depthOrtho = rawDepth;
|
||||
#if UNITY_REVERSED_Z
|
||||
depthOrtho = 1.0 - depthOrtho;
|
||||
#endif
|
||||
float depth = lerp(depthPersp, depthOrtho, unity_OrthoParams.w);
|
||||
return depth;
|
||||
}
|
||||
|
||||
float3 GetWorldPosition(float2 uv, float rawDepth) {
|
||||
#if UNITY_REVERSED_Z
|
||||
float depth = rawDepth;
|
||||
#else
|
||||
float depth = lerp(UNITY_NEAR_CLIP_VALUE, 1, rawDepth);
|
||||
#endif
|
||||
|
||||
float3 worldPos = ComputeWorldSpacePosition(uv, depth, UNITY_MATRIX_I_VP);
|
||||
return worldPos;
|
||||
}
|
||||
|
||||
|
||||
float3 GetNormalFromWPOS(float3 wpos) {
|
||||
float3 dx = ddx(wpos);
|
||||
float3 dy = ddy(wpos);
|
||||
float3 cr = cross(dy, dx);
|
||||
float len = length(cr);
|
||||
if (len == 0) {
|
||||
return -UNITY_MATRIX_IT_MV[2].xyz;
|
||||
}
|
||||
return cr / len;
|
||||
}
|
||||
|
||||
|
||||
float3 GetNormalFromUV(float2 uv, float depth) {
|
||||
float3 wpos = GetWorldPosition(uv, depth);
|
||||
return GetNormalFromWPOS(wpos);
|
||||
}
|
||||
|
||||
half InvLerp(half b, half t) {
|
||||
half oneMinusT = 1 - t;
|
||||
return oneMinusT + b * t;
|
||||
}
|
||||
|
||||
bool IsSkyBox(float rawDepth) {
|
||||
#if UNITY_REVERSED_Z
|
||||
return rawDepth <= 0;
|
||||
#else
|
||||
return rawDepth >= 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4011d16d47104fac8fb0ab72211d911
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/Common.hlsl
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,221 @@
|
||||
int _ContactShadowsSampleCount;
|
||||
#define SAMPLE_COUNT _ContactShadowsSampleCount
|
||||
|
||||
float4 _ContactShadowsData1;
|
||||
#define STEPPING _ContactShadowsData1.x
|
||||
#define INTENSITY_MULTIPLIER _ContactShadowsData1.y
|
||||
#define JITTER _ContactShadowsData1.z
|
||||
#define DISTANCE_FADE _ContactShadowsData1.w
|
||||
|
||||
float4 _ContactShadowsData2;
|
||||
#define CONTACT_SHADOWS_MIN_DISTANCE _ContactShadowsData2.x
|
||||
#define CONTACT_SHADOWS_MIN_DISTANCE_FADE _ContactShadowsData2.y
|
||||
#define CONTACT_SHADOWS_MAX_DISTANCE _ContactShadowsData2.z
|
||||
#define CONTACT_SHADOWS_NORMAL_BIAS _ContactShadowsData2.w
|
||||
|
||||
float4 _ContactShadowsData3;
|
||||
#define THICKNESS_NEAR _ContactShadowsData3.x
|
||||
#define THICKNESS_DEPTH_MULTIPLIER _ContactShadowsData3.y
|
||||
#define VIGNETTE_SIZE _ContactShadowsData3.z
|
||||
#define BIAS _ContactShadowsData3.w
|
||||
|
||||
float4 _ContactShadowsData4;
|
||||
#define BIAS_FAR _ContactShadowsData4.x
|
||||
#define EDGE_SOFTNESS _ContactShadowsData4.y
|
||||
#define SHADOWS_3D _ContactShadowsData4.z
|
||||
|
||||
float4 _PointLightPosition;
|
||||
|
||||
#if _LOOP_STEP_X3
|
||||
#define LOOP_STEP 3
|
||||
#elif _LOOP_STEP_X2
|
||||
#define LOOP_STEP 2
|
||||
#else
|
||||
#define LOOP_STEP 1
|
||||
#endif
|
||||
|
||||
#define SHADER_API_WEBGL ((SHADER_API_GLES || SHADER_API_GLES3) && SHADER_API_DESKTOP)
|
||||
|
||||
#if SHADER_API_MOBILE || SHADER_API_WEBGL
|
||||
#define LOOP(index, count) UNITY_UNROLL for(int index=0;index<64;index+=LOOP_STEP) if (index < count) {
|
||||
#else
|
||||
#define LOOP(index, count) for(int index=0;index<count;index+=LOOP_STEP) {
|
||||
#endif
|
||||
#define END_LOOP }
|
||||
|
||||
inline float GetLinearDepth01(float2 uv) {
|
||||
|
||||
float rawDepth = SAMPLE_TEXTURE2D_X_LOD(_CameraDepthTexture, sampler_PointClamp, uv, 0).r;
|
||||
float depthPersp = Linear01Depth(rawDepth, _ZBufferParams);
|
||||
float depthOrtho = rawDepth;
|
||||
#if UNITY_REVERSED_Z
|
||||
depthOrtho = 1.0 - depthOrtho;
|
||||
#endif
|
||||
float depth01 = lerp(depthPersp, depthOrtho, unity_OrthoParams.w);
|
||||
return depth01;
|
||||
}
|
||||
|
||||
|
||||
inline float3 GetSSCoords(float3 wpos) {
|
||||
float4 pos = TransformWorldToHClip(wpos);
|
||||
pos.xyz /= pos.w;
|
||||
pos.y *= _ProjectionParams.x;
|
||||
float3 coords = pos.xyz;
|
||||
coords.xy = coords.xy * 0.5 + 0.5;
|
||||
|
||||
float depthPersp = Linear01Depth(coords.z, _ZBufferParams);
|
||||
float depthOrtho = coords.z;
|
||||
#if UNITY_REVERSED_Z
|
||||
depthOrtho = 1.0 - depthOrtho;
|
||||
#endif
|
||||
coords.z = lerp(depthPersp, depthOrtho, unity_OrthoParams.w);
|
||||
|
||||
return coords;
|
||||
}
|
||||
|
||||
half4 FragContactShadows(Varyings input) : SV_Target {
|
||||
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = input.texcoord.xy;
|
||||
|
||||
float rawDepth = SampleSceneDepth(uv);
|
||||
|
||||
#if !_RECEIVER_PLANE
|
||||
if (IsSkyBox(rawDepth)) return half4(0, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
float depthPersp = Linear01Depth(rawDepth, _ZBufferParams);
|
||||
float depthOrtho = rawDepth;
|
||||
#if UNITY_REVERSED_Z
|
||||
depthOrtho = 1.0 - depthOrtho;
|
||||
#endif
|
||||
float depth01 = lerp(depthPersp, depthOrtho, unity_OrthoParams.w);
|
||||
|
||||
#if defined(CONTACT_SHADOWS_AFTER_OPAQUE)
|
||||
if (depth01 >= CONTACT_SHADOWS_MAX_DISTANCE || depth01 < CONTACT_SHADOWS_MIN_DISTANCE)
|
||||
return half4(0, 0, 0, 0);
|
||||
#else
|
||||
if (depth01 >= SHADOW_MAX_DEPTH || depth01 < CONTACT_SHADOWS_MIN_DISTANCE)
|
||||
return half4(1, 0, 0, 1);
|
||||
#endif
|
||||
|
||||
float3 wpos0 = GetWorldPosition(uv, rawDepth);
|
||||
|
||||
#if _NORMALS_TEXTURE
|
||||
float3 norm = SampleSceneNormals(uv);
|
||||
#else
|
||||
float3 norm = GetNormalFromWPOS(wpos0);
|
||||
#endif
|
||||
wpos0 += norm * CONTACT_SHADOWS_NORMAL_BIAS;
|
||||
|
||||
#if _RECEIVER_PLANE
|
||||
if (wpos0.y < _ReceiverPlaneAltitude) {
|
||||
float3 cameraToWpos = wpos0 - _WorldSpaceCameraPos;
|
||||
float t = (_ReceiverPlaneAltitude - _WorldSpaceCameraPos.y) / cameraToWpos.y;
|
||||
wpos0 = _WorldSpaceCameraPos + t * cameraToWpos;
|
||||
#if _NORMALS_TEXTURE
|
||||
norm = float3(0, 1, 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
float3 lightDirection;
|
||||
#if _USE_POINT_LIGHT
|
||||
_PointLightPosition.y = lerp(wpos0.y - 0.05f, _PointLightPosition.y, SHADOWS_3D);
|
||||
lightDirection = normalize(_PointLightPosition.xyz - wpos0);
|
||||
#else
|
||||
lightDirection = _MainLightPosition.xyz;
|
||||
#endif
|
||||
|
||||
float3 step = lightDirection * STEPPING;
|
||||
|
||||
half randomVal = InterleavedGradientNoise(uv * _SourceSize.xy, 0);
|
||||
wpos0 += step * (randomVal * JITTER);
|
||||
|
||||
float bias = depth01 * lerp(BIAS, BIAS_FAR, depth01);
|
||||
float thickness = THICKNESS_NEAR + depth01 * THICKNESS_DEPTH_MULTIPLIER;
|
||||
float maxDist = STEPPING * SAMPLE_COUNT;
|
||||
|
||||
half shadow = 1.0;
|
||||
half dist = 0;
|
||||
|
||||
#if _SOFT_EDGES
|
||||
// Complex loop with edge softness
|
||||
float softestShadow = 1.0;
|
||||
|
||||
LOOP(k, SAMPLE_COUNT)
|
||||
|
||||
float3 wpos = wpos0 + step * k;
|
||||
float3 coords = GetSSCoords(wpos);
|
||||
|
||||
if (any(floor(coords.xy)!=0)) break;
|
||||
float depth = GetLinearDepth01(coords.xy);
|
||||
|
||||
float depthDiff = coords.z - depth;
|
||||
if (depthDiff > bias && depthDiff < thickness) {
|
||||
// Soft edge calculation based on how close we are to the bias threshold
|
||||
float edgeFade = saturate((depthDiff - bias) / (thickness * EDGE_SOFTNESS));
|
||||
|
||||
dist = STEPPING * k;
|
||||
float distanceFade = lerp(0, DISTANCE_FADE, (float)k / SAMPLE_COUNT);
|
||||
|
||||
// Additional softening based on distance
|
||||
float distanceSoftness = saturate(dist / (STEPPING * SAMPLE_COUNT * 0.5));
|
||||
distanceFade = lerp(distanceFade, 1.0, distanceSoftness * 0.3);
|
||||
|
||||
float currentShadow = lerp(1.0, distanceFade, edgeFade);
|
||||
softestShadow = min(softestShadow, currentShadow);
|
||||
|
||||
// Continue sampling for softer edges
|
||||
if (edgeFade > 0.98 && k > SAMPLE_COUNT * 0.5) break;
|
||||
}
|
||||
|
||||
END_LOOP
|
||||
|
||||
shadow = softestShadow;
|
||||
#else
|
||||
// Simple loop that exits immediately on hit
|
||||
LOOP(k, SAMPLE_COUNT)
|
||||
|
||||
float3 wpos = wpos0 + step * k;
|
||||
float3 coords = GetSSCoords(wpos);
|
||||
|
||||
if (any(floor(coords.xy)!=0)) break;
|
||||
float depth = GetLinearDepth01(coords.xy);
|
||||
|
||||
float depthDiff = coords.z - depth;
|
||||
if (depthDiff > bias && depthDiff < thickness) {
|
||||
dist = STEPPING * k;
|
||||
shadow = lerp(0, DISTANCE_FADE, (float)k / SAMPLE_COUNT);
|
||||
break;
|
||||
}
|
||||
|
||||
END_LOOP
|
||||
#endif
|
||||
|
||||
shadow = saturate( shadow + 1.0 - saturate((depth01 - CONTACT_SHADOWS_MIN_DISTANCE) / CONTACT_SHADOWS_MIN_DISTANCE_FADE) );
|
||||
|
||||
// apply shadow intensity
|
||||
half4 shadowParams = GetMainLightShadowParams();
|
||||
if (all(shadowParams.xy == 0)) shadowParams.x = 1; // if shadows are disabled, shadowParams is not set
|
||||
half shadowIntensity = shadowParams.x * INTENSITY_MULTIPLIER;
|
||||
|
||||
if (VIGNETTE_SIZE > 0) {
|
||||
float2 screenCoord = uv * _SourceSize;
|
||||
float2 distanceToEdges = min(screenCoord, _SourceSize - screenCoord);
|
||||
float edgeDistance = min(distanceToEdges.x, distanceToEdges.y);
|
||||
half vignette = edgeDistance / (VIGNETTE_SIZE * min(_SourceSize.x, _SourceSize.y));
|
||||
vignette = saturate(vignette);
|
||||
shadow = lerp(1, shadow, vignette);
|
||||
}
|
||||
|
||||
shadow = InvLerp(shadow, shadowIntensity);
|
||||
|
||||
#if defined(CONTACT_SHADOWS_AFTER_OPAQUE)
|
||||
return half4(0, 0, 0, 1.0 - shadow);
|
||||
#else
|
||||
return half4(shadow, dist, 0, 0);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c459ab4b3eba4c6f910b2049df58ddf
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/ContactShadows.hlsl
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,287 @@
|
||||
TEXTURE2D_X_FLOAT(_DownsampledDepth);
|
||||
float4 _DownsampledDepth_TexelSize;
|
||||
|
||||
half4 _OverlayShadowColor;
|
||||
|
||||
struct VaryingsCross {
|
||||
float4 positionCS : SV_POSITION;
|
||||
float2 uv: TEXCOORD0;
|
||||
float2 dir : TEXCOORD1;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
VaryingsCross VertBlur(AttributesSimple v) {
|
||||
VaryingsCross o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.positionCS = v.positionOS;
|
||||
o.positionCS.y *= _ProjectionParams.x;
|
||||
o.uv = v.uv;
|
||||
#if defined(BLUR_VERT)
|
||||
o.dir = float2(0, _MainTex_TexelSize.y * _BlurScale);
|
||||
#else
|
||||
o.dir = float2(_MainTex_TexelSize.x * _BlurScale, 0);
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
#if _BLUR_HQ
|
||||
static const float weights[] = { 0.14446445, 0.13543542, 0.11153505, 0.08055309, 0.05087564, 0.02798160, 0.01332457, 0.00545096 };
|
||||
#define SAMPLE_COUNT 7
|
||||
#else
|
||||
static const float weights[] = { 0.2270270270, 0.3162162162, 0.0702702703 };
|
||||
#define SAMPLE_COUNT 2
|
||||
#endif
|
||||
|
||||
|
||||
half2 BlurShadowGaussian(VaryingsCross i, float depth) {
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(i.uv);
|
||||
|
||||
half2 shadow = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, uv, 0).xy;
|
||||
if (depth > SHADOW_MAX_BLUR_DEPTH) return shadow;
|
||||
|
||||
float referenceDepth = 10.0 / _ProjectionParams.z;
|
||||
float spread = BLUR_SPREAD * clamp(referenceDepth / depth, 1.0, 10.0);
|
||||
#if _CONTACT_HARDENING
|
||||
spread *= lerp(1, shadow.y, CONTACT_STRENGTH);
|
||||
#endif
|
||||
spread = clamp(spread, 0.5, 10);
|
||||
|
||||
half2 shadowBlur = 0;
|
||||
half sum = 0.0000001;
|
||||
|
||||
UNITY_UNROLL
|
||||
for (int index = -SAMPLE_COUNT; index <= SAMPLE_COUNT; index++) {
|
||||
float2 uv = i.uv + i.dir * (index * spread);
|
||||
float2 shadowN = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, UnityStereoTransformScreenSpaceTex(uv), 0).xy;
|
||||
float depthN = GetLinearDepth(uv);
|
||||
float depthDiff = abs(depthN - depth);
|
||||
float r2 = depthDiff * DEPTH_REJECTION;
|
||||
float g = exp(-r2 * r2);
|
||||
float w = g * weights[abs(index)];
|
||||
shadowBlur += w * shadowN;
|
||||
sum += w;
|
||||
}
|
||||
|
||||
shadowBlur /= sum;
|
||||
|
||||
return shadowBlur;
|
||||
}
|
||||
|
||||
half2 BlurShadowBox(VaryingsSimple i, float depth) {
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(i.uv);
|
||||
|
||||
half2 shadow = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, uv, 0).xy;
|
||||
if (depth > SHADOW_MAX_BLUR_DEPTH) return shadow;
|
||||
|
||||
float referenceDepth = 10.0 / _ProjectionParams.z;
|
||||
float spread = BLUR_SPREAD * clamp(referenceDepth / depth, 1.0, 10.0);
|
||||
#if _CONTACT_HARDENING
|
||||
spread *= lerp(1, shadow.y, CONTACT_STRENGTH);
|
||||
#endif
|
||||
spread = clamp(spread, 1, 10);
|
||||
|
||||
half2 shadowBlur = 0;
|
||||
half sum = 0.0000001;
|
||||
|
||||
float2 blurSize = _MainTex_TexelSize.xy * spread;
|
||||
UNITY_UNROLL
|
||||
for(int y=-1;y<=1;y++) {
|
||||
UNITY_UNROLL
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
float2 uv = i.uv + float2(x,y) * blurSize;
|
||||
float2 shadowN = SAMPLE_TEXTURE2D_X_LOD(_MainTex, sampler_LinearClamp, UnityStereoTransformScreenSpaceTex(uv), 0).xy;
|
||||
float depthN = GetLinearDepth(uv);
|
||||
float depthDiff = abs(depthN - depth);
|
||||
float r2 = depthDiff * DEPTH_REJECTION;
|
||||
float g = exp(-r2 * r2);
|
||||
float w = g;
|
||||
shadowBlur += w * shadowN;
|
||||
sum += w;
|
||||
}
|
||||
}
|
||||
|
||||
shadowBlur /= sum;
|
||||
|
||||
return shadowBlur;
|
||||
}
|
||||
|
||||
half4 FragBlurGaussian (VaryingsCross i): SV_Target {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float depth = GetLinearDepth(i.uv);
|
||||
if (depth >= SHADOW_MAX_DEPTH) return 1;
|
||||
|
||||
half2 shadow = BlurShadowGaussian(i, depth);
|
||||
return half4(shadow, 0, 0);
|
||||
}
|
||||
|
||||
half4 FragBlurBox (VaryingsSimple i): SV_Target {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float depth = GetLinearDepth(i.uv);
|
||||
if (depth >= SHADOW_MAX_DEPTH) return 1;
|
||||
|
||||
half2 shadow = BlurShadowBox(i, depth);
|
||||
return half4(shadow, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
half4 FragCompose (VaryingsSimple i): SV_Target {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float rawDepth = SampleSceneDepth(i.uv);
|
||||
float depthPersp = Linear01Depth(rawDepth, _ZBufferParams);
|
||||
float depthOrtho = rawDepth;
|
||||
#if UNITY_REVERSED_Z
|
||||
depthOrtho = 1.0 - depthOrtho;
|
||||
#endif
|
||||
float depth = lerp(depthPersp, depthOrtho, unity_OrthoParams.w);
|
||||
if (depth >= SHADOW_MAX_DEPTH) return 1;
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(i.uv);
|
||||
|
||||
#if _PRESERVE_EDGES
|
||||
const float threshold = 0.00005;
|
||||
const float t = 0.5;
|
||||
float2 uv00 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(-t, -t));
|
||||
float2 uv10 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(t, -t));
|
||||
float2 uv01 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(-t, t));
|
||||
float2 uv11 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(t, t));
|
||||
float4 depths;
|
||||
depths.x = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv00).r;
|
||||
depths.y = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv10).r;
|
||||
depths.z = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv01).r;
|
||||
depths.w = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv11).r;
|
||||
float4 diffs = abs(depth.xxxx - depths);
|
||||
|
||||
float2 minUV = UnityStereoTransformScreenSpaceTex(uv);
|
||||
if (any(diffs > threshold)) {
|
||||
// Check 10 vs 00
|
||||
float minDiff = lerp(diffs.x, diffs.y, diffs.y < diffs.x);
|
||||
minUV = lerp(uv00, uv10, diffs.y < diffs.x);
|
||||
// Check against 01
|
||||
minUV = lerp(minUV, uv01, diffs.z < minDiff);
|
||||
minDiff = lerp(minDiff, diffs.z, diffs.z < minDiff);
|
||||
// Check against 11
|
||||
minUV = lerp(minUV, uv11, diffs.w < minDiff);
|
||||
}
|
||||
|
||||
half2 shadow = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, minUV).xy;
|
||||
#else
|
||||
half2 shadow = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv).xy;
|
||||
#endif
|
||||
|
||||
// improve shadow edge
|
||||
#if _CONTACT_HARDENING
|
||||
half penumbra = lerp(1.0 - BLUR_EDGE_SHARPNESS, 1.0, shadow.y);
|
||||
#else
|
||||
half penumbra = 1.0 - BLUR_EDGE_SHARPNESS;
|
||||
#endif
|
||||
half u0 = 0.5 - penumbra * 0.5;
|
||||
half u1 = 0.5 + penumbra * 0.5;
|
||||
// lerp between fine and smooth edge based on distance to occluder
|
||||
half edged = smoothstep(u0, u1, shadow.x);
|
||||
shadow.x = lerp(shadow.x, edged, BLUR_EDGE_SHARPNESS);
|
||||
|
||||
shadow = round(shadow * POSTERIZATION) / POSTERIZATION;
|
||||
|
||||
half blendingFactor = 1.0;
|
||||
|
||||
#if defined(COMPOSE_WITH_BLENDING)
|
||||
// reduce blur with distance
|
||||
blendingFactor -= saturate((depth - BLUR_DEPTH_ATTEN_START) / BLUR_DEPTH_ATTEN_LENGTH);
|
||||
|
||||
// under skewed view, reduce blur
|
||||
if (BLUR_GRAZING_ATTEN_STRENGTH > 0) {
|
||||
float3 wpos = GetWorldPosition(uv, rawDepth);
|
||||
float3 viewDir = normalize(wpos - GetCameraPositionWS());
|
||||
#if _NORMALS_TEXTURE
|
||||
float3 norm = SampleSceneNormals(uv);
|
||||
#else
|
||||
float3 norm = GetNormalFromWPOS(wpos);
|
||||
#endif
|
||||
blendingFactor *= lerp(1, abs(dot(norm, viewDir)), BLUR_GRAZING_ATTEN_STRENGTH);
|
||||
}
|
||||
#endif
|
||||
|
||||
return half4(shadow.x, 0, 0, blendingFactor);
|
||||
}
|
||||
|
||||
float4 FragDownsampleDepth (VaryingsSimple i): SV_Target {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float depth = GetLinearDepth(i.uv);
|
||||
if (depth >= SHADOW_MAX_DEPTH) return 1;
|
||||
return depth;
|
||||
}
|
||||
|
||||
|
||||
half4 FragComposeUnity (VaryingsSimple i): SV_Target {
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
|
||||
float rawDepth = SampleSceneDepth(i.uv);
|
||||
#if !_RECEIVER_PLANE
|
||||
if (IsSkyBox(rawDepth)) return 1;
|
||||
#endif
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(i.uv);
|
||||
|
||||
#if _PRESERVE_EDGES
|
||||
float depth = Linear01Depth(rawDepth, _ZBufferParams);
|
||||
const float threshold = 0.00005;
|
||||
const float t = 0.5;
|
||||
float2 uv00 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(-t, -t));
|
||||
float2 uv10 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(t, -t));
|
||||
float2 uv01 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(-t, t));
|
||||
float2 uv11 = UnityStereoTransformScreenSpaceTex(i.uv + _DownsampledDepth_TexelSize.xy * float2(t, t));
|
||||
float4 depths;
|
||||
depths.x = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv00).r;
|
||||
depths.y = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv10).r;
|
||||
depths.z = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv01).r;
|
||||
depths.w = SAMPLE_TEXTURE2D_X(_DownsampledDepth, sampler_PointClamp, uv11).r;
|
||||
float4 diffs = abs(depth.xxxx - depths);
|
||||
|
||||
float2 minUV = UnityStereoTransformScreenSpaceTex(uv);
|
||||
if (any(diffs > threshold)) {
|
||||
// Check 10 vs 00
|
||||
float minDiff = lerp(diffs.x, diffs.y, diffs.y < diffs.x);
|
||||
minUV = lerp(uv00, uv10, diffs.y < diffs.x);
|
||||
// Check against 01
|
||||
minUV = lerp(minUV, uv01, diffs.z < minDiff);
|
||||
minDiff = lerp(minDiff, diffs.z, diffs.z < minDiff);
|
||||
// Check against 11
|
||||
minUV = lerp(minUV, uv11, diffs.w < minDiff);
|
||||
}
|
||||
|
||||
half shadow = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, minUV).x;
|
||||
#else
|
||||
half shadow = SAMPLE_TEXTURE2D_X(_MainTex, sampler_LinearClamp, uv).x;
|
||||
#endif
|
||||
|
||||
return half4(shadow, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
half4 FragDebugShadows(Varyings input) : SV_Target {
|
||||
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.texcoord.xy);
|
||||
|
||||
half shadow = SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_LinearClamp, uv).x;
|
||||
return shadow.xxxx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
half4 FragOverlayShadows(Varyings input) : SV_Target {
|
||||
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = UnityStereoTransformScreenSpaceTex(input.texcoord.xy);
|
||||
|
||||
half shadow = SAMPLE_TEXTURE2D_X(_ScreenSpaceShadowmapTexture, sampler_LinearClamp, uv).x;
|
||||
return half4(1, 1, 1, 1 - shadow) * _OverlayShadowColor;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e319766b9a5a64e008d361eaac8a7079
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/ShadowBlur.hlsl
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,341 @@
|
||||
TEXTURE2D(_NoiseTex);
|
||||
float4 _NoiseTex_TexelSize;
|
||||
float4 _UmbraCascadeRects[4];
|
||||
float _UmbraCascadeScales[4];
|
||||
|
||||
static const float2 randomOffsets[64] = {
|
||||
float2(0.000000, 0.000000),
|
||||
float2(-0.737277, 0.675590),
|
||||
float2(0.123257, -1.408832),
|
||||
float2(1.054406, 1.374128),
|
||||
float2(-1.969616, -0.347296),
|
||||
float2(1.885881, -1.201438),
|
||||
float2(-0.633975, 2.366025),
|
||||
float2(-1.221672, -2.346810),
|
||||
float2(2.657852, 0.967379),
|
||||
float2(-2.771639, 1.148050),
|
||||
float2(1.336436, -2.865997),
|
||||
float2(0.997328, 3.163121),
|
||||
float2(-3.000000, -1.732051),
|
||||
float2(3.520085, -0.780384),
|
||||
float2(-2.146127, 3.064986),
|
||||
float2(-0.505526, -3.839849),
|
||||
float2(3.064178, 2.571150),
|
||||
float2(-4.119181, 0.179847),
|
||||
float2(3.000000, -3.000000),
|
||||
float2(-0.190133, 4.354750),
|
||||
float2(-2.874634, -3.425855),
|
||||
float2(4.543371, 0.598146),
|
||||
float2(-3.842164, 2.690312),
|
||||
float2(1.038008, -4.682151),
|
||||
float2(2.449490, 4.242641),
|
||||
float2(-4.768585, -1.503529),
|
||||
float2(4.621281, -2.154939),
|
||||
float2(-1.988481, 4.800619),
|
||||
float2(-1.809800, -4.972386),
|
||||
float2(4.776700, 2.486592),
|
||||
float2(-5.290594, 1.417610),
|
||||
float2(2.991558, -4.695805),
|
||||
float2(0.982302, 5.570914),
|
||||
float2(-4.557468, -3.497068),
|
||||
float2(5.808763, -0.508201),
|
||||
float2(-3.996846, 4.361792),
|
||||
float2(-0.000000, -6.000000),
|
||||
float2(4.109455, 4.484683),
|
||||
float2(-6.140957, -0.537264),
|
||||
float2(4.954490, -3.801714),
|
||||
float2(-1.098248, 6.228471),
|
||||
float2(-3.440396, -5.400340),
|
||||
float2(6.259915, 1.677339),
|
||||
float2(-5.816519, 3.027888),
|
||||
float2(2.268705, -6.233216),
|
||||
float2(2.567119, 6.197572),
|
||||
float2(-6.146878, -2.866337),
|
||||
float2(6.538354, -2.061535),
|
||||
float2(-3.464102, 6.000000),
|
||||
float2(-1.515077, -6.834072),
|
||||
float2(5.792280, 4.055798),
|
||||
float2(-7.080333, 0.932143),
|
||||
float2(4.635207, -5.524025),
|
||||
float2(0.317554, 7.273181),
|
||||
float2(-5.196152, -5.196152),
|
||||
float2(7.409140, 0.323490),
|
||||
float2(-5.732552, 4.810182),
|
||||
float2(0.985451, -7.485245),
|
||||
float2(4.368228, 6.238476),
|
||||
float2(-7.499072, -1.662504),
|
||||
float2(6.708204, -3.872983),
|
||||
float2(-2.348587, 7.448768),
|
||||
float2(-3.327700, -7.136275),
|
||||
float2(7.333066, 3.037456)
|
||||
};
|
||||
|
||||
#if _LOOP_STEP_X3
|
||||
#define LOOP_STEP 3
|
||||
#elif _LOOP_STEP_X2
|
||||
#define LOOP_STEP 2
|
||||
#else
|
||||
#define LOOP_STEP 1
|
||||
#endif
|
||||
|
||||
#define SHADER_API_WEBGL ((SHADER_API_GLES || SHADER_API_GLES3) && SHADER_API_DESKTOP)
|
||||
|
||||
#if SHADER_API_MOBILE || SHADER_API_WEBGL
|
||||
#define LOOP(index, count) UNITY_UNROLL for(int index=0;index<64;index+=LOOP_STEP) if (index < count) {
|
||||
#else
|
||||
#define LOOP(index, count) for(int index=0;index<count;index+=LOOP_STEP) {
|
||||
#endif
|
||||
#define END_LOOP }
|
||||
|
||||
half ComputeCascadeIndexWithBlending(float3 positionWS, out half blendFactor) {
|
||||
|
||||
float3 fromCenter0 = positionWS - _CascadeShadowSplitSpheres0.xyz;
|
||||
float3 fromCenter1 = positionWS - _CascadeShadowSplitSpheres1.xyz;
|
||||
float3 fromCenter2 = positionWS - _CascadeShadowSplitSpheres2.xyz;
|
||||
float3 fromCenter3 = positionWS - _CascadeShadowSplitSpheres3.xyz;
|
||||
|
||||
float4 distances2 = float4(dot(fromCenter0, fromCenter0), dot(fromCenter1, fromCenter1), dot(fromCenter2, fromCenter2), dot(fromCenter3, fromCenter3));
|
||||
|
||||
// Determine the closest cascade
|
||||
half4 weights = half4(distances2 < _CascadeShadowSplitSphereRadii);
|
||||
weights.yzw = saturate(weights.yzw - weights.xyz);
|
||||
half cascadeIndex = 4 - dot(weights, half4(4, 3, 2, 1));
|
||||
|
||||
// Compute blend factor between cascades
|
||||
half4 distancesToBorders = abs(distances2 - _CascadeShadowSplitSphereRadii);
|
||||
half4 blendFactors = 1.0 - saturate(distancesToBorders / BLEND_CASCADE_DATA);
|
||||
blendFactors *= blendFactors;
|
||||
blendFactors *= 0.5;
|
||||
|
||||
if (blendFactors.x > blendFactors.y) {
|
||||
blendFactor = blendFactors.x;
|
||||
return saturate(1 - cascadeIndex);
|
||||
}
|
||||
if (blendFactors.y > blendFactors.z) {
|
||||
blendFactor = blendFactors.y;
|
||||
return clamp(3 - cascadeIndex, 1, 2);
|
||||
}
|
||||
blendFactor = blendFactors.z;
|
||||
return clamp(5 - cascadeIndex, 2, 3);
|
||||
}
|
||||
|
||||
|
||||
float4 CustomTransformWorldToShadowCoord(float3 positionWS, out half cascadeIndex, out half blendFactor)
|
||||
{
|
||||
#ifdef _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
cascadeIndex = ComputeCascadeIndexWithBlending(positionWS, blendFactor);
|
||||
#else
|
||||
cascadeIndex = 0;
|
||||
blendFactor = 0;
|
||||
#endif
|
||||
|
||||
float4 shadowCoord = mul(_MainLightWorldToShadow[cascadeIndex], float4(positionWS, 1.0));
|
||||
|
||||
return float4(shadowCoord.xyz, 0);
|
||||
}
|
||||
|
||||
float4 CustomTransformWorldToShadowCoord(float3 positionWS, out half cascadeIndex)
|
||||
{
|
||||
#ifdef _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
cascadeIndex = ComputeCascadeIndex(positionWS);
|
||||
#else
|
||||
cascadeIndex = 0;
|
||||
#endif
|
||||
|
||||
float4 shadowCoord = mul(_MainLightWorldToShadow[cascadeIndex], float4(positionWS, 1.0));
|
||||
|
||||
return float4(shadowCoord.xyz, 0);
|
||||
}
|
||||
|
||||
|
||||
inline float3 InterpolateShadowmapCoord(float3 coords, float3 dx, float3 dy, float2 offset) {
|
||||
return coords + dx * offset.x + dy * offset.y;
|
||||
}
|
||||
|
||||
#if _MASK_TEXTURE
|
||||
|
||||
TEXTURE2D(_MaskTex);
|
||||
|
||||
half ComputeMaskWorldSpace(float3 wpos, float3 normalWS) {
|
||||
float3 maskUV = wpos * MASK_SCALE;
|
||||
half n1 = SAMPLE_TEXTURE2D(_MaskTex, sampler_LinearRepeat, maskUV.zy).r;
|
||||
half n2 = SAMPLE_TEXTURE2D(_MaskTex, sampler_LinearRepeat, maskUV.xz).r;
|
||||
half n3 = SAMPLE_TEXTURE2D(_MaskTex, sampler_LinearRepeat, maskUV.xy).r;
|
||||
float3 triW = abs(normalWS);
|
||||
float3 weights = triW / (triW.x + triW.y + triW.z);
|
||||
half mask = dot(half3(n1, n2, n3), weights);
|
||||
return mask;
|
||||
}
|
||||
#endif
|
||||
|
||||
half4 FragCast(Varyings input) : SV_Target {
|
||||
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
float2 uv = input.texcoord.xy;
|
||||
|
||||
float rawDepth = SampleSceneDepth(uv);
|
||||
|
||||
#if !_RECEIVER_PLANE
|
||||
if (IsSkyBox(rawDepth)) return half4(1, 0, 0, 0);
|
||||
#endif
|
||||
|
||||
half cascadeIndex;
|
||||
|
||||
// normal provided by normals texture
|
||||
#if _NORMALS_TEXTURE
|
||||
float3 norm = SampleSceneNormals(uv);
|
||||
#endif
|
||||
|
||||
float3 wpos = GetWorldPosition(uv, rawDepth);
|
||||
|
||||
#if _RECEIVER_PLANE
|
||||
if (wpos.y < _ReceiverPlaneAltitude) {
|
||||
float3 cameraToWpos = wpos - _WorldSpaceCameraPos;
|
||||
float t = (_ReceiverPlaneAltitude - _WorldSpaceCameraPos.y) / cameraToWpos.y;
|
||||
wpos = _WorldSpaceCameraPos + t * cameraToWpos;
|
||||
#if _NORMALS_TEXTURE
|
||||
norm = float3(0, 1, 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// compute normal at world position
|
||||
#if !_NORMALS_TEXTURE
|
||||
float3 norm = GetNormalFromWPOS(wpos);
|
||||
#endif
|
||||
|
||||
// get cascade and shadowmap coordinate
|
||||
#if defined(_BLEND_CASCADE)
|
||||
half blendFactor;
|
||||
float4 coords = CustomTransformWorldToShadowCoord(wpos, cascadeIndex, blendFactor);
|
||||
if (blendFactor <= 0 || blendFactor >= 0.5) discard;
|
||||
#else
|
||||
float4 coords = CustomTransformWorldToShadowCoord(wpos, cascadeIndex);
|
||||
#endif
|
||||
|
||||
if (BEYOND_SHADOW_FAR(coords)) return half4(1, 0, 0, 0);
|
||||
|
||||
// prepare noise
|
||||
float2 pos = uv * _SourceSize;
|
||||
float2 noise = normalize(SAMPLE_TEXTURE2D_LOD(_NoiseTex, sampler_PointRepeat, pos * _NoiseTex_TexelSize.xy, 0).xy - 0.5);
|
||||
|
||||
// pick tangent & binormal that are orthogonal to light direction
|
||||
float3 v = _MainLightPosition.xyz;
|
||||
v.y = abs(norm.y) < 0.9;
|
||||
v = normalize(v);
|
||||
float3 tangent = normalize(cross(norm, v));
|
||||
float3 binormal = cross(norm, tangent);
|
||||
|
||||
// compute shadowmap axis coordinates for later interpolation
|
||||
float3 cr0 = mul(_MainLightWorldToShadow[cascadeIndex], float4(wpos + tangent, 1.0)).xyz;
|
||||
float3 cr1 = mul(_MainLightWorldToShadow[cascadeIndex], float4(wpos + binormal, 1.0)).xyz;
|
||||
float3 dx = cr0 - coords.xyz;
|
||||
float3 dy = cr1 - coords.xyz;
|
||||
|
||||
// clamp to cascade boundary
|
||||
#if _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
float4 cascadeRect = _UmbraCascadeRects[cascadeIndex];
|
||||
#endif
|
||||
|
||||
#if _CONTACT_HARDENING
|
||||
|
||||
// contact hardening
|
||||
float depthAvg = 0;
|
||||
float occluders = 0;
|
||||
float3 dxSearch = dx * OCCLUDERS_SEARCH_RADIUS;
|
||||
float3 dySearch = dy * OCCLUDERS_SEARCH_RADIUS;
|
||||
#if SHADER_API_MOBILE
|
||||
//UNITY_UNROLLX(32)
|
||||
#endif
|
||||
LOOP(i, OCCLUDERS_COUNT)
|
||||
float2 offset = reflect(randomOffsets[i], noise);
|
||||
float3 cr2 = InterpolateShadowmapCoord(coords.xyz, dxSearch, dySearch, offset);
|
||||
#if _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
cr2.xy = clamp(cr2.xy, cascadeRect.xy, cascadeRect.zw);
|
||||
#endif
|
||||
float d = SAMPLE_TEXTURE2D_LOD(_MainLightShadowmapTexture, sampler_LinearClamp, cr2.xy, 0).x;
|
||||
if (d > cr2.z) {
|
||||
depthAvg += d;
|
||||
occluders++;
|
||||
}
|
||||
END_LOOP
|
||||
|
||||
if (occluders < 1) return half4(1, 0, 0, 0);
|
||||
|
||||
depthAvg = depthAvg / occluders + 0.00001;
|
||||
float distAvg = depthAvg - coords.z;
|
||||
#if _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
distAvg *= _UmbraCascadeScales[cascadeIndex];
|
||||
#endif
|
||||
float smoothness = distAvg / depthAvg;
|
||||
|
||||
float distanceFactor = lerp(CONTACT_STRENGTH, MAX_SHADOW_SPREAD, saturate(distAvg / CONTACT_STRENGTH_KNEE) * smoothness) * LIGHT_SIZE;
|
||||
#else
|
||||
float distanceFactor = LIGHT_SIZE;
|
||||
#endif
|
||||
|
||||
// compute shadow term
|
||||
dx *= distanceFactor;
|
||||
dy *= distanceFactor;
|
||||
half shadow = 0;
|
||||
half samples = 0;
|
||||
|
||||
#if SHADER_API_MOBILE
|
||||
//SHADOW_SAMPLES = min(SHADOW_SAMPLES, 32);
|
||||
//UNITY_UNROLLX(32)
|
||||
#endif
|
||||
LOOP(j, SHADOW_SAMPLES)
|
||||
float2 offset = reflect(randomOffsets[j], noise);
|
||||
float3 cr2 = InterpolateShadowmapCoord(coords.xyz, dx, dy, offset);
|
||||
#if _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
cr2.xy = clamp(cr2.xy, cascadeRect.xy, cascadeRect.zw);
|
||||
#endif
|
||||
shadow += SAMPLE_TEXTURE2D_SHADOW(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture, cr2);
|
||||
samples++;
|
||||
if (samples > _EarlyOutSamples && (shadow <= 0 || shadow >= samples)) break;
|
||||
END_LOOP
|
||||
shadow /= samples;
|
||||
|
||||
#if _MASK_TEXTURE
|
||||
half mask = ComputeMaskWorldSpace(wpos, norm);
|
||||
shadow = saturate(shadow + mask);
|
||||
#endif
|
||||
|
||||
// apply shadow intensity
|
||||
half4 shadowParams = GetMainLightShadowParams();
|
||||
half shadowIntensity = shadowParams.x;
|
||||
shadow = InvLerp(shadow, shadowIntensity);
|
||||
|
||||
// output with alpha if cascade blending is used
|
||||
#if defined(_BLEND_CASCADE)
|
||||
return half4(shadow, distanceFactor, 0, blendFactor);
|
||||
#else
|
||||
return half4(shadow, distanceFactor, 0, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
half4 FragUnityShadows(Varyings input) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
|
||||
|
||||
#if UNITY_REVERSED_Z
|
||||
float deviceDepth = SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_PointClamp, input.texcoord.xy).r;
|
||||
#else
|
||||
float deviceDepth = SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_PointClamp, input.texcoord.xy).r;
|
||||
deviceDepth = deviceDepth * 2.0 - 1.0;
|
||||
#endif
|
||||
|
||||
//Fetch shadow coordinates for cascade.
|
||||
float3 wpos = ComputeWorldSpacePosition(input.texcoord.xy, deviceDepth, unity_MatrixInvVP);
|
||||
float4 coords = TransformWorldToShadowCoord(wpos);
|
||||
|
||||
// Screenspace shadowmap is only used for directional lights which use orthogonal projection.
|
||||
half realtimeShadow = MainLightRealtimeShadow(coords);
|
||||
|
||||
return realtimeShadow;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec87f1a05845843d3bb05b576314b62a
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/ShadowCast.hlsl
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c3132133fcd34506aa421c69014901d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef UMBRA_SHADOW_FUNCTIONS_INCLUDED
|
||||
#define UMBRA_SHADOW_FUNCTIONS_INCLUDED
|
||||
|
||||
#ifdef SHADERGRAPH_PREVIEW
|
||||
void GetMainShadow_float(float3 worldPos, out half shadowAtten){
|
||||
shadowAtten = 1;
|
||||
}
|
||||
#else
|
||||
void GetMainShadow_float(float3 worldPos, out half shadowAtten){
|
||||
float4 shadowCoord = ComputeScreenPos(TransformWorldToHClip(worldPos));
|
||||
shadowAtten = SampleScreenSpaceShadowmap(shadowCoord);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // UMBRA_SHADOW_FUNCTIONS_INCLUDED
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97b280ff217a64e4fbf524cc3adf374a
|
||||
ShaderIncludeImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/Transparent
|
||||
Receiver/ShadowFunctions.hlsl
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,804 @@
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.GraphData",
|
||||
"m_ObjectId": "313d9d1fe28a4561bfcd174269782ca6",
|
||||
"m_Properties": [
|
||||
{
|
||||
"m_Id": "5f2fa682a67d4b9bb3ce0c032b99524c"
|
||||
}
|
||||
],
|
||||
"m_Keywords": [],
|
||||
"m_Dropdowns": [],
|
||||
"m_CategoryData": [
|
||||
{
|
||||
"m_Id": "fbc63f3198b944c0ae62acc54dfb7583"
|
||||
}
|
||||
],
|
||||
"m_Nodes": [
|
||||
{
|
||||
"m_Id": "9a45fa2786da4e9a8880b2416e884c1f"
|
||||
},
|
||||
{
|
||||
"m_Id": "792ce8177b4b40f2b49db74b402ef06f"
|
||||
},
|
||||
{
|
||||
"m_Id": "745ea9abdb724f25952d4740bf30c020"
|
||||
},
|
||||
{
|
||||
"m_Id": "533b2f26ee9a43fdaa385258dc054356"
|
||||
},
|
||||
{
|
||||
"m_Id": "15e6e2478d6b4b82aff4190884ad03de"
|
||||
},
|
||||
{
|
||||
"m_Id": "0d8b270b1d8f40d8ac19121eb472db47"
|
||||
},
|
||||
{
|
||||
"m_Id": "0e1e3ddeb5424df7a0afa5fe3064b5fb"
|
||||
},
|
||||
{
|
||||
"m_Id": "046e55d7fa1f4aca841e660634642385"
|
||||
},
|
||||
{
|
||||
"m_Id": "dc71a03354764aa4b2793dcec9e02920"
|
||||
}
|
||||
],
|
||||
"m_GroupDatas": [],
|
||||
"m_StickyNoteDatas": [],
|
||||
"m_Edges": [
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "046e55d7fa1f4aca841e660634642385"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "533b2f26ee9a43fdaa385258dc054356"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "0d8b270b1d8f40d8ac19121eb472db47"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "15e6e2478d6b4b82aff4190884ad03de"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "15e6e2478d6b4b82aff4190884ad03de"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "dc71a03354764aa4b2793dcec9e02920"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"m_OutputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "dc71a03354764aa4b2793dcec9e02920"
|
||||
},
|
||||
"m_SlotId": 1
|
||||
},
|
||||
"m_InputSlot": {
|
||||
"m_Node": {
|
||||
"m_Id": "0e1e3ddeb5424df7a0afa5fe3064b5fb"
|
||||
},
|
||||
"m_SlotId": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"m_VertexContext": {
|
||||
"m_Position": {
|
||||
"x": 165.0,
|
||||
"y": 184.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "9a45fa2786da4e9a8880b2416e884c1f"
|
||||
},
|
||||
{
|
||||
"m_Id": "792ce8177b4b40f2b49db74b402ef06f"
|
||||
},
|
||||
{
|
||||
"m_Id": "745ea9abdb724f25952d4740bf30c020"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_FragmentContext": {
|
||||
"m_Position": {
|
||||
"x": 165.0,
|
||||
"y": 401.0
|
||||
},
|
||||
"m_Blocks": [
|
||||
{
|
||||
"m_Id": "533b2f26ee9a43fdaa385258dc054356"
|
||||
},
|
||||
{
|
||||
"m_Id": "0e1e3ddeb5424df7a0afa5fe3064b5fb"
|
||||
}
|
||||
]
|
||||
},
|
||||
"m_PreviewData": {
|
||||
"serializedMesh": {
|
||||
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
|
||||
"m_Guid": ""
|
||||
},
|
||||
"preventRotation": false
|
||||
},
|
||||
"m_Path": "Shader Graphs",
|
||||
"m_GraphPrecision": 1,
|
||||
"m_PreviewMode": 2,
|
||||
"m_OutputNode": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_SubDatas": [],
|
||||
"m_ActiveTargets": [
|
||||
{
|
||||
"m_Id": "e36cc0dd20a44f22923e392b9bfccc84"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
|
||||
"m_ObjectId": "046e55d7fa1f4aca841e660634642385",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Property",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -239.0000457763672,
|
||||
"y": 183.99993896484376,
|
||||
"width": 147.0,
|
||||
"height": 34.00004577636719
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "7459cf9619dd4269918e7e62a14828e4"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_Property": {
|
||||
"m_Id": "5f2fa682a67d4b9bb3ce0c032b99524c"
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "073a43107aba4af6b619005c8ec766ea",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Alpha",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Alpha",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": 1.0,
|
||||
"m_DefaultValue": 1.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PositionNode",
|
||||
"m_ObjectId": "0d8b270b1d8f40d8ac19121eb472db47",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "Position",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -1064.0,
|
||||
"y": 257.9999694824219,
|
||||
"width": 208.0,
|
||||
"height": 314.4999694824219
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "fe302a6ca1e9493d92edbeb37dd9d398"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"location"
|
||||
],
|
||||
"m_Precision": 1,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 2,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_Space": 2,
|
||||
"m_PositionSource": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "0e1e3ddeb5424df7a0afa5fe3064b5fb",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.Alpha",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "073a43107aba4af6b619005c8ec766ea"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.Alpha"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot",
|
||||
"m_ObjectId": "13ee747054f84538ba3da482273283c7",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Base Color",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "BaseColor",
|
||||
"m_StageCapability": 2,
|
||||
"m_Value": {
|
||||
"x": 0.5,
|
||||
"y": 0.5,
|
||||
"z": 0.5
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": [],
|
||||
"m_ColorMode": 0,
|
||||
"m_DefaultColor": {
|
||||
"r": 0.5,
|
||||
"g": 0.5,
|
||||
"b": 0.5,
|
||||
"a": 1.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
|
||||
"m_ObjectId": "14b5565b46d3477daee496d9ab92b620",
|
||||
"m_Id": 1,
|
||||
"m_DisplayName": "attenuation",
|
||||
"m_SlotType": 1,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "attenuation",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": 0.0,
|
||||
"m_DefaultValue": 0.0,
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CustomFunctionNode",
|
||||
"m_ObjectId": "15e6e2478d6b4b82aff4190884ad03de",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "GetMainShadow (Custom Function)",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -802.5,
|
||||
"y": 262.0000305175781,
|
||||
"width": 262.5,
|
||||
"height": 277.9999694824219
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "a8408df2e5c84a1380869614a19939c2"
|
||||
},
|
||||
{
|
||||
"m_Id": "14b5565b46d3477daee496d9ab92b620"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"code",
|
||||
"HLSL"
|
||||
],
|
||||
"m_Precision": 1,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SourceType": 0,
|
||||
"m_FunctionName": "GetMainShadow",
|
||||
"m_FunctionSource": "97b280ff217a64e4fbf524cc3adf374a",
|
||||
"m_FunctionBody": "Enter function body here..."
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 2,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget",
|
||||
"m_ObjectId": "16533883a7c0489eaecf612ab54498ff"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
|
||||
"m_ObjectId": "26741a9638224fc6bcd1bfa42507da22",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "In",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "In",
|
||||
"m_StageCapability": 3,
|
||||
"m_Value": {
|
||||
"x": 1.0,
|
||||
"y": 1.0,
|
||||
"z": 1.0,
|
||||
"w": 1.0
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0,
|
||||
"w": 0.0
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "533b2f26ee9a43fdaa385258dc054356",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "SurfaceDescription.BaseColor",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "13ee747054f84538ba3da482273283c7"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "SurfaceDescription.BaseColor"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 3,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Internal.ColorShaderProperty",
|
||||
"m_ObjectId": "5f2fa682a67d4b9bb3ce0c032b99524c",
|
||||
"m_Guid": {
|
||||
"m_GuidSerialized": "e3787be8-4877-4493-8455-7d929ee3a994"
|
||||
},
|
||||
"m_Name": "ShadowColor",
|
||||
"m_DefaultRefNameVersion": 1,
|
||||
"m_RefNameGeneratedByDisplayName": "ShadowColor",
|
||||
"m_DefaultReferenceName": "_ShadowColor",
|
||||
"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": {
|
||||
"r": 0.0,
|
||||
"g": 0.0,
|
||||
"b": 0.0,
|
||||
"a": 0.0
|
||||
},
|
||||
"isMainColor": false,
|
||||
"m_ColorMode": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
|
||||
"m_ObjectId": "7459cf9619dd4269918e7e62a14828e4",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "ShadowColor",
|
||||
"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_Labels": []
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "745ea9abdb724f25952d4740bf30c020",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Tangent",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "8be0770c35914fe2951ec373bae178ed"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Tangent"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "792ce8177b4b40f2b49db74b402ef06f",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Normal",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "c900a2e48237468ba5e76c3677280076"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Normal"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot",
|
||||
"m_ObjectId": "8be0770c35914fe2951ec373bae178ed",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Tangent",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Tangent",
|
||||
"m_StageCapability": 1,
|
||||
"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_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.BlockNode",
|
||||
"m_ObjectId": "9a45fa2786da4e9a8880b2416e884c1f",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "VertexDescription.Position",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"width": 0.0,
|
||||
"height": 0.0
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "df25a6de5fd648879475811c09b1810a"
|
||||
}
|
||||
],
|
||||
"synonyms": [],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
},
|
||||
"m_SerializedDescriptor": "VertexDescription.Position"
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "a8408df2e5c84a1380869614a19939c2",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "worldPos",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "worldPos",
|
||||
"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.NormalMaterialSlot",
|
||||
"m_ObjectId": "c900a2e48237468ba5e76c3677280076",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Normal",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Normal",
|
||||
"m_StageCapability": 1,
|
||||
"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_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
|
||||
"m_ObjectId": "d364eb86aab34fd08179bcb500ede32c",
|
||||
"m_Id": 1,
|
||||
"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.OneMinusNode",
|
||||
"m_ObjectId": "dc71a03354764aa4b2793dcec9e02920",
|
||||
"m_Group": {
|
||||
"m_Id": ""
|
||||
},
|
||||
"m_Name": "One Minus",
|
||||
"m_DrawState": {
|
||||
"m_Expanded": true,
|
||||
"m_Position": {
|
||||
"serializedVersion": "2",
|
||||
"x": -487.0000305175781,
|
||||
"y": 262.0000305175781,
|
||||
"width": 208.0,
|
||||
"height": 277.9999694824219
|
||||
}
|
||||
},
|
||||
"m_Slots": [
|
||||
{
|
||||
"m_Id": "26741a9638224fc6bcd1bfa42507da22"
|
||||
},
|
||||
{
|
||||
"m_Id": "d364eb86aab34fd08179bcb500ede32c"
|
||||
}
|
||||
],
|
||||
"synonyms": [
|
||||
"complement",
|
||||
"invert",
|
||||
"opposite"
|
||||
],
|
||||
"m_Precision": 0,
|
||||
"m_PreviewExpanded": true,
|
||||
"m_DismissedVersion": 0,
|
||||
"m_PreviewMode": 0,
|
||||
"m_CustomColors": {
|
||||
"m_SerializableColors": []
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot",
|
||||
"m_ObjectId": "df25a6de5fd648879475811c09b1810a",
|
||||
"m_Id": 0,
|
||||
"m_DisplayName": "Position",
|
||||
"m_SlotType": 0,
|
||||
"m_Hidden": false,
|
||||
"m_ShaderOutputName": "Position",
|
||||
"m_StageCapability": 1,
|
||||
"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_Space": 0
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 1,
|
||||
"m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget",
|
||||
"m_ObjectId": "e36cc0dd20a44f22923e392b9bfccc84",
|
||||
"m_Datas": [],
|
||||
"m_ActiveSubTarget": {
|
||||
"m_Id": "16533883a7c0489eaecf612ab54498ff"
|
||||
},
|
||||
"m_AllowMaterialOverride": false,
|
||||
"m_SurfaceType": 1,
|
||||
"m_ZTestMode": 4,
|
||||
"m_ZWriteControl": 0,
|
||||
"m_AlphaMode": 0,
|
||||
"m_RenderFace": 0,
|
||||
"m_AlphaClip": false,
|
||||
"m_CastShadows": false,
|
||||
"m_ReceiveShadows": false,
|
||||
"m_SupportsLODCrossFade": false,
|
||||
"m_CustomEditorGUI": "",
|
||||
"m_SupportVFX": false
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
|
||||
"m_ObjectId": "fbc63f3198b944c0ae62acc54dfb7583",
|
||||
"m_Name": "",
|
||||
"m_ChildObjectList": [
|
||||
{
|
||||
"m_Id": "5f2fa682a67d4b9bb3ce0c032b99524c"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"m_SGVersion": 0,
|
||||
"m_Type": "UnityEditor.ShaderGraph.Vector3MaterialSlot",
|
||||
"m_ObjectId": "fe302a6ca1e9493d92edbeb37dd9d398",
|
||||
"m_Id": 0,
|
||||
"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
|
||||
},
|
||||
"m_DefaultValue": {
|
||||
"x": 0.0,
|
||||
"y": 0.0,
|
||||
"z": 0.0
|
||||
},
|
||||
"m_Labels": []
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2653b59b7388e4f53806f4ab964d71c8
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/Transparent
|
||||
Receiver/ShadowReceiverTransparent.shadergraph
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,136 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Transparent Floor
|
||||
m_Shader: {fileID: -6465566751694194690, guid: 2653b59b7388e4f53806f4ab964d71c8, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses:
|
||||
- MOTIONVECTORS
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 0
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 0
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _Metallic: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.005
|
||||
- _QueueControl: 0
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 0
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 1
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _ShadowColor: {r: 0.028301895, g: 0.028301895, b: 0.028301895, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &4464394433452166678
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 10
|
||||
@@ -0,0 +1,16 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a2dfb70d5172b43e29db28656b0948e5
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/Transparent
|
||||
Receiver/Transparent Floor.mat
|
||||
uploadId: 868458
|
||||
@@ -0,0 +1,219 @@
|
||||
Shader "Hidden/Kronnect/UmbraScreenSpaceShadows"
|
||||
{
|
||||
Properties {
|
||||
// _MainTex ("Main Tex", 2D) = "white" {}
|
||||
// _Color ("Color", Color) = (1, 1, 1, 1)
|
||||
[NoScaleoffset] _NoiseTex("Noise Tex", 2D) = "white" {}
|
||||
_ContactShadowsBlend ("Contact Shadows Blend", Int) = 10 // OneMinusSrcAlpha
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderPipeline" = "UniversalPipeline" "IgnoreProjector" = "True"}
|
||||
ZTest Always ZWrite Off Cull Off
|
||||
|
||||
HLSLINCLUDE
|
||||
#pragma target 3.0
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/EntityLighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/ImageBasedLighting.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareNormalsTexture.hlsl"
|
||||
|
||||
#include "Common.hlsl"
|
||||
|
||||
ENDHLSL
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Umbra Shadows"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
||||
#pragma multi_compile_local_fragment _ _NORMALS_TEXTURE
|
||||
#pragma multi_compile_local_fragment _ _CONTACT_HARDENING
|
||||
#pragma multi_compile_local_fragment _ _LOOP_STEP_X2 _LOOP_STEP_X3
|
||||
#pragma multi_compile_local_fragment _ _MASK_TEXTURE
|
||||
#pragma multi_compile_local_fragment _ _RECEIVER_PLANE
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragCast
|
||||
#include "ShadowCast.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Blur Horiz"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _BLUR_HQ
|
||||
#pragma multi_compile_local_fragment _ _CONTACT_HARDENING
|
||||
#pragma vertex VertBlur
|
||||
#pragma fragment FragBlurGaussian
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Blur Vert"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _BLUR_HQ
|
||||
#pragma multi_compile_local_fragment _ _CONTACT_HARDENING
|
||||
#pragma vertex VertBlur
|
||||
#pragma fragment FragBlurGaussian
|
||||
#define BLUR_VERT
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Box Blur"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _CONTACT_HARDENING
|
||||
#pragma vertex VertSimple
|
||||
#pragma fragment FragBlurBox
|
||||
#define BOX_BLUR
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Compose with Blending"
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _PRESERVE_EDGES
|
||||
#pragma multi_compile_local_fragment _ _NORMALS_TEXTURE
|
||||
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
||||
#pragma vertex VertSimple
|
||||
#pragma fragment FragCompose
|
||||
#define COMPOSE_WITH_BLENDING
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Downsample Depth"
|
||||
HLSLPROGRAM
|
||||
#pragma vertex VertSimple
|
||||
#pragma fragment FragDownsampleDepth
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Umbra Cascade Blending"
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT
|
||||
#pragma multi_compile_local_fragment _ _NORMALS_TEXTURE
|
||||
#pragma multi_compile_local_fragment _ _CONTACT_HARDENING
|
||||
#pragma multi_compile_local_fragment _ _LOOP_STEP_X2 _LOOP_STEP_X3
|
||||
#pragma multi_compile_local_fragment _ _MASK_TEXTURE
|
||||
#define _BLEND_CASCADE
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragCast
|
||||
#include "ShadowCast.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "ScreenSpaceShadows"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE
|
||||
#pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragUnityShadows
|
||||
#include "ShadowCast.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Compose Unity Shadows"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _PRESERVE_EDGES
|
||||
#pragma vertex VertSimple
|
||||
#pragma fragment FragComposeUnity
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Contact Shadows"
|
||||
Blend One One
|
||||
BlendOp Min
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragContactShadows
|
||||
#pragma multi_compile_local_fragment _ _LOOP_STEP_X2 _LOOP_STEP_X3
|
||||
#pragma multi_compile_local_fragment _ _NORMALS_TEXTURE
|
||||
#pragma multi_compile_local_fragment _ _RECEIVER_PLANE
|
||||
#pragma multi_compile_local_fragment _ _USE_POINT_LIGHT
|
||||
#pragma multi_compile_local_fragment _ _SOFT_EDGES
|
||||
#include "ContactShadows.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Compose"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _PRESERVE_EDGES
|
||||
#pragma vertex VertSimple
|
||||
#pragma fragment FragCompose
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Debug Shadows"
|
||||
HLSLPROGRAM
|
||||
#pragma multi_compile_local_fragment _ _PRESERVE_EDGES
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragDebugShadows
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Contact Shadows After Opaque"
|
||||
Blend SrcAlpha [_ContactShadowsBlend]
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragContactShadows
|
||||
#pragma multi_compile_local_fragment _ _LOOP_STEP_X2 _LOOP_STEP_X3
|
||||
#pragma multi_compile_local_fragment _ _NORMALS_TEXTURE
|
||||
#pragma multi_compile_local_fragment _ _RECEIVER_PLANE
|
||||
#pragma multi_compile_local_fragment _ _USE_POINT_LIGHT
|
||||
#pragma multi_compile_local_fragment _ _SOFT_EDGES
|
||||
#define CONTACT_SHADOWS_AFTER_OPAQUE
|
||||
#include "ContactShadows.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Overlay Shadows"
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
HLSLPROGRAM
|
||||
#pragma vertex Vert
|
||||
#pragma fragment FragOverlayShadows
|
||||
#include "ShadowBlur.hlsl"
|
||||
ENDHLSL
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d461f5567983941438cff09455e8b8f4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures:
|
||||
- _BlueNoise: {fileID: 2800000, guid: e48811f1a66574b199fbc047d7139f79, type: 3}
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 282485
|
||||
packageName: Umbra Soft Shadows - Better Directional & Contact Shadows for URP
|
||||
packageVersion: 10.0.1
|
||||
assetPath: Assets/UmbraSoftShadows/Runtime/Resources/Umbra/Shaders/UmbraScreenSpaceShadows.shader
|
||||
uploadId: 868458
|
||||
Reference in New Issue
Block a user