Files
spellforge/shaders/arena_grid.gdshader
T
2026-07-20 10:56:52 +08:00

27 lines
897 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 竞技场地面网格:暗色基底 + 细网格线 + 中心放射暗角,提供空间参照与氛围
// 应用于覆盖竞技场的大 ColorRect/Polygon2DUV 0-1 映射全幅)
shader_type canvas_item;
uniform float grid_cells = 100.0;
void fragment() {
vec2 g = UV * grid_cells;
vec2 f = abs(fract(g) - 0.5);
float minor = smoothstep(0.47, 0.5, max(f.x, f.y));
// 粗线(每 10 格)
vec2 g2 = UV * (grid_cells / 10.0);
vec2 f2 = abs(fract(g2) - 0.5);
float major = smoothstep(0.46, 0.5, max(f2.x, f2.y));
vec3 base = vec3(0.085, 0.088, 0.115);
vec3 minorC = vec3(0.125, 0.130, 0.165);
vec3 majorC = vec3(0.180, 0.185, 0.240);
vec3 col = mix(base, minorC, minor);
col = mix(col, majorC, major);
// 径向渐暗(边缘更暗,聚焦中心)
float vig = 1.0 - smoothstep(0.25, 0.75, length(UV - vec2(0.5)));
col *= mix(0.6, 1.15, vig);
COLOR = vec4(col, 1.0);
}