Initial commit
This commit is contained in:
93
extracted/assets/soupapi/shaders/hand/balatro.fsh
Normal file
93
extracted/assets/soupapi/shaders/hand/balatro.fsh
Normal file
@@ -0,0 +1,93 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform vec3 color1; // Main Color
|
||||
uniform vec3 color2; // Color 2
|
||||
uniform vec3 color3; // Color 3
|
||||
uniform vec3 color4; // contrast/lighting params
|
||||
|
||||
// Balatro-style effect configuration
|
||||
#define SPIN_ROTATION -2.0
|
||||
#define SPIN_SPEED 7.0
|
||||
#define OFFSET vec2(0.0)
|
||||
#define SPIN_AMOUNT 0.25
|
||||
#define PIXEL_FILTER 745.0
|
||||
#define SPIN_EASE 1.0
|
||||
#define PI 3.14159265359
|
||||
#define IS_ROTATE false
|
||||
|
||||
vec4 effect(vec2 screenSize, vec2 screen_coords, float contrast, float lighting) {
|
||||
float pixel_size = length(screenSize.xy) / PIXEL_FILTER;
|
||||
vec2 effectUv = (floor(screen_coords.xy*(1./pixel_size))*pixel_size - 0.5*screenSize.xy)/length(screenSize.xy) - OFFSET;
|
||||
float uv_len = length(effectUv);
|
||||
|
||||
float speed = (SPIN_ROTATION*SPIN_EASE*0.2);
|
||||
if(IS_ROTATE){
|
||||
speed = time * speed;
|
||||
}
|
||||
speed += 302.2;
|
||||
float new_pixel_angle = atan(effectUv.y, effectUv.x) + speed - SPIN_EASE*20.*(1.*SPIN_AMOUNT*uv_len + (1. - 1.*SPIN_AMOUNT));
|
||||
vec2 mid = (screenSize.xy/length(screenSize.xy))/2.;
|
||||
effectUv = (vec2((uv_len * cos(new_pixel_angle) + mid.x), (uv_len * sin(new_pixel_angle) + mid.y)) - mid);
|
||||
|
||||
effectUv *= 30.;
|
||||
speed = time*(SPIN_SPEED);
|
||||
vec2 uv2 = vec2(effectUv.x+effectUv.y);
|
||||
|
||||
for(int i=0; i < 5; i++) {
|
||||
uv2 += sin(max(effectUv.x, effectUv.y)) + effectUv;
|
||||
effectUv += 0.5*vec2(cos(5.1123314 + 0.353*uv2.y + speed*0.131121),sin(uv2.x - 0.113*speed));
|
||||
effectUv -= 1.0*cos(effectUv.x + effectUv.y) - 1.0*sin(effectUv.x*0.711 - effectUv.y);
|
||||
}
|
||||
|
||||
float contrast_mod = (0.25*contrast + 0.5*SPIN_AMOUNT + 1.2);
|
||||
float paint_res = min(2., max(0.,length(effectUv)*(0.035)*contrast_mod));
|
||||
float c1p = max(0.,1. - contrast_mod*abs(1.-paint_res));
|
||||
float c2p = max(0.,1. - contrast_mod*abs(paint_res));
|
||||
float c3p = 1. - min(1., c1p + c2p);
|
||||
float light = (lighting - 0.2)*max(c1p*5. - 4., 0.) + lighting*max(c2p*5. - 4., 0.);
|
||||
|
||||
vec4 colour1 = vec4(color1, 1.0);
|
||||
vec4 colour2 = vec4(color2, 1.0);
|
||||
vec4 colour3 = vec4(color3, 1.0);
|
||||
|
||||
return (0.3/contrast)*colour1 + (1. - 0.3/contrast)*(colour1*c1p + colour2*c2p + vec4(c3p*colour3.rgb, c3p*colour1.a)) + light;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Extract contrast and lighting from color4
|
||||
float contrast = color4.r * 10.0; // map 0-1 to 0-10
|
||||
float lighting = color4.g; // 0-1
|
||||
|
||||
// Apply Balatro-style effect
|
||||
vec4 effectColor = effect(resolution, uv * resolution, contrast, lighting);
|
||||
|
||||
// Mix original color with effect
|
||||
vec4 finalHandColor = mix(originalColor, effectColor, 0.85);
|
||||
|
||||
outColor = vec4(finalHandColor.rgb, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/balatro.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/balatro.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
98
extracted/assets/soupapi/shaders/hand/blend.fsh
Normal file
98
extracted/assets/soupapi/shaders/hand/blend.fsh
Normal file
@@ -0,0 +1,98 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D Shader1Texture;
|
||||
uniform sampler2D Shader2Texture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform int blendMode; // 0=Mix, 1=Add, 2=Multiply, 3=Screen, 4=Overlay, 5=Difference
|
||||
uniform float blendIntensity;
|
||||
uniform float shader1Strength;
|
||||
uniform float shader2Strength;
|
||||
|
||||
// Mix blend mode
|
||||
vec3 blendMix(vec3 base, vec3 blend, float intensity) {
|
||||
return mix(base, blend, intensity);
|
||||
}
|
||||
|
||||
// Add blend mode
|
||||
vec3 blendAdd(vec3 base, vec3 blend) {
|
||||
return min(base + blend, vec3(1.0));
|
||||
}
|
||||
|
||||
// Multiply blend mode
|
||||
vec3 blendMultiply(vec3 base, vec3 blend) {
|
||||
return base * blend;
|
||||
}
|
||||
|
||||
// Screen blend mode
|
||||
vec3 blendScreen(vec3 base, vec3 blend) {
|
||||
return vec3(1.0) - (vec3(1.0) - base) * (vec3(1.0) - blend);
|
||||
}
|
||||
|
||||
// Overlay blend mode
|
||||
vec3 blendOverlay(vec3 base, vec3 blend) {
|
||||
vec3 result;
|
||||
result.r = base.r < 0.5 ? (2.0 * base.r * blend.r) : (1.0 - 2.0 * (1.0 - base.r) * (1.0 - blend.r));
|
||||
result.g = base.g < 0.5 ? (2.0 * base.g * blend.g) : (1.0 - 2.0 * (1.0 - base.g) * (1.0 - blend.g));
|
||||
result.b = base.b < 0.5 ? (2.0 * base.b * blend.b) : (1.0 - 2.0 * (1.0 - base.b) * (1.0 - blend.b));
|
||||
return result;
|
||||
}
|
||||
|
||||
// Difference blend mode
|
||||
vec3 blendDifference(vec3 base, vec3 blend) {
|
||||
return abs(base - blend);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 shader1Color = texture(Shader1Texture, uv);
|
||||
vec4 shader2Color = texture(Shader2Texture, uv);
|
||||
|
||||
// Optimized depth mask - cross pattern
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Apply strength modifiers
|
||||
vec3 color1 = shader1Color.rgb * shader1Strength;
|
||||
vec3 color2 = shader2Color.rgb * shader2Strength;
|
||||
|
||||
// Apply blend mode
|
||||
vec3 blendedColor;
|
||||
|
||||
if (blendMode == 0) {
|
||||
// Mix
|
||||
blendedColor = blendMix(color1, color2, blendIntensity);
|
||||
} else if (blendMode == 1) {
|
||||
// Add
|
||||
blendedColor = mix(color1, blendAdd(color1, color2), blendIntensity);
|
||||
} else if (blendMode == 2) {
|
||||
// Multiply
|
||||
blendedColor = mix(color1, blendMultiply(color1, color2), blendIntensity);
|
||||
} else if (blendMode == 3) {
|
||||
// Screen
|
||||
blendedColor = mix(color1, blendScreen(color1, color2), blendIntensity);
|
||||
} else if (blendMode == 4) {
|
||||
// Overlay
|
||||
blendedColor = mix(color1, blendOverlay(color1, color2), blendIntensity);
|
||||
} else if (blendMode == 5) {
|
||||
// Difference
|
||||
blendedColor = mix(color1, blendDifference(color1, color2), blendIntensity);
|
||||
} else {
|
||||
blendedColor = color1;
|
||||
}
|
||||
|
||||
outColor = vec4(blendedColor, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/blend.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/blend.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
67
extracted/assets/soupapi/shaders/hand/chroma.fsh
Normal file
67
extracted/assets/soupapi/shaders/hand/chroma.fsh
Normal file
@@ -0,0 +1,67 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform float chromaSpeed;
|
||||
uniform float chromaSaturation;
|
||||
uniform float chromaBrightness;
|
||||
|
||||
// HSV to RGB conversion
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
// Create rainbow effect
|
||||
vec3 createChromaEffect(vec2 coord, float t) {
|
||||
// Combine vertical and horizontal gradients for more dynamic effect
|
||||
float hue = fract(coord.y * 0.5 + coord.x * 0.3 + t * chromaSpeed);
|
||||
|
||||
// Add wave pattern for more visual interest
|
||||
float wave = sin(coord.y * 10.0 + t * 3.0) * 0.05;
|
||||
hue += wave;
|
||||
|
||||
// Convert HSV to RGB
|
||||
vec3 chromaColor = hsv2rgb(vec3(hue, chromaSaturation, chromaBrightness));
|
||||
|
||||
return chromaColor;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Create chroma effect
|
||||
vec3 chromaColor = createChromaEffect(uv, time);
|
||||
|
||||
// Add slight pulsing to make it more alive
|
||||
float pulse = 0.9 + sin(time * 4.0) * 0.1;
|
||||
chromaColor *= pulse;
|
||||
|
||||
vec4 effectColor = vec4(chromaColor, 1.0);
|
||||
|
||||
// Mix original color with chroma effect
|
||||
vec4 finalHandColor = mix(originalColor, effectColor, 0.85);
|
||||
|
||||
outColor = vec4(finalHandColor.rgb, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/chroma.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/chroma.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
184
extracted/assets/soupapi/shaders/hand/glass.fsh
Normal file
184
extracted/assets/soupapi/shaders/hand/glass.fsh
Normal file
@@ -0,0 +1,184 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
|
||||
// Glass settings
|
||||
uniform float blurSize;
|
||||
uniform float quality;
|
||||
uniform float direction;
|
||||
uniform float refraction;
|
||||
uniform float brightness;
|
||||
uniform bool enableChromatic;
|
||||
uniform bool enableDistortion;
|
||||
uniform bool hideHand;
|
||||
|
||||
// Background effect settings (when hand is hidden)
|
||||
uniform float backgroundBlur;
|
||||
|
||||
#define PI 3.14159265
|
||||
|
||||
// Optimized liquid glass blur - reduced samples
|
||||
vec4 liquidGlassBlur(sampler2D tex, vec2 uv, float dir, float qual, float size) {
|
||||
vec2 radius = (size / resolution.y) / resolution;
|
||||
vec4 color = texture(tex, uv);
|
||||
float total = 1.0;
|
||||
|
||||
// Clamp quality and direction for performance
|
||||
float optQual = min(qual, 6.0); // Max 6 samples per direction
|
||||
float optDir = min(dir, 8.0); // Max 8 directions
|
||||
|
||||
float angleStep = PI / optDir;
|
||||
float radiusStep = 1.0 / optQual;
|
||||
|
||||
for (float d = 0.0; d < PI; d += angleStep) {
|
||||
vec2 direction = vec2(cos(d), sin(d));
|
||||
for (float i = radiusStep; i <= 1.0; i += radiusStep) {
|
||||
vec2 offset = direction * radius * i;
|
||||
color += texture(tex, uv + offset);
|
||||
total += 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
return color / total;
|
||||
}
|
||||
|
||||
// Optimized matte blur - reduced samples
|
||||
vec4 matteBlur(sampler2D tex, vec2 uv, float blurRadius) {
|
||||
const float TAU = 6.28318530718;
|
||||
vec2 radius = blurRadius / resolution.xy;
|
||||
vec4 blur = texture(tex, uv);
|
||||
|
||||
float step = TAU / 8.0; // 8 directions instead of 16
|
||||
|
||||
for (float d = 0.0; d < TAU; d += step) {
|
||||
vec2 dir = vec2(cos(d), sin(d));
|
||||
for (float i = 0.33; i <= 1.0; i += 0.33) { // 3 samples instead of 5
|
||||
blur += texture(tex, uv + dir * radius * i);
|
||||
}
|
||||
}
|
||||
|
||||
blur /= 25.0; // 8 directions * 3 samples + 1 center = 25
|
||||
return blur;
|
||||
}
|
||||
|
||||
// Distortion pattern for glass effect
|
||||
vec2 glassDistortion(vec2 uv, float time, float strength) {
|
||||
// Animated wave distortion
|
||||
float wave1 = sin(uv.y * 10.0 + time * 2.0) * 0.01 * strength;
|
||||
float wave2 = cos(uv.x * 8.0 - time * 1.5) * 0.01 * strength;
|
||||
|
||||
// Radial distortion from center
|
||||
vec2 center = vec2(0.5, 0.5);
|
||||
vec2 toCenter = uv - center;
|
||||
float dist = length(toCenter);
|
||||
vec2 radial = toCenter * sin(dist * 15.0 - time * 3.0) * 0.005 * strength;
|
||||
|
||||
return vec2(wave1 + radial.x, wave2 + radial.y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - reduced from 9 to 5 samples (cross pattern)
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Apply glass distortion (if enabled)
|
||||
vec2 distortedUV = uv;
|
||||
if (enableDistortion) {
|
||||
distortedUV += glassDistortion(uv, time, refraction);
|
||||
}
|
||||
|
||||
// Sample the hand texture with distortion applied
|
||||
// Note: If hideHand is enabled, hand is not drawn to color buffer (only depth)
|
||||
// via colorMask(false,false,false,false) in GameRendererMixin
|
||||
vec4 handColor = texture(ColorTexture, distortedUV);
|
||||
|
||||
// Create glass effect
|
||||
vec3 glassColor;
|
||||
|
||||
if (centerDepth < 0.99) {
|
||||
// This is hand area
|
||||
if (hideHand) {
|
||||
// Hand is hidden - apply background effects
|
||||
vec2 bgUV = uv;
|
||||
|
||||
// Apply background blur (use matte blur for frosted glass effect)
|
||||
if (backgroundBlur > 0.1) {
|
||||
glassColor = matteBlur(ColorTexture, bgUV, backgroundBlur).rgb;
|
||||
} else {
|
||||
glassColor = texture(ColorTexture, bgUV).rgb;
|
||||
}
|
||||
|
||||
// Apply brightness
|
||||
glassColor *= brightness;
|
||||
|
||||
} else {
|
||||
// Hand is visible - apply glass effect to hand texture
|
||||
glassColor = liquidGlassBlur(ColorTexture, distortedUV, direction, quality, blurSize).rgb;
|
||||
|
||||
// Add chromatic aberration for glass effect (if enabled)
|
||||
if (enableChromatic) {
|
||||
float aberration = 0.003 * refraction;
|
||||
float r = liquidGlassBlur(ColorTexture, distortedUV + vec2(aberration, 0.0), direction, quality, blurSize * 0.5).r;
|
||||
float b = liquidGlassBlur(ColorTexture, distortedUV - vec2(aberration, 0.0), direction, quality, blurSize * 0.5).b;
|
||||
glassColor.r = r;
|
||||
glassColor.b = b;
|
||||
}
|
||||
|
||||
// Apply brightness to glass effect
|
||||
glassColor *= brightness;
|
||||
}
|
||||
} else {
|
||||
// Not hand area - just use original
|
||||
glassColor = handColor.rgb;
|
||||
}
|
||||
|
||||
// Optimized edge highlights - use cross pattern instead of 3x3
|
||||
float edgeStrength = 0.0;
|
||||
if (centerDepth < 0.99) {
|
||||
float right = texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r;
|
||||
float left = texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r;
|
||||
float top = texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r;
|
||||
float bottom = texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r;
|
||||
|
||||
if (right > 0.99) edgeStrength += 1.0;
|
||||
if (left > 0.99) edgeStrength += 1.0;
|
||||
if (top > 0.99) edgeStrength += 1.0;
|
||||
if (bottom > 0.99) edgeStrength += 1.0;
|
||||
|
||||
edgeStrength = clamp(edgeStrength * 0.15, 0.0, 1.0);
|
||||
}
|
||||
|
||||
// Add edge highlights
|
||||
vec3 highlight = vec3(1.0) * edgeStrength * 0.3;
|
||||
glassColor += highlight;
|
||||
|
||||
// Subtle reflection effect
|
||||
float reflection = sin(time * 2.0 + uv.x * 20.0) * 0.5 + 0.5;
|
||||
reflection *= sin(time * 1.5 + uv.y * 15.0) * 0.5 + 0.5;
|
||||
glassColor += vec3(reflection * 0.1);
|
||||
|
||||
// Mix distorted hand texture with glass effect
|
||||
vec3 finalColor = mix(handColor.rgb, glassColor, 0.7);
|
||||
|
||||
outColor = vec4(finalColor, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/glass.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/glass.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
103
extracted/assets/soupapi/shaders/hand/glow.fsh
Normal file
103
extracted/assets/soupapi/shaders/hand/glow.fsh
Normal file
@@ -0,0 +1,103 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
|
||||
// Glow settings
|
||||
uniform bool fillGlow;
|
||||
uniform float glowRadius;
|
||||
uniform float glowPower;
|
||||
uniform float glowDispersion;
|
||||
uniform vec3 glowColor;
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Optimized edge detection and glow with limited dispersion
|
||||
float edgeStrength = 0.0;
|
||||
float outwardGlow = 0.0;
|
||||
|
||||
// Clamp dispersion to max 5 for performance (instead of 10)
|
||||
int disperseRadius = min(int(glowDispersion), 5);
|
||||
|
||||
// Use optimized circular sampling pattern instead of full square
|
||||
for (int ring = 1; ring <= disperseRadius; ring++) {
|
||||
float angle = 0.0;
|
||||
float angleStep = 0.785398; // 45 degrees in radians (8 directions)
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
vec2 offset = vec2(cos(angle), sin(angle)) * float(ring) * texelSize;
|
||||
float neighborDepth = texture(DepthTexture, uv + offset).r;
|
||||
|
||||
float dist = float(ring);
|
||||
|
||||
// Edge detection
|
||||
if (neighborDepth > 0.99 && centerDepth < 0.99) {
|
||||
edgeStrength += (1.0 / (dist + 0.1));
|
||||
}
|
||||
|
||||
// Outward glow
|
||||
if (centerDepth > 0.99 && neighborDepth < 0.99) {
|
||||
float falloff = 1.0 - (dist / float(disperseRadius));
|
||||
falloff = pow(falloff, 2.5);
|
||||
outwardGlow += falloff * 0.2;
|
||||
}
|
||||
|
||||
angle += angleStep;
|
||||
}
|
||||
}
|
||||
|
||||
// Normalize edge strength
|
||||
edgeStrength = clamp(edgeStrength * 0.15, 0.0, 1.0);
|
||||
outwardGlow = clamp(outwardGlow, 0.0, 1.0);
|
||||
|
||||
// Create animated glow effect with brighter pulse
|
||||
float pulse = 0.9 + sin(time * 2.0) * 0.1;
|
||||
|
||||
vec3 finalColor;
|
||||
|
||||
// Apply outward glow effect (for background pixels near hands)
|
||||
if (centerDepth > 0.99 && outwardGlow > 0.01) {
|
||||
// We're in background but near a hand - render glow
|
||||
vec3 dispersedGlow = glowColor * outwardGlow * glowPower * pulse * glowRadius * 10.0;
|
||||
outColor = vec4(dispersedGlow, outwardGlow * 0.8);
|
||||
return;
|
||||
}
|
||||
|
||||
// For hand pixels
|
||||
if (fillGlow) {
|
||||
// Fill mode: apply glow color to entire hand with edge enhancement
|
||||
vec3 handGlow = glowColor * (glowRadius * 10.0); // glowRadius controls intensity
|
||||
vec3 edgeGlow = glowColor * edgeStrength * glowPower * pulse * 2.5;
|
||||
|
||||
finalColor = mix(originalColor.rgb, handGlow + edgeGlow, 0.75);
|
||||
} else {
|
||||
// Outline mode: only glow on edges
|
||||
vec3 edgeGlow = glowColor * edgeStrength * glowPower * pulse * glowRadius * 25.0; // glowRadius controls intensity
|
||||
|
||||
finalColor = originalColor.rgb + edgeGlow;
|
||||
}
|
||||
|
||||
outColor = vec4(finalColor, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/glow.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/glow.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
140
extracted/assets/soupapi/shaders/hand/invert.fsh
Normal file
140
extracted/assets/soupapi/shaders/hand/invert.fsh
Normal file
@@ -0,0 +1,140 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
|
||||
// Invert settings
|
||||
uniform bool hideHand;
|
||||
uniform float invertIntensity;
|
||||
uniform bool invertHue;
|
||||
uniform bool invertSaturation;
|
||||
uniform bool invertBrightness;
|
||||
uniform float edgeGlow;
|
||||
uniform vec3 glowColor;
|
||||
|
||||
// RGB to HSV conversion
|
||||
vec3 rgb2hsv(vec3 c) {
|
||||
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
|
||||
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
// HSV to RGB conversion
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 finalColor;
|
||||
|
||||
if (centerDepth < 0.99) {
|
||||
// This is hand area
|
||||
if (hideHand) {
|
||||
// Hand is hidden - apply invert to background
|
||||
vec3 bgColor = originalColor.rgb;
|
||||
|
||||
if (invertHue || invertSaturation || invertBrightness) {
|
||||
// Advanced invert using HSV
|
||||
vec3 hsv = rgb2hsv(bgColor);
|
||||
|
||||
if (invertHue) {
|
||||
hsv.x = fract(hsv.x + 0.5); // Shift hue by 180 degrees
|
||||
}
|
||||
if (invertSaturation) {
|
||||
hsv.y = 1.0 - hsv.y; // Invert saturation
|
||||
}
|
||||
if (invertBrightness) {
|
||||
hsv.z = 1.0 - hsv.z; // Invert brightness
|
||||
}
|
||||
|
||||
finalColor = mix(bgColor, hsv2rgb(hsv), invertIntensity);
|
||||
} else {
|
||||
// Simple RGB invert
|
||||
vec3 inverted = vec3(1.0) - bgColor;
|
||||
finalColor = mix(bgColor, inverted, invertIntensity);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Hand is visible - invert the hand texture
|
||||
vec3 handColor = originalColor.rgb;
|
||||
|
||||
if (invertHue || invertSaturation || invertBrightness) {
|
||||
// Advanced invert using HSV
|
||||
vec3 hsv = rgb2hsv(handColor);
|
||||
|
||||
if (invertHue) {
|
||||
hsv.x = fract(hsv.x + 0.5);
|
||||
}
|
||||
if (invertSaturation) {
|
||||
hsv.y = 1.0 - hsv.y;
|
||||
}
|
||||
if (invertBrightness) {
|
||||
hsv.z = 1.0 - hsv.z;
|
||||
}
|
||||
|
||||
finalColor = mix(handColor, hsv2rgb(hsv), invertIntensity);
|
||||
} else {
|
||||
// Simple RGB invert
|
||||
vec3 inverted = vec3(1.0) - handColor;
|
||||
finalColor = mix(handColor, inverted, invertIntensity);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Not hand area - just use original
|
||||
finalColor = originalColor.rgb;
|
||||
}
|
||||
|
||||
// Add edge glow if enabled
|
||||
if (edgeGlow > 0.01 && centerDepth < 0.99) {
|
||||
float edgeStrength = 0.0;
|
||||
|
||||
float right = texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r;
|
||||
float left = texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r;
|
||||
float top = texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r;
|
||||
float bottom = texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r;
|
||||
|
||||
if (right > 0.99) edgeStrength += 1.0;
|
||||
if (left > 0.99) edgeStrength += 1.0;
|
||||
if (top > 0.99) edgeStrength += 1.0;
|
||||
if (bottom > 0.99) edgeStrength += 1.0;
|
||||
|
||||
edgeStrength = clamp(edgeStrength * 0.25, 0.0, 1.0);
|
||||
|
||||
// Pulsing effect
|
||||
float pulse = 0.8 + sin(time * 3.0) * 0.2;
|
||||
vec3 glow = glowColor * edgeStrength * edgeGlow * pulse;
|
||||
|
||||
finalColor += glow;
|
||||
}
|
||||
|
||||
outColor = vec4(finalColor, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/invert.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/invert.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
50
extracted/assets/soupapi/shaders/hand/smoke.fsh
Normal file
50
extracted/assets/soupapi/shaders/hand/smoke.fsh
Normal file
@@ -0,0 +1,50 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform vec3 smokeColor;
|
||||
uniform float smokeIntensity;
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Optimized smoke effect - reduced iterations from 10 to 6
|
||||
vec2 smokeUv = (2.0 * uv - 1.0) * resolution.y / min(resolution.x, resolution.y);
|
||||
|
||||
for(float i = 1.0; i < 7.0; i++){
|
||||
smokeUv.x += 0.6 / i * cos(i * 2.5 * smokeUv.y + time);
|
||||
smokeUv.y += 0.6 / i * cos(i * 1.5 * smokeUv.x + time);
|
||||
}
|
||||
|
||||
// Create smoke pattern
|
||||
float smokePattern = 0.1 / abs(sin(time - smokeUv.y - smokeUv.x));
|
||||
vec3 col = smokeColor * smokePattern * smokeIntensity;
|
||||
|
||||
vec4 effectColor = vec4(col, 1.0);
|
||||
|
||||
// Mix original color with smoke effect
|
||||
vec4 finalHandColor = mix(originalColor, effectColor, 0.85);
|
||||
|
||||
outColor = vec4(finalHandColor.rgb, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/smoke.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/smoke.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
175
extracted/assets/soupapi/shaders/hand/snow.fsh
Normal file
175
extracted/assets/soupapi/shaders/hand/snow.fsh
Normal file
@@ -0,0 +1,175 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform vec3 snowColor;
|
||||
uniform float snowIntensity;
|
||||
uniform float snowSpeed;
|
||||
|
||||
#define pi 3.14159265359
|
||||
|
||||
// Optimized snow parameters - reduced from 500 to 150 flakes
|
||||
const int nbFlakes = 150;
|
||||
const vec3 flakedomain = vec3(2.5, 3.0, 2.5);
|
||||
const float flakeMinSpeed = 0.8;
|
||||
const float flakeMaxSpeed = 2.0;
|
||||
const float flakeMinSinVariation = 0.015;
|
||||
const float flakeMaxSinVariation = 0.035;
|
||||
const float flakeMinFreq = 3.0;
|
||||
const float flakeMaxFreq = 8.0;
|
||||
const vec2 flakeWindFact = vec2(0.25, 0.05);
|
||||
|
||||
// Star parameters
|
||||
const float starNbBranches = 6.0;
|
||||
const float starPow = 1.5;
|
||||
const float starStrength = 1.0;
|
||||
|
||||
vec2 rotateVec(vec2 vect, float angle) {
|
||||
vec2 rv;
|
||||
rv.x = vect.x * cos(angle) - vect.y * sin(angle);
|
||||
rv.y = vect.x * sin(angle) + vect.y * cos(angle);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// 1D hash function
|
||||
float hash(float n) {
|
||||
return fract(sin(n) * 753.5453123);
|
||||
}
|
||||
|
||||
float rand(float minVal, float maxVal, float seed) {
|
||||
return minVal + (maxVal - minVal) * hash(seed);
|
||||
}
|
||||
|
||||
vec3 getFlakePosition(int flakeNr, float t) {
|
||||
float fn = float(flakeNr);
|
||||
float s = rand(flakeMinSpeed, flakeMaxSpeed, fn * 348.0 + 173.0) * snowSpeed;
|
||||
float posY = mod(-(t + 15.0 * hash(fn * 1613.0 + 1354.0)) * s, flakedomain.y * 2.0) - flakedomain.y;
|
||||
float posX = rand(-flakedomain.x, flakedomain.x, fn * 743.0 + 514.0) + posY * flakeWindFact.x;
|
||||
float posZ = rand(-flakedomain.z, flakedomain.z, fn * 284.0 + 483.0) + posY * flakeWindFact.y;
|
||||
|
||||
// Sin movement
|
||||
float sinvar = rand(flakeMinSinVariation, flakeMaxSinVariation, fn * 842.0 + 951.0);
|
||||
float sinfreq = rand(flakeMinFreq, flakeMaxFreq, fn * 348.0 + 173.0);
|
||||
float dd = hash(fn * 235.0 + 934.0);
|
||||
posX += sinvar * sin(t * sinfreq) * dd;
|
||||
posZ += sinvar * sin(t * sinfreq) * sqrt(1.0 - dd * dd);
|
||||
|
||||
return vec3(posX, posY, posZ);
|
||||
}
|
||||
|
||||
float nppow(float x, float p) {
|
||||
return sign(x) * pow(abs(x), p);
|
||||
}
|
||||
|
||||
float getSnowProfile(float val, float dist, vec3 fpos, vec3 ray, vec3 campos, int flakeNr) {
|
||||
float val2 = -log(1.0 - val);
|
||||
|
||||
// Star flakes - 3D to 2D projection for star shape
|
||||
if (dist < 1.5) {
|
||||
vec3 v3 = (fpos - campos) - dot((fpos - campos), ray) * ray;
|
||||
vec3 vx = vec3(1.0, 0.0, 0.0);
|
||||
vx.xy = rotateVec(vx.xy, 2.0 * float(flakeNr) * 152.5 + time * 0.4);
|
||||
vx = normalize(vx - dot(vx, ray) * ray);
|
||||
vec3 vy = vec3(ray.y * vx.z - ray.z * vx.y, ray.z * vx.x - ray.x * vx.z, ray.x * vx.y - ray.y * vx.x);
|
||||
|
||||
float a = atan(dot(v3, vx), dot(v3, vy));
|
||||
|
||||
float spp = 1.0 + starStrength * nppow(sin(a * starNbBranches), starPow);
|
||||
val2 += 1.3 * spp * pow(smoothstep(1.6, 0.1, dist), 2.0);
|
||||
}
|
||||
|
||||
float delta = 1.5 - 0.9 / pow(dist + 1.0, 0.3);
|
||||
float midpoint = 10.0 / pow(dist + 0.1, 0.3);
|
||||
float pr = smoothstep(midpoint - delta * 0.5, midpoint + delta * 0.5, val2);
|
||||
|
||||
float d = 1.0 - pow(abs(1.0 - 2.0 * pr), 2.0);
|
||||
float f = 1.3 / pow(dist + 0.8, 2.5);
|
||||
|
||||
// Diffraction effect
|
||||
if (val2 < 8.0) {
|
||||
pr += 32.0 * pow(f, 1.5) * max(0.0, dist - 2.0) * d * (0.5 + sin(val2 * 230.0 / (3.8 + dist) - midpoint * 90.0) * 0.5);
|
||||
}
|
||||
|
||||
return pr * f;
|
||||
}
|
||||
|
||||
vec3 getFlakes(vec3 ray, vec3 campos) {
|
||||
vec3 rc1 = vec3(0.0);
|
||||
vec3 rc2 = vec3(0.0);
|
||||
vec3 fpos;
|
||||
float lp;
|
||||
|
||||
for (int l = 0; l < nbFlakes; l++) {
|
||||
fpos = getFlakePosition(l, time);
|
||||
|
||||
float val = max(0.0, dot(ray, normalize(fpos - campos)));
|
||||
if (val > 0.996) {
|
||||
vec3 camtarget = vec3(0.0, 0.0, 0.0);
|
||||
float dist1 = distance(camtarget, fpos);
|
||||
float dist2 = distance(campos, fpos);
|
||||
float dist = max(5.2 * pow(dist1 / dist2, 1.7), 0.32);
|
||||
lp = getSnowProfile(val, dist, fpos, ray, campos, l);
|
||||
|
||||
// Fog
|
||||
const float fogdens = 0.08;
|
||||
lp *= clamp(exp(-pow(fogdens * dist2, 2.0)), 0.0, 1.0);
|
||||
|
||||
// Flakes appear progressively
|
||||
lp *= smoothstep(-flakedomain.y, -flakedomain.y * 0.75, fpos.y);
|
||||
lp *= smoothstep(flakedomain.y, flakedomain.y * 0.75, fpos.y);
|
||||
|
||||
rc1 += clamp(normalize(mix(snowColor, vec3(1.0), 0.55 * lp)) * lp, 0.0, 1.0);
|
||||
rc2 = max(rc2, clamp(normalize(mix(snowColor, vec3(1.0), 0.55 * lp)) * lp, 0.0, 1.0));
|
||||
}
|
||||
}
|
||||
return mix(rc1, rc2, 0.7);
|
||||
}
|
||||
|
||||
vec3 getCameraRayDir(vec2 vWindow) {
|
||||
float fov = 3.8;
|
||||
vec3 vForward = normalize(vec3(0.0, 0.0, -1.0));
|
||||
vec3 vRight = normalize(cross(vec3(0.0, 1.0, 0.0), vForward));
|
||||
vec3 vUp = normalize(cross(vForward, vRight));
|
||||
|
||||
return normalize(vWindow.x * vRight + vWindow.y * vUp + vForward * fov);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Setup camera and ray
|
||||
vec2 screenUv = uv * 2.0 - 1.0;
|
||||
screenUv.x *= resolution.x / resolution.y;
|
||||
vec3 ray = getCameraRayDir(screenUv);
|
||||
vec3 campos = vec3(0.0, 0.0, 3.5);
|
||||
|
||||
// Get snow flakes
|
||||
vec3 flakes = getFlakes(ray, campos);
|
||||
flakes *= snowIntensity * 1.8;
|
||||
|
||||
// Mix with original color
|
||||
vec3 finalColor = originalColor.rgb + flakes;
|
||||
|
||||
outColor = vec4(finalColor, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/snow.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/snow.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
51
extracted/assets/soupapi/shaders/hand/solid.fsh
Normal file
51
extracted/assets/soupapi/shaders/hand/solid.fsh
Normal file
@@ -0,0 +1,51 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec3 customColor1;
|
||||
uniform vec3 customColor2;
|
||||
|
||||
uniform float effectAlpha;
|
||||
|
||||
vec3 createVerticalGradient(vec2 coord, vec3 color1, vec3 color2, float t) {
|
||||
float factor = coord.y + t;
|
||||
|
||||
factor = sin(factor * 3.14159 * 2.0) * 0.5 + 0.5;
|
||||
|
||||
return mix(color1, color2, factor);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
vec3 gradientColor = createVerticalGradient(uv, customColor1, customColor2, time);
|
||||
|
||||
float brightness = 0.85 + sin(time * 6.28318) * 0.15;
|
||||
gradientColor *= brightness;
|
||||
|
||||
vec4 effectColor = vec4(gradientColor, 1.0);
|
||||
|
||||
vec4 finalHandColor = mix(originalColor, effectColor, effectAlpha);
|
||||
|
||||
outColor = vec4(finalHandColor.rgb, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/solid.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/solid.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
50
extracted/assets/soupapi/shaders/hand/stripes.fsh
Normal file
50
extracted/assets/soupapi/shaders/hand/stripes.fsh
Normal file
@@ -0,0 +1,50 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 uv;
|
||||
out vec4 outColor;
|
||||
|
||||
uniform sampler2D ColorTexture;
|
||||
uniform sampler2D DepthTexture;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
uniform vec3 stripesColor1;
|
||||
uniform vec3 stripesColor2;
|
||||
uniform float stripesWidth;
|
||||
uniform float stripesSpeed;
|
||||
|
||||
void main() {
|
||||
vec4 originalColor = texture(ColorTexture, uv);
|
||||
vec2 texelSize = 1.0 / textureSize(DepthTexture, 0);
|
||||
|
||||
// Optimized depth-based masking - cross pattern
|
||||
float centerDepth = texture(DepthTexture, uv).r;
|
||||
float minDepth = centerDepth;
|
||||
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(-texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(texelSize.x, 0.0)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, -texelSize.y)).r);
|
||||
minDepth = min(minDepth, texture(DepthTexture, uv + vec2(0.0, texelSize.y)).r);
|
||||
|
||||
float mask = smoothstep(0.99, 0.98, minDepth);
|
||||
|
||||
if (mask < 0.01) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// Create diagonal stripes effect
|
||||
vec2 effectUv = uv;
|
||||
effectUv.x *= resolution.x / resolution.y;
|
||||
|
||||
float diagonal = (effectUv.x + effectUv.y + time * stripesSpeed) / stripesWidth;
|
||||
|
||||
float pattern = mod(floor(diagonal), 2.0);
|
||||
|
||||
vec3 col = mix(stripesColor1, stripesColor2, pattern);
|
||||
|
||||
vec4 effectColor = vec4(col, 1.0);
|
||||
|
||||
// Mix original color with stripes effect
|
||||
vec4 finalHandColor = mix(originalColor, effectColor, 0.85);
|
||||
|
||||
outColor = vec4(finalHandColor.rgb, mask);
|
||||
}
|
||||
10
extracted/assets/soupapi/shaders/hand/stripes.vsh
Normal file
10
extracted/assets/soupapi/shaders/hand/stripes.vsh
Normal file
@@ -0,0 +1,10 @@
|
||||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 Position;
|
||||
|
||||
out vec2 uv;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
uv = (Position.xy + 1.0) / 2.0;
|
||||
}
|
||||
15
extracted/assets/soupapi/shaders/post-process/base.vert
Normal file
15
extracted/assets/soupapi/shaders/post-process/base.vert
Normal file
@@ -0,0 +1,15 @@
|
||||
#version 330 core
|
||||
|
||||
layout (location = 0) in vec4 pos;
|
||||
|
||||
uniform vec2 u_Size;
|
||||
|
||||
out vec2 v_TexCoord;
|
||||
out vec2 v_OneTexel;
|
||||
|
||||
void main() {
|
||||
gl_Position = pos;
|
||||
|
||||
v_TexCoord = (pos.xy + 1.0) / 2.0;
|
||||
v_OneTexel = 1.0 / u_Size;
|
||||
}
|
||||
52
extracted/assets/soupapi/shaders/post-process/outline.frag
Normal file
52
extracted/assets/soupapi/shaders/post-process/outline.frag
Normal file
@@ -0,0 +1,52 @@
|
||||
#version 330 core
|
||||
|
||||
in vec2 v_TexCoord;
|
||||
in vec2 v_OneTexel;
|
||||
|
||||
uniform sampler2D u_Texture;
|
||||
uniform int u_Width;
|
||||
uniform float u_FillOpacity;
|
||||
uniform int u_ShapeMode;
|
||||
uniform float u_GlowMultiplier;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void main() {
|
||||
vec4 center = texture(u_Texture, v_TexCoord);
|
||||
|
||||
if (center.a != 0.0) {
|
||||
if (u_ShapeMode == 0) discard;
|
||||
center = vec4(center.rgb, center.a * u_FillOpacity);
|
||||
}
|
||||
else {
|
||||
if (u_ShapeMode == 1) discard;
|
||||
|
||||
float dist = u_Width * u_Width * 4.0;
|
||||
|
||||
for (int x = -u_Width; x <= u_Width; x++) {
|
||||
for (int y = -u_Width; y <= u_Width; y++) {
|
||||
vec4 offset = texture(u_Texture, v_TexCoord + v_OneTexel * vec2(x, y));
|
||||
|
||||
if (offset.a != 0) {
|
||||
float ndist = x * x + y * y - 1.0;
|
||||
dist = min(ndist, dist);
|
||||
center = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float minDist = u_Width * u_Width;
|
||||
|
||||
float falloff = clamp(1.0 - (dist / minDist), 0.0, 1.0);
|
||||
|
||||
if (dist > minDist || u_GlowMultiplier <= 0.0) {
|
||||
center.a = 0.0;
|
||||
} else {
|
||||
// Use gamma-style amplification to keep the full multiplier range meaningful.
|
||||
float exponent = 1.0 / max(u_GlowMultiplier, 0.0001);
|
||||
center.a = pow(falloff, exponent);
|
||||
}
|
||||
}
|
||||
|
||||
color = center;
|
||||
}
|
||||
BIN
extracted/assets/soupapi/soup.png
Normal file
BIN
extracted/assets/soupapi/soup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 542 KiB |
Reference in New Issue
Block a user