Baltor Get started

Gallery / Godot shaders

Per-instance variation for MultiMesh crowds

In your harnessGodot shaderMIT

Give thousands of MultiMesh instances individual looks and motion from INSTANCE_ID alone: hue and brightness variation, random height scale, and a bobbing wave with its own phase per instance.

Render of Per-instance variation for MultiMesh crowds
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Parameters
base_color (vec4 = 0.25, 0.6, 0.85, 1), hue_variation (float = 0.35), brightness_variation (float = 0.3), height_variation (float = 0.8), bob_height (float = 0.12), bob_speed (float = 2), roughness (float = 0.6)
Use it on
A MultiMeshInstance3D; meshes should have their base near object y = -0.25 (or edit base in the shader).
Result
A field of blue, teal and violet boxes of different heights bobbing out of step.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/multimesh_instance_variation/

Limits. Variation is tied to the instance index, so reordering instances changes their looks. INSTANCE_ID is 0 for a plain MeshInstance3D, so all copies look the same there. Normals are not adjusted for the height stretch (fine for boxes and columns).

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 64.7 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
Hashed INSTANCE_ID per-instance randomness (MurmurHash3 finalizer), Hue rotation about the grey axis (Rodrigues rotation), Per-instance phase animation
Tags
godot shader, spatial, multimesh, instancing, variation, crowd, vertex animation
Identity
library.supply.creative_originals.bc9987a79983b0cf6fdf9fa5.a044383ce821aef7
Version
a044383ce821aef7aae2399c14762282255207f8163a6f3074651f53fd80cba8

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.