# Normal mapping with a moving light

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

The left sprite uses a normal map generated from a height image; the right sprite uses the same albedo and a flat normal. The moving Point light evaluates each surface separately. Change Height, Intensity or Range in the live Inspector to see the difference. Height is measured above the 2D plane, while shadows remain planar.

The complete source project is `modules/render2d/res/docs/try/lighting/NormalMapping.assets`. Open its `project.aego` in the editor to edit the images, material and moving-light script together. A copied `.aescene` alone does not include those external assets. The browser receives prepared resources from that project through the ordinary asset loader. It does not run image importers or search for normal-map filenames.

`surface_height.png.meta` selects `semantic=height`, `generate_normal=true`, `height_channel=r`, `height_strength=12` and `normal_y=up`. Import produces a linear normal texture. The Lit material's explicit `NormalMap` reference points to that stable asset ID. The albedo uses color semantics and has no implicit normal association, so the flat comparison remains flat. Renaming either file with its `.meta` preserves the link.

For an authored normal image, use `semantic=normal`; choose `normal_y=up` or `down` to match the source's green-channel convention. Do not import normal, cookie or height data as sRGB color. An independently packed normal atlas keeps its own region, source dimensions and trim mapping. Rotated atlas entries remain unsupported. A missing normal frame keeps its reference and renders with a flat fallback until repaired.

If the surface looks flat, check that the material is Lit, the light's receiver mask includes the sprite, Height is positive, the normal reference resolves and NormalStrength is nonzero. Excessive ambient can hide the direct-light response. Scene View's **Surface normals** mode helps inspect the transformed normal without exposure or tone mapping. The project `examples/platformer` demonstrates the same pipeline in the actual game.
