โ† All examples

godot shaders

Cutaway along a world plane with solid caps

Slice meshes open along a world-space plane: everything on one side is discarded, the exposed inside shows as a flat cap colour, and a glowing band marks the cut, for cross sections and reveal effects.

Recorded render of Cutaway along a world plane with solid caps

What this component contains

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

How it works

Shader type
spatial
Render modes
cull_disabled
Parameters
albedo (vec4 = 0.35, 0.55, 0.85, 1), roughness (float = 0.45), cap_color (vec4 = 0.9, 0.3, 0.25, 1), edge_color (vec4 = 1, 0.85, 0.4, 1), plane_pitch_degrees (float = 0), plane_yaw_degrees (float = 35), plane_offset (float = 0), edge_width (float = 0.02) and 2 more
Use it on
Closed meshes (open meshes show their real back faces as caps). Several objects can share the material and are cut by the same plane.
Result
A sphere and ring sliced open diagonally with red cut faces, a glowing seam and the inner core visible.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/clip_plane_cutaway/

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

Caps are the inside of the mesh, not new geometry: overlapping inner surfaces show through each other and the cap shading is flat. Discard disables some depth optimizations. Shadows are cut by the same plane.