shader_type spatial; // Persistent blood splats, drawn as one MultiMesh of flat quads (see blood_decals.gd). // Unshaded and nearest-filtered to sit inside the PS1 look; alpha-blended so overlapping // splats pool darker. depth_draw_never + the small normal offset the pool bakes into each // transform keep the coplanar floor/wall quads from z-fighting the surface they stain. render_mode unshaded, cull_disabled, shadows_disabled, depth_draw_never, blend_mix; uniform sampler2D atlas : source_color, filter_nearest; // Number of splat shapes packed side-by-side in the atlas (one row). uniform int cells = 8; varying flat float v_cell; varying flat float v_shade; void vertex() { // x = which atlas shape this instance uses; y = per-instance brightness (fresh vs old). v_cell = INSTANCE_CUSTOM.x; v_shade = INSTANCE_CUSTOM.y; } void fragment() { float u = (UV.x + v_cell) / float(cells); vec4 c = texture(atlas, vec2(u, UV.y)); ALBEDO = c.rgb * v_shade; ALPHA = c.a; }