Shadow

    Cocos Creator 3.0 currently supports both Planar and ShadowMap shadow types.

    To enable the shadow effect for an object, proceed as follows:

    1. Check light in the Hierarchy panel, and then check the Shadow Enabled property in the Dynamic Shadow Settings component of the Inspector panel.

    2. Select the 3D node that needs to display shadows in the Hierarchy panel, and then set the ShadowCastingMode property to ON in the MeshRenderer component of the Inspector panel.

      set-meshRenderer

      If the shadow type is ShadowMap, set the ReceiveShadow property on the MeshRenderer component to ON.

    The shadow type can be set in the Type property of the Shadows component.

    The Planar shadow type is generally used for simpler scenes.

    Adjust the direction of the directional light to adjust the position of the shadow.

    ShadowMap

    ShadowMap renders the scene with the lights as the viewpoint. From the position of the lights, the places in the scene that are not visible are where the shadows are created.

    PropertyExplanation
    EnabledWhether to enable the shadow effect.
    TypeChoose the shadow type.
    MaxReceivedThe maximum number of lights supported for shadow generation, default is 4, can be adjusted as needed.
    ShadowMapSizeSet the texture size of the shadow, Currently supports Low_256x256, Medium_512x512, High_1024x1024, Ultra_2048x2048 four kinds of precision textures.

    ShadowMap receives and displays shadow effects generated by other objects when ReceiveShadow on the object MeshRenderer component is enabled.

    For models with enabled in the material, the planar shadow will automatically draw with instancing as well, see the documentation for details.