LED dot matrix spatial
very simple dot matrix shader for 3d objects. this can simulate LED screens
Shader code
shader_type spatial;
uniform sampler2D tex;
uniform vec3 emission_color : source_color = vec3(1.0);
uniform float emission_strength=2.0;
uniform float grid_size = 0.025; // Size of the grid cells
uniform float dot_radius = 0.01; // Radius of each dot
void fragment() {
vec4 base_color = texture(tex, UV);
// Calculate grid coordinates (center of the cell)
vec2 cell_pos = floor(UV / grid_size);
vec2 cell_center = (cell_pos + 0.5) * grid_size;
// Calculate distance from the center of the cell
float dist = distance(UV, cell_center);
// Create a circular alpha based on distance
float circle_alpha = smoothstep(dot_radius - 0.01, dot_radius + 0.01, dist);
// If we're inside the circle, show the texture with full opacity
if (dist < dot_radius) {
ALBEDO = base_color.rgb * emission_color*emission_strength; // Make it emissive
ALPHA = 1.0;
} else {
ALPHA = 0.0; // Make non-dot areas fully transparent
}
}



