Skip to content

Search

Tilbage
· 1 min. læsning

Normal-mapped sprites

A normal_map on a sprite or shape2d lights it per pixel from every light2d, through kiss3d's LitMaterial2d.

A sprite or shape2d that names a normal_map is lit per pixel by every light2d, so its bumps catch the light from the side it comes from.

Two grey sprites under one lamp: the left one normal-mapped into sixteen domes lit from above, the right one flat

  • normal_map names a tangent-space image. Give it srgb = false, in its sidecar or in a texture asset.
  • specular_strength adds a highlight, and shininess tightens it, 16 by default. normal_strength scales the bumps; 0 lights the node flat.
  • A light2d sits height above the plane, 1 world unit by default. For a directional light, height is rise over run, so 1 comes in at 45 degrees.
  • The node draws with kiss3d's LitMaterial2d. It lights itself, so it draws after the light map's composite, over every node the light map lit, and no light casts a shadow on it.
  • With no light2d in the scene, a normal-mapped node draws as an unlit one does.
[nodes.sprite]
texture = "art/stones.png"
normal_map = "#stones_normals"
specular_strength = 0.6
shininess = 24.0