Manga Screentone Toon Shader (dots, lines, crosshatch)
Two-tone cel shading with printed manga-style screentone in the shadows. Pick dots, lines or crosshatch. The pattern is drawn in screen pixels, so the dot size stays the same at any distance, like a printed page.
How to use: put it on a ShaderMaterial. One DirectionalLight3D works best. Turn the WorldEnvironment ambient light down for clean black-and-white shadows. Set greyscale to 1 for a full manga page look.
Settings: pattern (0 none, 1 dots, 2 lines, 3 crosshatch), pattern size in pixels, angle, how far the pattern reaches into the light, strength and colour, plus shadow colour, threshold and a small highlight.
Tested in Godot 4.7 on Forward+, Mobile and Compatibility.
Written with AI assistance and tested by hand. More toon looks (anime, painterly, sketch, outlines) with a live preview: https://gameshipkit.com/tools/toon-shader-maker-3d/
Shader code
// Manga screentone toon shader for Godot 4
// Two-tone cel shading with printed-style dots, lines or crosshatch in the shadows.
// The pattern is drawn in screen pixels, so the dot size stays the same at any distance.
//
// MIT License. Copyright (c) 2026 GameShipKit (gameshipkit.com)
// Free to use in commercial and non-commercial projects. Keep this notice.
// More looks (anime, painterly, sketch, outlines) and a live preview:
// https://gameshipkit.com/tools/toon-shader-maker-3d/
shader_type spatial;
render_mode diffuse_lambert, specular_disabled;
uniform vec4 albedo : source_color = vec4(1.0);
uniform sampler2D albedo_texture : source_color, hint_default_white, filter_linear_mipmap;
// 0..1 colour mix: 0 keeps the texture colour, 1 makes everything greyscale like a printed page
uniform float greyscale : hint_range(0.0, 1.0) = 0.0;
group_uniforms shading;
uniform vec4 shadow_color : source_color = vec4(0.82, 0.82, 0.86, 1.0);
uniform float shadow_threshold : hint_range(0.0, 1.0) = 0.5;
uniform float edge_softness : hint_range(0.0, 0.2) = 0.01;
group_uniforms screentone;
uniform int pattern : hint_range(0, 3) = 1; // 0 none, 1 dots, 2 lines, 3 crosshatch
uniform vec4 pattern_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
uniform float pattern_size : hint_range(3.0, 24.0) = 6.0; // pixels per cell
uniform float pattern_angle : hint_range(0.0, 180.0) = 45.0; // degrees
uniform float pattern_reach : hint_range(0.05, 1.0) = 0.6; // how far into the light the pattern goes
uniform float pattern_strength : hint_range(0.0, 1.0) = 0.9;
group_uniforms highlight;
uniform vec4 highlight_color : source_color = vec4(1.0);
uniform float highlight_size : hint_range(0.0, 0.3) = 0.02;
// one line of a hatch pattern: thicker where it is darker
float hatch(float c, float s) {
float d = abs(fract(c) - 0.5) * 2.0;
return (1.0 - smoothstep(s * 0.9, s * 0.9 + 0.15, d)) * smoothstep(0.0, 0.1, s);
}
// 0..1 coverage of the pattern at this screen pixel for a light level l
float screentone(vec2 frag, float l) {
if (pattern == 0) return 0.0;
float s = clamp((pattern_reach - l) / max(pattern_reach, 0.01), 0.0, 1.0);
if (s <= 0.0) return 0.0;
float a = radians(pattern_angle);
vec2 q = mat2(vec2(cos(a), sin(a)), vec2(-sin(a), cos(a))) * frag / pattern_size;
if (pattern == 1) {
// dots grow with the square root of darkness, like halftone print
float r = sqrt(s) * 0.62;
return 1.0 - smoothstep(r - 0.06, r + 0.06, length(fract(q) - 0.5));
}
float m = hatch(q.y, s);
if (pattern == 3) m = max(m, hatch(q.x, (s - 0.45) * 1.8));
return m;
}
void fragment() {
vec3 c = (texture(albedo_texture, UV) * albedo).rgb;
ALBEDO = mix(c, vec3(dot(c, vec3(0.299, 0.587, 0.114))), greyscale);
ROUGHNESS = 1.0;
SPECULAR = 0.0;
}
void light() {
float l = clamp(dot(NORMAL, LIGHT) * 0.5 + 0.5, 0.0, 1.0) * ATTENUATION;
float lit = smoothstep(shadow_threshold - edge_softness, shadow_threshold + edge_softness, l);
vec3 shade = mix(shadow_color.rgb, vec3(1.0), lit);
// mix the shade toward the pattern colour, so black dots stay black on any albedo
shade = mix(shade, pattern_color.rgb, screentone(FRAGCOORD.xy, l) * pattern_strength);
vec3 lc = LIGHT_COLOR / PI;
DIFFUSE_LIGHT += shade * lc;
if (highlight_size > 0.0) {
float ndh = max(dot(NORMAL, normalize(LIGHT + VIEW)), 0.0);
float sp = smoothstep(1.0 - highlight_size, 1.0 - highlight_size + 0.005, ndh);
SPECULAR_LIGHT += highlight_color.rgb * sp * lit * lc;
}
}

Comments 0
No comments yet.