Kelsidavis-WoWee/assets/shaders/shadow.frag.glsl
Kelsi ef1e5abe8e Add shader-driven tree beautification: wind sway, SSS, color variation, AO
- Vertex wind animation: 3-layer displacement (trunk/branch/leaf) with
  quadratic height scaling so bases stay grounded
- Shadow pass: matching vertex displacement split into foliage/non-foliage
  passes, removed UV-wiggle approach
- Leaf subsurface scattering: warm backlit glow when looking toward sun
- Per-instance color variation: hue/brightness from position hash via flat
  varying to avoid interpolation flicker
- Canopy ambient occlusion: height-based darkening of tree interiors
- Detail normal perturbation: UV-only procedural normals to break flat cards
- Bayer 4x4 ordered dither replacing sin-hash noise for alpha edges
- Foliage skips shadow map sampling and specular to prevent flicker from
  swaying geometry sampling unstable shadow/highlight values
2026-02-23 03:53:50 -08:00

22 lines
501 B
GLSL

#version 450
layout(set = 0, binding = 0) uniform sampler2D uTexture;
layout(set = 0, binding = 1) uniform ShadowParams {
int useBones;
int useTexture;
int alphaTest;
int foliageSway;
float windTime;
float foliageMotionDamp;
};
layout(location = 0) in vec2 TexCoord;
layout(location = 1) in vec3 WorldPos;
void main() {
if (useTexture != 0) {
vec4 texColor = textureLod(uTexture, TexCoord, 0.0);
if (alphaTest != 0 && texColor.a < 0.5) discard;
}
}