Hi~
There are two cameras in the scene,
one is named “Terrain camera” and the another is named “Character camera”.
Terrain camera renders terrains and Character camera renders unit models.
After I generate a scene, I can see the terrain and character models,
but the character’s shadow does not cast in terrain.
To reproduce:
-
Make a fresh project.
-
Add a directional light, set to hard shadows(soft shadow also possible).
-
Add Plan and set layer as “Terrain”
-
Add Cube and set layer as “Terrain”
-
Add Sphere and set layer as “Unit”
-
Set properties of “Main Camera”
- Culling Mask : “Terrain” ( render plane ans cube )
- Depth : -1 ( render before character camera )
- Rendering Path : Forward
- Add camera and set properties :
- Culling Mask : “Unit” ( render sphere )
- Depth : 1 ( render after main camera )
- Rendering Path : Forward
- Finally make the two camera have same position.
If you run the game, the cube cast shadow to the plane, because they have same layer id.
But, sphere does not cast shadow to the plane and cube.
I don’t know why… but because the camera has its own shadow data?
If so, can I make the two camera share same shadow data (= maybe shadow map texture?).
Also, I have to make the shadow data with objects that does not have same layer id.
Does Unity have some functions for this?
or any other alternative?
Thank you.