Baltor Get started

Gallery / Godot shaders

X-ray silhouette where an object is hidden

In your harnessGodot shaderMIT

Keep a character or item visible through walls: the visible part renders as a lit surface, the part hidden behind other geometry renders as a coloured see-through silhouette with a rim, decided per pixel against the depth buffer.

Render of X-ray silhouette where an object is hidden
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
depth_test_disabled, depth_draw_never, cull_back
Parameters
depth_texture (sampler2D), albedo (vec4 = 0.8, 0.45, 0.2, 1), roughness (float = 0.6), xray_color (vec4 = 0.25, 0.75, 1, 1), xray_fill (float = 0.35), xray_rim_power (float = 2), depth_bias (float = 0.02), pattern_density (float = 120)
Result
A character whose exposed part is shaded normally and whose part behind the wall shows as a glowing blue outline with a striped fill.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/occlusion_silhouette_xray/

Limits. Without a depth test the object does not sort against itself: concave meshes can show far parts over near ones, so it suits convex characters and props best. The object is drawn in the transparent pass, so it casts no shadow from this material and does not occlude other transparent objects.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 58.3 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Depth test disabled with per-pixel occlusion test against the depth buffer, Fresnel rim silhouette with screen-space stripes
Tags
godot shader, spatial, x-ray, occlusion, silhouette, see through walls, depth buffer
Identity
library.supply.creative_originals.059060a2442be5470a37bc9a.ac2843662a06c675
Version
ac2843662a06c675e470c02dbfbd5ceafdfa9c4af4c22e6ed19965c05f3dce20

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.