Baltor Get started

Gallery / Godot shaders

Waving flag with a pinned edge

In your harnessGodot shaderMIT

Animate a flag on a subdivided quad: travelling waves grow away from the pole edge, a droop adds weight, analytic derivatives rebuild the normals, and the face shows procedural stripes and a disc or an assigned texture.

Render of Waving flag with a pinned edge
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
cull_disabled
Parameters
flag_texture (sampler2D), stripe_a (vec4 = 0.1, 0.25, 0.6, 1), stripe_b (vec4 = 0.95, 0.95, 0.92, 1), emblem_color (vec4 = 0.9, 0.7, 0.15, 1), stripes (int = 5), amplitude (float = 0.12), wavelength (float = 0.9), speed (float = 3) and 2 more
Use it on
A QuadMesh (or plane) with enough subdivisions along U; the pole side must be at U = 0., Optional: a flag image for flag_texture.
Result
A striped flag with a gold disc rippling in waves that start at the pole.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/flag_wave_cloth/

Limits. Not a cloth simulation: no gravity response to orientation, no wind direction and no collision. Normals come from the UV-space function, assuming an unscaled quad, so strongly non-uniform scale skews lighting. Shadows follow the moving shape.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 54.9 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
Travelling sine waves weighted by distance from a pinned edge, Finite-difference normals of a displacement function
Tags
godot shader, spatial, flag, cloth, wind, vertex animation, banner
Identity
library.supply.creative_originals.4ce0d757065cae57726f7146.e54c379a9004f0ea
Version
e54c379a9004f0ea563a428c0b5351f87509f6dacdeaed09aedfaaee393c235e

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.