HyperLap2D Wiki logo HyperLap2D Wiki

Lights are one of the most important effects in a game. They provide a unique atmosphere and enhance the visual quality of your project. HyperLap2D supports both dynamic lights and shadows, including full support for normal maps.

Basic Lights Setup

First, the lighting engine must be enabled in the Scene Properties panel by checking the Enable Lights option.

lights-setup

There are three types of Ambient Light, which control the global scene illumination:

Dynamic Shadows

HyperLap2D casts dynamic shadows for entities that possess both a Shape component (Circle or Polygon) and a Physics component.

lights-scene

Lights are objects created with the Point Light or Cone Light tools. All settings can be managed via the Properties panel:

Lights can have different colors, which can be adjusted via the Tint property.

Body Lights

Entities can emit light to create chain or neon effects. To do this, add a Light component to an object that has both Physics and a Shape component.

chain-light-prop


Pseudo3D Shadows

Pseudo3D allows objects to cast shadows with depth and perspective, simulating a 3D environment. To use this feature, check the Enable Pseudo3D option in the Scene Properties panel.

pseudo3d

The length and orientation of the shadows are determined by the Height property of the light source and its distance from the objects.


Normal Maps

Normal mapping is a technique used to make 2D assets appear 3D when illuminated. HyperLap2D supports normal mapping natively.

Simple Images

To use normal maps for standard images, follow the naming convention: for any <image>.png, include a normal map variant named <image>.normal.png. The rendering pipeline will automatically recognize it.

simple-normal-map

The effect is achieved using the following textures:

Texture Normal Map
wall wall-normal
wall.png wall.normal.png

Spine Animations

Normal mapping is also supported for Spine animations.

  1. Create an empty skin named normalMap in the Spine 2D Editor.
  2. Once imported, each attachment must have its respective normal map texture.

When importing a Spine animation, HyperLap2D unpacks the atlas into multiple files in <project-folder>/assets/orig/images. The naming convention for these PNGs is <animationName><attachmentName>.png. Therefore, normal maps must follow the schema: <animationName><attachmentName>.normal.png.

Example using the raptor animation and head attachment:

Texture Normal Map
raptorhead raptorhead-normal
raptorhead.png raptorhead.normal.png

Normal map textures are imported as simple PNG files. HyperLap2D will automatically locate them and apply the effect.

spine-normal-map

Spine 2D is a commercial product by Esoteric Software. The examples provided are for demonstration purposes.

Generate Normal Maps with Laigter

While many tools exist to generate normal maps, Laigter is an excellent open-source choice. It allows for batch exporting textures with the correct suffix to match HyperLap2D’s naming convention.

laigter

Configuration: Ensure you enable use alpha and disable the invert x and invert y options in Laigter for best results.