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:
-
New components to define light nodes:
TCastlePointLight
,TCastleSpotLight
,TCastleDirectionalLight
. Descendants ofTCastleTransform
, which can be easily added and manipulated from the editor and from Pascal code. -
New properties to control lights:
TCastleRenderOptions.ReceiveSceneLights
,TCastleRenderOptions.ReceiveGlobalLights
,TCastleScene.CastGlobalLights
. -
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 changeScene.RenderOptions.PhongShading
(seeTCastleRenderOptions.PhongShading
) tofalse
.Note: using some features (normal maps, PBR, shadow maps) requires Phong shading anyway, and will override this.
Note: Do not confuse Phong shading with Phong lighting model.
-
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 reasonableRadius
on point and spot lights, and limit the number of directional lights that affect all scenes. -
SpotLight defaults adjusted, matching also X3D 4.0 changes:
beamWidth
by default is nowpi * 3 / 16
, so it shows a small falloff untilcutOffAngle
. -
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.
Do you enjoy this feature? Please support us on Patreon.