Shadow
In the 3D world, light and shadows have always been extremely important components. They can enrich the entire environment, good-quality shadows can achieve the effect of false realization, and make the entire world have a three-dimensional feel to it.
Here is an example of a shadow from Cocos Creator:
Turning on shadows
Cocos Creator currently supports two shadow modes, shadow Map and planer Shadow for developers to use.
It takes three steps to enable a Planar Shadow in Cocos Creator:
Select the Scene node on the level manager, you can see the following panel, check the Enabled property of Shadows.
Choose Type as Planar
Set ShadowCastingMode to ON in the model that needs to display shadows.
Note: Planar Shadow will only be cast on the shadow surface. Adjusting the directional light angle can adjust the shadow projection.
It takes four steps to enable a Shadow Map in Cocos Creator:
Select the Scene node on the level manager, you can see the following panel, check the Enabled property of Shadows.
Choose Type as ShadowMap
Set ShadowCasting to ON in the model that needs to display shadows.
Set ReceiveShadow to ON in the model that needs to display shadows.
Note: ReceiveShadow receive the shadow effect. ShadowCasting produces a shadow effect.
PlanarShadows panel
The following describes all the properties of the panel:
Properties | Explanation |
---|---|
Enabled | Whether to turn on the shadow effect |
Type | Choose shade type |
ShadowColor | Color value of the resulting shadow |
Normal | Normals to vertical and shadow planes |
Distance | The distance of the shadow plane from the coordinate origin in the direction of the normal |
ShadowMap panel
The following describes all the properties of the panel:
Properties | Explanation |
---|---|
Enabled | Whether to turn on the shadow effect |
Type | Choose shade type |
ShadowColor | Color value of the resulting shadow |
Pcf | Set the anti-aliasing level of the shadow edge |
Near | Set the near clipping plane of the main light source shadow camera |
Far | Set the far clipping plane of the main light source shadow camera |
OrthoSize | Set the ortho viewport size of the main light source shadow camera |
ShadowMapSize | Set the shadow map size |
Aspect | Set the ortho viewport aspect ratio of the main light source shadow camera |
Continue to the Scene documentation.