โ† All examples

godot shaders

Low-poly flat shading with per-facet colour

Give any mesh a faceted low-poly look: per-pixel face normals from screen derivatives, per-facet colour variation from a hash of the face normal, a height gradient, and optional vertex jitter to break up regular primitives.

Recorded render of Low-poly flat shading with per-facet colour

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • low_poly_flat_shading.gdshader
  • material.tres
  • preview.png
  • test_package.py
  • verification/native.json

How it works

Shader type
spatial
Parameters
low_color (vec4 = 0.18, 0.42, 0.3, 1), high_color (vec4 = 0.85, 0.82, 0.55, 1), gradient_bottom (float = -0.6), gradient_top (float = 0.6), facet_variation (float = 0.12), jitter (float = 0.06), roughness (float = 0.9)
Result
A faceted sphere with visibly flat triangles shaded in greens fading to sand at the top.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/low_poly_flat_shading/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

Derivative normals are per 2 x 2 pixel block, so tiny triangles get noisy normals. Jitter moves vertices by a hash of their quantized position: vertices closer than 1/50 object unit can merge their offsets. Shadows use the jittered shape.