# Design lights using Castle Game Engine: new light components and related features, with video!

**URL:** <https://forum.castle-engine.io/t/design-lights-using-castle-game-engine-new-light-components-and-related-features-with-video/557>\
**Category:** News\
**Created:** [April 1, 2022, 9:18pm UTC](https://forum.castle-engine.io/t/design-lights-using-castle-game-engine-new-light-components-and-related-features-with-video/557 "2022-04-01T21:18:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)\
**Post date:** [April 1, 2022, 9:18pm UTC](https://forum.castle-engine.io/t/design-lights-using-castle-game-engine-new-light-components-and-related-features-with-video/557/1 "2022-04-01T21:18:43Z")

</div>

| [![Lights in Castle Game Engine editor](https://castle-engine.io/wp/wp-content/uploads/2022/04/Zrzut-ekranu-z-2022-04-01-22-52-00-200x117.png)](https://castle-engine.io/wp/wp-content/uploads/2022/04/Zrzut-ekranu-z-2022-04-01-22-52-00.png "Lights in Castle Game Engine editor") |

We’re proud to announce a big new feature in _Castle Game Engine_: new light components that allow to easily manipulate lights (from the editor and from Pascal code) and a number of related improvements.

I’ve made a video presentation that describes everything, enjoy! And read below the movie for more information.

New features details:

1. New components to define light nodes: `TCastlePointLight`, `TCastleSpotLight`, `TCastleDirectionalLight`. Descendants of `TCastleTransform`, which can be easily added and manipulated from the editor and from Pascal code.

2. New properties to control lights: `TCastleRenderOptions.ReceiveSceneLights`, `TCastleRenderOptions.ReceiveGlobalLights`, `TCastleScene.CastGlobalLights`.

3. `TCastleRenderOptions.PhongShading` is now by default true. In short, it means that the lights look pretty. If you want to use Gouraud shading for efficiency, just change `Scene.RenderOptions.PhongShading` (see `TCastleRenderOptions.PhongShading`) to `false`.

4. `TCastleRenderOptions.DefaultMaxLightsPerShape` is now by default a big number: 64 instead of previous 8. Remember that each light has a cost, esp. as we use classic _“forward rendering”_ right now in CGE. So try to limit the number of lights that affect given shape anyway, try to stay well below the 64 limit. The simplest way to do this is to use reasonable `Radius` on point and spot lights, and limit the number of directional lights that affect all scenes.

5. SpotLight defaults adjusted, matching also X3D 4.0 changes: `beamWidth` by default is now `pi * 3 / 16`, so it shows a small falloff until `cutOffAngle`.

6. Proper calculation and optimization of lights radius when lights are in a different scene than shape they shine on.

Coming soon: `TCastleEnvironmentLight` and shadows properties on lights, to easily activate [shadow maps](https://castle-engine.io/x3d_extensions_shadow_maps.php).

Do you enjoy this feature? Please [support us on Patreon](https://www.patreon.com/castleengine).
