wip : Cleaning not uses & integration liminal spaces

This commit is contained in:
2026-05-20 15:50:41 +01:00
parent 1cff87b60b
commit 396ecddf99
807 changed files with 125823 additions and 273654 deletions
@@ -3249,7 +3249,7 @@
"HLSL"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3b0e29a4d5d846649904fadefb096b51
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,221 @@
Shader "Custom/Glitch"
{
Properties
{
[Header(Fracture)]
_FractureAmount ("Fracture Amount", Range(0,1)) = 0.0
_CellScale ("Cell Scale", Float) = 8.0
_CellDisplace ("Cell Displacement", Range(0,0.1)) = 0.05
_CellRotation ("Cell Rotation", Range(0,1)) = 0.3
[Header(Depth Echoes)]
_EchoCount ("Echo Count", Range(0,8)) = 4.0
_EchoScale ("Echo Scale", Range(0,0.15)) = 0.06
_EchoOpacity ("Echo Opacity", Range(0,1)) = 0.4
_EchoSpread ("Echo Spread", Range(0,0.5)) = 0.15
[Header(Chromatic Aberration)]
_ChromaAmount ("Chromatic Aberration", Range(0,0.05)) = 0.01
[Header(Edge Darkening)]
_EdgeDarken ("Edge Darken", Range(0,1)) = 0.5
_EdgePower ("Edge Power", Float) = 2.0
[Header(Glitch Lines)]
_GlitchStrength ("Glitch Line Strength", Range(0,1)) = 0.3
_GlitchScale ("Glitch Line Scale", Float) = 40.0
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" }
ZWrite Off ZTest Always Cull Off
Pass
{
Name "CorridorFracturePass"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
float _FractureAmount;
float _CellScale;
float _CellDisplace;
float _CellRotation;
float _EchoCount;
float _EchoScale;
float _EchoOpacity;
float _EchoSpread;
float _ChromaAmount;
float _EdgeDarken;
float _EdgePower;
float _GlitchStrength;
float _GlitchScale;
// ─── NOISE / HASH ─────────────────────────────────────────
float2 Hash22(float2 p)
{
p = float2(dot(p, float2(127.1, 311.7)),
dot(p, float2(269.5, 183.3)));
return frac(sin(p) * 43758.5453);
}
float Hash11(float p)
{
return frac(sin(p * 127.1) * 43758.5453);
}
float SmoothNoise(float2 p)
{
float2 i = floor(p);
float2 f = frac(p);
f = f * f * (3.0 - 2.0 * f);
float a = frac(sin(dot(i, float2(127.1, 311.7))) * 43758.5453);
float b = frac(sin(dot(i + float2(1,0), float2(127.1, 311.7))) * 43758.5453);
float c = frac(sin(dot(i + float2(0,1), float2(127.1, 311.7))) * 43758.5453);
float d = frac(sin(dot(i + float2(1,1), float2(127.1, 311.7))) * 43758.5453);
return lerp(lerp(a, b, f.x), lerp(c, d, f.x), f.y);
}
// ─── VORONOI ──────────────────────────────────────────────
// Retourne (distance au point le plus proche, id de la cellule)
float2 Voronoi(float2 uv, float scale)
{
float2 scaledUV = uv * scale;
float2 i = floor(scaledUV);
float2 f = frac(scaledUV);
float minDist = 8.0;
float2 minCell = float2(0, 0);
for (int y = -1; y <= 1; y++)
{
for (int x = -1; x <= 1; x++)
{
float2 neighbor = float2(x, y);
float2 cellId = i + neighbor;
float2 cellPoint = Hash22(cellId) + neighbor;
float dist = length(cellPoint - f);
if (dist < minDist)
{
minDist = dist;
minCell = cellId;
}
}
}
return float2(minDist, Hash11(minCell.x * 73.1 + minCell.y * 191.7));
}
// ─── ROTATION UV ─────────────────────────────────────────
float2 RotateUV(float2 uv, float2 center, float angle)
{
float2 d = uv - center;
float s = sin(angle);
float c = cos(angle);
return center + float2(d.x * c - d.y * s, d.x * s + d.y * c);
}
// ─── SAMPLE AVEC CHROMATIC ABERRATION ────────────────────
half3 SampleChroma(float2 uv, float strength)
{
float2 dir = (uv - 0.5) * strength;
half r = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv + dir).r;
half g = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv).g;
half b = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv - dir).b;
return half3(r, g, b);
}
// ─── FRAGMENT ────────────────────────────────────────────
half4 Frag(Varyings input) : SV_Target
{
float2 uv = input.texcoord;
// Rien à faire si fracture = 0
if (_FractureAmount <= 0.001)
return SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv);
float t = _FractureAmount;
// ── 1. Cellules Voronoi ───────────────────────────────
// L'échelle des cellules augmente avec t : plus on avance,
// plus les fragments sont nombreux et petits.
float dynamicScale = _CellScale * (1.0 + t * 3.0);
float2 voronoi = Voronoi(uv, dynamicScale);
float cellDist = voronoi.x;
float cellId = voronoi.y;
// Déplacement UV par cellule — s'amplifie avec t
float2 cellOffset = (Hash22(float2(cellId * 17.3, cellId * 31.7)) - 0.5)
* _CellDisplace * t * 2.0;
// Rotation par cellule — s'amplifie avec t
float cellAngle = (cellId - 0.5) * _CellRotation * t * 3.14159 * 0.5;
float2 fracturedUV = RotateUV(uv + cellOffset, uv, cellAngle);
fracturedUV = clamp(fracturedUV, 0.0, 1.0);
// ── 2. Glitch lines verticales ────────────────────────
// Des bandes verticales se décalent aléatoirement.
float glitchNoise = SmoothNoise(float2(uv.y * _GlitchScale, floor(_Time.y * 8.0)));
float glitchMask = step(1.0 - t * _GlitchStrength, glitchNoise);
float glitchShift = (Hash11(floor(uv.y * _GlitchScale)) - 0.5) * 0.05 * t;
fracturedUV.x += glitchShift * glitchMask;
// ── 3. Sample de base avec chromatic aberration ───────
float chromaStrength = _ChromaAmount * t;
half3 col = SampleChroma(fracturedUV, chromaStrength);
// ── 4. Échos en profondeur ────────────────────────────
// Chaque écho est une copie de l'image contractée vers le centre,
// simulant une répétition infinie du couloir.
int echoCount = (int)ceil(_EchoCount * t);
echoCount = clamp(echoCount, 0, 8);
for (int i = 1; i <= echoCount; i++)
{
float fi = (float)i;
float echoT = fi / (float)echoCount;
// Contraction vers le centre — chaque écho est plus petit
float scale = 1.0 - fi * _EchoScale;
float2 echoUV = (uv - 0.5) * scale + 0.5;
// Décalage latéral alterné pour l'effet de dédoublement
float side = (frac(fi * 0.5) > 0.25) ? 1.0 : -1.0;
echoUV.x += side * _EchoSpread * echoT * t;
echoUV = clamp(echoUV, 0.0, 1.0);
// Opacité décroissante pour les échos lointains
float echoAlpha = _EchoOpacity * (1.0 - echoT) * t;
half3 echoCol = SampleChroma(echoUV, chromaStrength * 0.5);
col = lerp(col, echoCol, echoAlpha * 0.4);
}
// ── 5. Assombrissement des bords de cellule ───────────
// Les fissures entre cellules sont sombres.
float crackMask = 1.0 - smoothstep(0.0, 0.15 * (1.0 - t * 0.5), cellDist);
col *= 1.0 - crackMask * _EdgeDarken * t;
// ── 6. Vignette de bord d'écran ───────────────────────
float2 vigUV = uv * (1.0 - uv.yx);
float vignette = pow(vigUV.x * vigUV.y * 15.0, _EdgePower * (1.0 + t));
col *= saturate(vignette);
return half4(col, 1.0);
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d8a5c93e19e09fb48ac4dd40b0886dac
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 38ed4cf9fd3c84943bc89c2db8a3832a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,107 @@
Shader "Unheimlich/UI/ScribbleEffect"
{
Properties
{
_Color("Scribble Color", Color) = (0.2, 0.2, 0.2, 1)
_Progress("Draw Progress", Range(0, 1)) = 0
_LineThickness("Thickness", Range(0.005, 0.25)) = 0.02
_ZigzagFreq("Zigzag Frequency", Float) = 10
_ZigzagAmp("Zigzag Amplitude", Range(0, 0.3)) = 0.1
_DiagonalSlant("Diagonal Slant", Range(-1, 1)) = 0.4
_NumPasses("Number of Passes", Range(1, 4)) = 2
_Roundness("Roundness", Range(0, 1)) = 0.6
}
SubShader
{
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
Cull Off
Pass
{
HLSLPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
struct Attributes
{
float4 positionOS : POSITION;
float2 uv : TEXCOORD0;
};
struct Varyings
{
float4 positionCS : SV_POSITION;
float2 uv : TEXCOORD0;
};
CBUFFER_START(UnityPerMaterial)
half4 _Color;
half _Progress;
half _LineThickness;
half _ZigzagFreq;
half _ZigzagAmp;
half _DiagonalSlant;
int _NumPasses;
half _Roundness;
CBUFFER_END
Varyings vert(Attributes input)
{
Varyings output;
output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
output.uv = input.uv;
return output;
}
float DrawSlantedZigzag(float2 uv, float yOffset, float passProgress)
{
float diagonalProgress = uv.x + uv.y * _DiagonalSlant;
float zigzagCenter = yOffset + sin(diagonalProgress * _ZigzagFreq * 6.28318) * _ZigzagAmp;
float progressEnd = passProgress * 1.6;
float progressMask = smoothstep(progressEnd + 0.15, progressEnd - 0.05, diagonalProgress);
float fadeIn = smoothstep(-0.1, 0.2, diagonalProgress);
float capMask = fadeIn * progressMask;
float distanceToCenter = abs(uv.y - zigzagCenter);
float edgeSoftness = _LineThickness * (1.0 - _Roundness * 0.7);
float zigzagStrength = 1.0 - smoothstep(edgeSoftness, _LineThickness, distanceToCenter);
zigzagStrength = pow(zigzagStrength, 1.0 + _Roundness * 3.5);
return zigzagStrength * capMask;
}
half4 frag(Varyings input) : SV_Target
{
float totalMask = 0.0;
totalMask += DrawSlantedZigzag(input.uv, 0.5, _Progress);
if (_NumPasses >= 2)
totalMask += DrawSlantedZigzag(input.uv, 0.52, _Progress * 0.95);
if (_NumPasses >= 3)
totalMask += DrawSlantedZigzag(input.uv, 0.48, _Progress * 0.9);
if (_NumPasses >= 4)
totalMask += DrawSlantedZigzag(input.uv, 0.54, _Progress * 0.85);
totalMask = saturate(totalMask);
half4 result = _Color;
result.a *= totalMask;
return result;
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 10b6f40fb2f72a942a493008573d70d3
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7432d3cdd50b3f54b8e618043324b8d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aa820050961d22245b4a1bfe8a4e8106
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 912206a322f3c3a4e9811db9f7af4831
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 61b32c0949e11be46b9fea9a79a15af0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,382 @@
Shader "Custom/ToonBilal"
{
Properties
{
[Header(Global)]
_ShaderWeight ("Shader Weight", Range(0,1)) = 1.0
[Header(Toon Shading)]
_ToonSteps ("Toon Steps", Float) = 3
_ShadowStrength ("Shadow Strength", Range(0,1)) = 0.3
[Header(Pencil Outlines)]
_OutlineThickness ("Outline Thickness", Float) = 2.0
_OutlineThicknessVar ("Outline Thickness Variation", Range(0,1)) = 0.4
_DepthThreshold ("Depth Outline Threshold", Range(0,0.1)) = 0.01
_ColorThreshold ("Color Outline Threshold", Range(0,1)) = 0.2
_DepthOutlineStrength ("Depth Outline Strength", Range(0,1)) = 1.0
_ColorOutlineStrength ("Color Outline Strength", Range(0,1)) = 0.5
_OutlineSoftness ("Outline Softness", Range(0,1)) = 0.6
_OutlineColorBlend ("Outline Color From Surface", Range(0,1)) = 0.5
_OutlineDarken ("Outline Darken Amount", Range(0,1)) = 0.7
[Header(Outline Brightness Fade)]
_OutlineFadeStart ("Outline Fade Start", Range(0,1)) = 0.4
_OutlineFadeEnd ("Outline Fade End", Range(0,1)) = 0.9
_OutlineFadeStrength ("Outline Fade Strength", Range(0,1)) = 1.0
_OutlineBrightMin ("Outline Bright Min Visibility", Range(0,1)) = 0.4
[Header(Hatching)]
_HatchTex ("Hatching Texture", 2D) = "white" {}
_HatchScale ("Hatch Scale", Float) = 0.3
_HatchStrength ("Hatch Strength", Range(0,1)) = 0.6
_HatchThreshold ("Hatch Shadow Threshold", Range(0,1)) = 0.5
_CurvatureStrength ("Curvature Strength", Range(0,5)) = 1.5
_FlatSurface ("Flat Surface Reduction", Range(0,1)) = 0.15
[Header(Organic Hatching)]
_HatchScale2 ("Hatch Scale Layer 2", Float) = 0.17
_HatchRotation ("Hatch Rotation", Range(0,3.14159)) = 0.785
_HatchLayerBlend ("Hatch Layer Blend", Range(0,1)) = 0.5
_HatchOrganicNoise ("Hatch Organic Noise", Range(0,1)) = 0.4
_HatchOrganicScale ("Hatch Organic Noise Scale", Float) = 2.0
_HatchDensityCurve ("Hatch Density Curve", Range(0.1,5)) = 2.0
_TriplanarSharpness ("Triplanar Sharpness", Range(1,8)) = 2.0
[Header(Pencil Hatching)]
_HatchColorBlend ("Hatch Color From Surface", Range(0,1)) = 0.6
_HatchDarken ("Hatch Darken Amount", Range(0,1)) = 0.75
_HatchGrainScale ("Hatch Grain Scale", Float) = 120.0
_HatchGrainStrength ("Hatch Grain Strength", Range(0,1)) = 0.3
_HatchPressure ("Hatch Pressure Variation", Range(0,1)) = 0.4
[Header(Gouache Shadow)]
_BrushTex ("Brush Texture", 2D) = "white" {}
_GouacheScale ("Gouache Scale", Float) = 0.8
_GouacheStrength ("Gouache Strength", Range(0,1)) = 0.7
_GouacheThreshold ("Gouache Shadow Threshold", Range(0,1)) = 0.35
_GouacheSaturation ("Gouache Saturation Boost", Range(0,2)) = 1.3
_GouachePosterize ("Gouache Posterize Steps", Range(1,6)) = 3.0
_GouacheBlend ("Gouache Blend With Hatch", Range(0,1)) = 0.6
}
SubShader
{
Tags { "RenderType"="Opaque" "RenderPipeline"="UniversalPipeline" }
ZWrite Off ZTest Always Cull Off
Pass
{
Name "ToonBilalPass"
HLSLPROGRAM
#pragma vertex Vert
#pragma fragment Frag
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
float _ShaderWeight;
float _ToonSteps;
float _ShadowStrength;
float _OutlineThickness;
float _OutlineThicknessVar;
float _DepthThreshold;
float _ColorThreshold;
float _DepthOutlineStrength;
float _ColorOutlineStrength;
float _OutlineSoftness;
float _OutlineColorBlend;
float _OutlineDarken;
float _OutlineFadeStart;
float _OutlineFadeEnd;
float _OutlineFadeStrength;
float _OutlineBrightMin;
float _HatchScale;
float _HatchScale2;
float _HatchStrength;
float _HatchThreshold;
float _CurvatureStrength;
float _FlatSurface;
float _HatchRotation;
float _HatchLayerBlend;
float _HatchOrganicNoise;
float _HatchOrganicScale;
float _HatchDensityCurve;
float _TriplanarSharpness;
float _HatchColorBlend;
float _HatchDarken;
float _HatchGrainScale;
float _HatchGrainStrength;
float _HatchPressure;
float _GouacheScale;
float _GouacheStrength;
float _GouacheThreshold;
float _GouacheSaturation;
float _GouachePosterize;
float _GouacheBlend;
TEXTURE2D(_HatchTex);
SAMPLER(sampler_HatchTex);
TEXTURE2D(_BrushTex);
SAMPLER(sampler_BrushTex);
// ─── NOISE ───────────────────────────────────────────────
float Hash21(float2 p)
{
p = frac(p * float2(234.34, 435.345));
p += dot(p, p + 34.23);
return frac(p.x * p.y);
}
float SmoothNoise(float2 p)
{
float2 i = floor(p);
float2 f = frac(p);
f = f * f * (3.0 - 2.0 * f);
return lerp(
lerp(Hash21(i), Hash21(i + float2(1,0)), f.x),
lerp(Hash21(i + float2(0,1)), Hash21(i + float2(1,1)), f.x),
f.y
);
}
float FBM(float2 p)
{
float v = 0.0;
float a = 0.5;
float2 shift = float2(100.0, 100.0);
for (int i = 0; i < 4; i++)
{
v += a * SmoothNoise(p);
p = p * 2.0 + shift;
a *= 0.5;
}
return v;
}
// ─── RECONSTRUCTION ──────────────────────────────────────
float3 ReconstructWorldPos(float2 uv, float depth)
{
float4 clipPos = float4(uv * 2.0 - 1.0, depth, 1.0);
#if UNITY_UV_STARTS_AT_TOP
clipPos.y = -clipPos.y;
#endif
float4 worldPos = mul(UNITY_MATRIX_I_VP, clipPos);
return worldPos.xyz / worldPos.w;
}
float3 ReconstructNormal(float2 uv, float2 texel)
{
float d0 = SampleSceneDepth(uv);
float dr = SampleSceneDepth(uv + float2(texel.x, 0));
float du = SampleSceneDepth(uv + float2(0, texel.y));
float3 p0 = ReconstructWorldPos(uv, d0);
float3 pr = ReconstructWorldPos(uv + float2(texel.x, 0), dr);
float3 pu = ReconstructWorldPos(uv + float2(0, texel.y), du);
return normalize(cross(pr - p0, pu - p0));
}
float ComputeCurvature(float2 uv, float2 texel)
{
float3 n0 = ReconstructNormal(uv, texel);
float3 nr = ReconstructNormal(uv + float2(texel.x * 2.0, 0), texel);
float3 nu = ReconstructNormal(uv + float2(0, texel.y * 2.0), texel);
float3 nl = ReconstructNormal(uv - float2(texel.x * 2.0, 0), texel);
float3 nd = ReconstructNormal(uv - float2(0, texel.y * 2.0), texel);
return saturate((length(nr-n0)+length(nu-n0)+length(nl-n0)+length(nd-n0)) * _CurvatureStrength);
}
float2 RotateUV(float2 uv, float angle)
{
float s = sin(angle);
float c = cos(angle);
return float2(uv.x * c - uv.y * s, uv.x * s + uv.y * c);
}
// ─── SATURATION ──────────────────────────────────────────
half3 AdjustSaturation(half3 col, float saturation)
{
float lum = dot(col, float3(0.299, 0.587, 0.114));
return lerp(half3(lum, lum, lum), col, saturation);
}
// ─── COULEUR CRAYON ───────────────────────────────────────
half3 PencilColor(half3 surfaceCol, float darken, float colorBlend)
{
half3 darkSurface = surfaceCol * (1.0 - darken);
return lerp(half3(0,0,0), darkSurface, colorBlend);
}
// ─── GOUACHE SHADOW ───────────────────────────────────────
half3 ApplyGouache(half3 col, float3 worldPos, float lum, float curvature)
{
// On est dans la zone sombre ?
float shadowMask = 1.0 - smoothstep(0.0, _GouacheThreshold, lum);
if (shadowMask <= 0.0) return col;
// Brush texture en triplanar pour coller aux surfaces
float2 uvBrush1 = worldPos.xz * _GouacheScale;
float2 uvBrush2 = worldPos.xy * _GouacheScale * 0.7 + float2(3.1, 7.4);
float2 uvBrush3 = worldPos.yz * _GouacheScale * 1.3 + float2(1.7, 2.9);
float b1 = SAMPLE_TEXTURE2D(_BrushTex, sampler_BrushTex, uvBrush1).r;
float b2 = SAMPLE_TEXTURE2D(_BrushTex, sampler_BrushTex, uvBrush2).r;
float b3 = SAMPLE_TEXTURE2D(_BrushTex, sampler_BrushTex, uvBrush3).r;
float brush = (b1 * 0.5 + b2 * 0.3 + b3 * 0.2);
// Posterize la couleur pour effet aplat gouache
float3 gouacheCol = col;
gouacheCol.r = floor(gouacheCol.r * _GouachePosterize) / _GouachePosterize;
gouacheCol.g = floor(gouacheCol.g * _GouachePosterize) / _GouachePosterize;
gouacheCol.b = floor(gouacheCol.b * _GouachePosterize) / _GouachePosterize;
// Boost saturation — les ombres gouache sont riches en couleur
gouacheCol = AdjustSaturation(gouacheCol, _GouacheSaturation);
// La texture de brush module l'opacité de l'aplat
// Zones où le brush est foncé = plus de gouache visible
float brushMask = 1.0 - brush * 0.5;
// Résultat final gouache
half3 result = lerp(col, gouacheCol * brushMask, shadowMask * _GouacheStrength);
return result;
}
// ─── HACHURES TRIPLANAR ───────────────────────────────────
float OrganicHatch(float3 worldPos, float3 worldNormal, float shadowAmount, float curvature, float2 screenUV)
{
float3 weights = pow(abs(worldNormal), _TriplanarSharpness);
weights /= (weights.x + weights.y + weights.z + 0.0001);
float2 uvX = worldPos.yz * _HatchScale;
float2 uvY = worldPos.xz * _HatchScale;
float2 uvZ = worldPos.xy * _HatchScale;
float2 off = float2(
FBM(uvY * _HatchOrganicScale),
FBM(uvY * _HatchOrganicScale + float2(5.2, 1.3))
) * _HatchOrganicNoise;
float grain = SmoothNoise(screenUV * _HatchGrainScale);
float pressure = SmoothNoise(screenUV * _HatchGrainScale * 0.3 + float2(3.7, 8.1));
float pressureVar = lerp(1.0, pressure * 1.5, _HatchPressure);
float h1X = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvX + off).r;
float h1Y = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvY + off).r;
float h1Z = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvZ + off).r;
float h1 = h1X * weights.x + h1Y * weights.y + h1Z * weights.z;
float2 uvX2 = RotateUV(worldPos.yz * _HatchScale2, _HatchRotation) + off * 0.5;
float2 uvY2 = RotateUV(worldPos.xz * _HatchScale2, _HatchRotation) + off * 0.5;
float2 uvZ2 = RotateUV(worldPos.xy * _HatchScale2, _HatchRotation) + off * 0.5;
float h2X = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvX2).r;
float h2Y = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvY2).r;
float h2Z = SAMPLE_TEXTURE2D(_HatchTex, sampler_HatchTex, uvZ2).r;
float h2 = h2X * weights.x + h2Y * weights.y + h2Z * weights.z;
float layerBlend = lerp(_HatchLayerBlend, 1.0, shadowAmount);
float hatch = lerp(h1, min(h1, h2), layerBlend);
hatch = saturate(hatch + grain * _HatchGrainStrength);
float shadowMask = pow(1.0 - smoothstep(0.0, _HatchThreshold, 1.0 - shadowAmount), _HatchDensityCurve);
float curvatureMask = lerp(_FlatSurface, 1.0, curvature);
return shadowMask * curvatureMask * _HatchStrength * pressureVar * (1.0 - hatch);
}
// ─── FRAGMENT ────────────────────────────────────────────
half4 Frag(Varyings input) : SV_Target
{
float2 uv = input.texcoord;
float2 texelBase = float2(1.0 / _ScreenParams.x, 1.0 / _ScreenParams.y);
half3 col = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv).rgb;
float lum = dot(col, float3(0.299, 0.587, 0.114));
// ── Outlines avec épaisseur variable
float noiseThick = SmoothNoise(uv * 80.0);
float thicknessVar = lerp(1.0, noiseThick * 2.0, _OutlineThicknessVar);
float2 texelThin = texelBase * _OutlineThickness * 0.5 * thicknessVar;
float2 texelThick = texelBase * _OutlineThickness * 1.5 * thicknessVar;
half3 cn = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv + float2(0, texelThin.y)).rgb;
half3 cs = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv - float2(0, texelThin.y)).rgb;
half3 ce = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv + float2(texelThin.x, 0)).rgb;
half3 cw = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv - float2(texelThin.x, 0)).rgb;
float lumN = dot(cn, float3(0.299, 0.587, 0.114));
float lumS = dot(cs, float3(0.299, 0.587, 0.114));
float lumE = dot(ce, float3(0.299, 0.587, 0.114));
float lumW = dot(cw, float3(0.299, 0.587, 0.114));
float lumMax = max(max(lumN, lumS), max(lumE, lumW));
float brightnessForFade = max(lum, lumMax);
half3 cn_n = normalize(cn + 0.001);
half3 cs_n = normalize(cs + 0.001);
half3 ce_n = normalize(ce + 0.001);
half3 cw_n = normalize(cw + 0.001);
float colorEdgeInner = length(cn_n - cs_n) + length(ce_n - cw_n);
half3 cnO = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv + float2(0, texelThick.y)).rgb;
half3 csO = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv - float2(0, texelThick.y)).rgb;
half3 ceO = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv + float2(texelThick.x, 0)).rgb;
half3 cwO = SAMPLE_TEXTURE2D(_BlitTexture, sampler_LinearClamp, uv - float2(texelThick.x, 0)).rgb;
float colorEdgeOuter = length(normalize(cnO+0.001) - normalize(csO+0.001)) + length(normalize(ceO+0.001) - normalize(cwO+0.001));
float colorEdge = lerp(colorEdgeInner, colorEdgeOuter * 0.5, _OutlineSoftness);
colorEdge = step(_ColorThreshold, colorEdge) * _ColorOutlineStrength;
float2 texelOutline = texelBase * _OutlineThickness * thicknessVar;
float dn = SampleSceneDepth(uv + float2(0, texelOutline.y));
float ds = SampleSceneDepth(uv - float2(0, texelOutline.y));
float de = SampleSceneDepth(uv + float2(texelOutline.x, 0));
float dw = SampleSceneDepth(uv - float2(texelOutline.x, 0));
float depthRaw = abs(dn-ds) + abs(de-dw);
float depthEdge = smoothstep(_DepthThreshold * 0.5, _DepthThreshold * 2.0, depthRaw) * _DepthOutlineStrength;
depthEdge *= 1.0 - smoothstep(0.5, 0.85, brightnessForFade);
float edge = saturate(depthEdge + colorEdge);
// ── Toon shading
float toon = floor(lum * _ToonSteps) / _ToonSteps;
toon = lerp(_ShadowStrength, 1.0, toon);
half3 toonCol = col * toon;
// ── World space
float depth = SampleSceneDepth(uv);
float3 worldPos = ReconstructWorldPos(uv, depth);
float3 worldNormal = ReconstructNormal(uv, texelBase);
float curvature = ComputeCurvature(uv, texelBase);
// ── Gouache dans les zones sombres — appliqué avant les hachures
toonCol = ApplyGouache(toonCol, worldPos, lum, curvature);
// ── Hachures par dessus la gouache
float shadowAmount = 1.0 - lum;
float hatchBlend = OrganicHatch(worldPos, worldNormal, shadowAmount, curvature, uv);
// Dans les zones très sombres on réduit les hachures (la gouache prend le relais)
float gouacheMask = 1.0 - smoothstep(0.0, _GouacheThreshold, lum);
hatchBlend *= lerp(1.0, 1.0 - _GouacheBlend, gouacheMask);
half3 hatchCol = PencilColor(col, _HatchDarken, _HatchColorBlend);
toonCol = lerp(toonCol, hatchCol, hatchBlend);
// ── Outline fade
float outlineFade = lerp(_OutlineBrightMin, 1.0, 1.0 - smoothstep(_OutlineFadeStart, _OutlineFadeEnd, brightnessForFade));
outlineFade = lerp(1.0, outlineFade, _OutlineFadeStrength);
half3 outlineCol = PencilColor(col, _OutlineDarken, _OutlineColorBlend);
half3 finalCol = lerp(toonCol, outlineCol, edge * outlineFade);
// ── Weight global
finalCol = lerp(col, finalCol, _ShaderWeight);
return half4(finalCol, 1);
}
ENDHLSL
}
}
}
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7bf79ab0a43c48d4a8f816a1257f7f14
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 36a9a173a2a7d094fb3ececebed3bd2f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 89e1724c0e0e07341a192033399748fd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
@@ -0,0 +1,111 @@
fileFormatVersion: 2
guid: f87d53fcaf34530488b706ee35d9b519
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 0
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 1
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 1
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 1
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 187485
packageName: URP Stylized Water Shader - Proto Series
packageVersion: 1.0
assetPath: Assets/Bitgem/StylisedWater/URP/Textures/waves_n.png
uploadId: 412673
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 2cddf2ee6a74aca44af00f5a49bd2cf1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}
AssetOrigin:
serializedVersion: 1
productId: 187485
packageName: URP Stylized Water Shader - Proto Series
packageVersion: 1.0
assetPath: Assets/Bitgem/StylisedWater/URP/Shaders/WaterVolume-URP.shadergraph
uploadId: 412673