# Forest materials

CC0 textures by Rob Tuytel / Poly Haven, downloaded directly from the publisher:

| Game files | Source |
| --- | --- |
| litter-color.png, litter-normal.png | https://polyhaven.com/a/forest_leaves_04 |
| bark-color.png | https://polyhaven.com/a/bark_brown_02 |
| rock-color.png | https://polyhaven.com/a/mossy_rock |

License: https://polyhaven.com/license (CC0; commercial use and redistribution permitted).

The 1K diffuse and OpenGL normal maps are resized to 512×512 for this game.
Run `sh tools/assets/prepare-forest.sh` on macOS to reproduce the conversion.
Colour maps use sRGB; the normal map uses linear data. Repeat wrapping,
mipmaps and anisotropy are configured by `src/world/forest-textures.js`.
Four RGBA8 textures with full mip chains take approximately 5.33 MiB of GPU
storage per live forest, depending on the driver. Each course owns and disposes
its texture instances. No displacement, extra render targets or lighting passes.

Tree geometry, branch construction, LOD and terrain blending are authored in
this repository; the downloaded assets contain texture images only.

## Needle foliage

Twig colour and alpha maps downloaded directly from:

- https://polyhaven.com/a/pine_tree_01
- https://polyhaven.com/a/fir_tree_01

Authors: Rico Cilliers (modeling), Rob Tuytel (photography); CC0.
No source model meshes or procedural code are imported.

`sh tools/assets/prepare-needles.sh` downloads the four 1K maps, then packs them
with `pack-needles.py` (Python + Pillow; `PYTHON` can select the interpreter).
The packer isolates a connected twig from each UV atlas, combines colour and alpha,
and bakes small distant crowns from those same twigs. Outputs:

- pine-needles.png: 256×512 RGBA; fir-needles.png: 512×512 RGBA.
- pine-crown.png, fir-crown.png: 128×256 RGBA each.

These add approximately 2.33 MiB of RGBA8 mipmapped storage (total forest maps:
7.67 MiB per live course, driver dependent). The visible and shadow shaders share
the same 0.24 alpha cutoff and branch deformation. Transparent pixels are discarded
before lighting, with depth writes enabled and no alpha blending. Distant crowns
use two crossed cards without shadow casting. This trades modest alpha overdraw
for much lower vertex counts; frame pacing must be profiled on target devices.
