Description
This project showcases an advanced 2D lighting system in Phaser 3, utilizing normal maps for enhanced visual depth and realism. The scene features a white circle with a soccer ball normal map, demonstrating how normal mapping can add perceived texture and dimensionality to flat 2D graphics.
The lighting system employs a single, dynamic light source that follows the user's mouse cursor, creating real-time shadows and highlights on the circle based on the normal map data. This light smoothly transitions between random colors, offering a visually engaging and ever-changing illumination effect.
Key features of this implementation include:
Normal map integration: The circle's texture incorporates both a diffuse (color) map and a normal map, allowing for complex light interactions.
Dynamic lighting: A single light source follows the mouse cursor, providing interactive illumination.
Color transitions: The light's color gradually shifts between randomly generated hues, creating a subtle and appealing visual effect.
Toggle functionality: Users can switch the normal map on and off with the 'N' key, allowing for a direct comparison between flat and normal-mapped rendering.
Light control: The 'L' key toggles the entire lighting system, demonstrating the contrast between lit and unlit scenes.
This project effectively demonstrates how normal mapping and dynamic lighting can significantly enhance the visual quality of 2D games, adding a pseudo-3D effect to flat sprites. It serves as an excellent example of advanced rendering techniques in 2D game development using Phaser 3.