โ† All examples

procedural textures

Ocean wave normals from a directional wave spectrum

Generate tileable maps of a water surface: a sum of directional sine waves with whole-number wave vectors drawn from a wind-sea spectrum, Gerstner-style crest sharpening and whitecap foam where crests compress. The normal map is the main output for water shaders; calm swell to storm presets.

Recorded render of Ocean wave normals from a directional wave spectrum

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • blender_material.py
  • component.json
  • material.tres
  • ocean_wave_normals.py
  • pngio.py
  • preview.png
  • test_package.py
  • texkit.py
  • verification/native.json

How it works

Entry point
generate
Maps
albedo, normal, roughness, height, ao
Parameters
peak_waves, components, wind_angle, spread, detail, choppiness, foam, relief and 3 more
Presets
default, calm_swell, choppy_wind, stormy, lake_ripples
Tileable
yes
Command line
python ocean_wave_normals.py --size 1024 --seed 7 --preset NAME --out DIR [--width W --height H] [--set NAME=VALUE] [--directx-normal] [--orm]
Godot material
material.tres
Blender builder
blender_material.build_material(folder)

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • command_line_generates_declared_maps
  • maps_decode
  • maps_have_declared_size_and_channels
  • maps_tile_without_a_seam
  • normal_vectors_unit_length_facing_out
  • maps_carry_detail
  • godot_imports_the_maps
  • godot_material_template_loads_every_map
  • godot_compatibility_render
  • capture_shows_the_textured_surface
  • blender_builds_the_material

Limits to consider

One still frame of a stylized spectrum, not an ocean simulation: there is no dispersion relation, time animation or FFT, and the spectrum shape is a log-normal band with cosine spreading rather than a measured model such as JONSWAP. Choppiness resamples the height once at the displaced position, an approximation of Gerstner waves that holds while crests do not fold. Every wave repeats across the tile, so long views show the repeat; blend two scales of the tile in the shader to hide it. Foam is placed from crest compression and noise, not from breaking physics, and the occlusion map is a mild stand-in.