--- name: makepad-image-generator description: "Create and source 2D image content for Makepad games: procedural tiling textures with makepad-game-gen texgen, palettes and colour variety, skies and gradients, HUD icons and GUI art, and library texture sourcing. Use for texture, material map, sky, palette, icon, logo, splash art, and 'everything looks flat' requests." --- # Makepad Image Generator Textures and 2D art, from two sources: **procedural** (`makepad-game-gen::texgen`) and the **CC0 library**. No paid image API is involved. The most common reason a Makepad scene looks unfinished is that every surface is flat vertex colour. Texture is the fix, and procedural texture costs nothing to download and replicates from a seed. ## Procedural textures — `texgen` Deterministic from a seed (`makepad-game-gen::rng` + `makepad-game-math`), so the same texture regenerates identically on every device and replicates as a seed rather than as pixels. Uploaded through `DrawGameTexture` and referenced by `ModelInstance::with_texture(idx)`. Build textures in layers, exactly as you would paint them: 1. **Base value** — the average tone. Get this right first; it dominates the read at distance. 2. **Large variation** — low-frequency noise, patches, weathering. This is what stops tiling being visible. 3. **Structure** — planks, bricks, tiles, grain. The thing that says what the material *is*. 4. **Small detail** — grit, scratches, speckle. Only visible up close; skip it for distant surfaces. 5. **Edge wear** — lighter or darker along structural edges. The single most convincing layer. Recipes: | Material | Layers | | --- | --- | | Ground / dirt | brown base, large blotch noise, fine grit, sparse pebbles | | Grass | green base, two-tone patch noise, fine directional speckle | | Stone | grey base, large value patches, crack lines, edge highlights | | Wood | tan base, directional grain, plank seams, darker knots | | Metal | mid base, subtle brushed streaks, edge highlights, rust at edges | | Sand | pale base, ripple sine bands, fine speckle | **Tiling discipline.** Wrap noise so opposite edges match, or the seam shows on every repeat. Keep the base value low-contrast — a high-contrast tile reads as a grid the moment it repeats more than about four times. Break up remaining repetition with per-instance tint and yaw jitter, not with a bigger texture. **Texel density.** Match the tiling scale to world units so density is consistent across surfaces. Inconsistent texel density — a crisp crate beside a blurry wall — is noticed by everyone and named by almost nobody. ## Palettes `makepad-game-assets` provides `Palette`, `Spread`, `VarietyParams`; the script route has `find_palette`. Three dominant + two accent colours, decided once and written into `artifacts/game-progress.md`. Rules: - **Reserve accents for gameplay meaning.** If pickups are the only saturated orange, the player learns orange without a tutorial. - **Separate by value, not only hue.** Convert a screenshot to greyscale: foreground, midground and background must still read as distinct bands. This is the test most scenes fail. - **Desaturate toward the fog colour with distance** — free aerial perspective. - Generate variety with `Spread` / `VarietyParams` rather than hand-picking, so a crowd stays palette-consistent. The CC0 library is shared, so untinted scenes look like every other Kenney project. Tint discipline is what makes it yours. ## Sky `SkyConfig`, `DrawGameSky`, `sun.rs`. A gradient plus a sun disc covers most needs. Two non-negotiables: - **The fog colour must match the sky at the horizon**, or distant geometry sits on a visibly different backdrop. - **The sky must agree with the key light.** A warm low sun with a bright midday blue sky reads as broken even to people who cannot say why. ## Icons and GUI art Small, flat, high-contrast. Draw them as geometry or SDF shapes in the widget layer rather than importing bitmaps where you can — they stay crisp at every DPI and cost nothing to download. Rules: readable at 24 px; **never** encode meaning in hue alone (pair with shape); consistent stroke weight and corner radius across the set; and control glyphs that match the *active* device rather than a hardcoded keyboard key. ## Library images The CC0 packs include textures and UI atlases; search them with `makepad-game-assets` by description, the same as models (`AssetKind` filters kind). Prefer the library for anything with recognisable representational content, and procedural for anything tiling or bulk. ## When to use each | Need | Source | | --- | --- | | Tiling ground, wall, wood, metal | procedural `texgen` | | Bulk variation across many props | procedural, seeded | | Sky gradient | `SkyConfig` | | Recognisable representational art | library | | Icons, HUD glyphs | drawn geometry / SDF in the widget layer | | Anything needed at 20 variants | procedural — a seed per variant | ## Verification Look at it in-engine at the real distance and angle, not as a flat preview: tiling seams and texel-density mismatches are invisible in a texture viewer and obvious on a wall. Then check the greyscale value test on a gameplay screenshot, and score categories 3, 4, 6 and 9 of `makepad-aaa-graphics-builder/references/visual-scorecard.md`. Textures are memory. Prefer resolution that matches on-screen size; a 2048² texture on a distant prop is wasted bandwidth on a device that is bandwidth-bound before it is ALU-bound.