Skip to content

Instantly share code, notes, and snippets.

@SanderMertens
Last active February 4, 2026 06:19
Show Gist options
  • Select an option

  • Save SanderMertens/eae902c06d448784fd301f4dcc1bbf45 to your computer and use it in GitHub Desktop.

Select an option

Save SanderMertens/eae902c06d448784fd301f4dcc1bbf45 to your computer and use it in GitHub Desktop.
using flecs.script.*
using flecs.components.*
using flecs.game
const Resolution: 175
const Scale: 40 / Resolution
const Size: 50
const Height: 1.8
const CellW: Size / Resolution
for x in 0..Resolution {
for y in 0..Resolution {
const xN = x * Scale
const yN = y * Scale
const h = 24 * abs(perlin2(xN, yN)) *
abs(perlin2(xN + 0.7, yN + 0.3)) *
abs(perlin2(xN - 0.1, yN - 0.5)) *
perlin2(xN / 5, yN / 5)
const hN = clamp(h, -0.05, 1)
const c1 = hN
const c2 = smoothstep(0.8, 1.0, h)
{
Position3: {x * CellW, hN * Height, y * CellW}
Box: {CellW, 10, CellW}
Rgb: {c1, c2}
Emissive: {0.1 + 1 * c2}
Specular: {clamp(0.5 - c2, 0, 0.3), 2}
}
}
}
ground_plane {
Rgb: {}
}
$ {
TimeOfDay: {0.85}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment