Spotlights
In the editor, one can clearly see the position, color and light range of the light as well as its spot angle, as shown in the following image. With the Transform Gizmos in the upper left corner of the editor, it is possible to adjust the position and direction of the spotlight.
See for how to add spotlights to a scene.
For the Spotlight component interface, please refer to SpotLight API.
Property | Explanation |
---|---|
ShadowEnabled | Whether to enable the shadow effect. |
ShadowPcf | Set the anti-aliasing level of the shadow edge, currently including HARD, SOFT, SOFT_2X. Please refer to the section PCF Soft Shadow below for details. |
ShadowBias | Set the shadow offset value to prevent z-fitting. |
ShadowNormalBias | Set the normal offset value. |
PCF Soft Shadow
Cocos Creator currently supports hard sampler (HARD mode), 4x sampler (SOFT mode), 9x sampler (SOFT_2X mode). The larger the magnification, the larger the sampling area and the more softer the shadow edges.