I checked out the new Tilemap system and would like to use it as floor surface in a kinda top-down-shooter game. I want to use walls that block off light and can receive shadows. I noticed that it is hard to get a tilemap to use shadows at all. I wrote a script, that takes the TilemapRenderer and does this: TilemapRenderer.receiveShadows = true; TilemapRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; But it only works with the Default-Shader. Check this out: The Default-Shader does it right, but ideally I'd like to have the Normal Mapped Tile Shader work as well. Is there any way to get the same shadow results with normalmap feature? The Normal Mapped Shader is from here: https://github.com/Unity-Technologi...Assets/Tilemap/Normal Mapping/Material/Shader
Seems that shadow receiving is not supported with the tilemaps. Even changing the sprite rendered to a mesh renderer does not work and just makes the whole tilemap disappear. Too bad as I would love for this feature to work out of the box. Maybe you can make an "bug" issue?
I'm going with the default shader for now as it supports shadows until there is a proper tilemap shader that supports shadows. But feel free to open a request. That would be nice to have for sure
How did you manage to get the shadows working? I thought it will be as simple as putting Code (CSharp): public class ShadowActivator : MonoBehaviour { private void Awake() { GetComponent<TilemapRenderer>().receiveShadows = true; GetComponent<TilemapRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; } } on tilemap game object, but it isn't. Am I missing something? EDIT: I just noticed you are using Default-shader and not Sprites-default (confusing naming), I am going to try it out. EDIT 2: Not working even with Default-shader EDIT 3: Ok, my fault, it is working. Thanks!
I have the same problem, but i am unable to find the default-shader. Has it been renamed in a newer version? Edit: Ok, so i also found a way to make it work: 1. Make sure that whatever light used has either a hard or soft shadow type 2. Select the tilemap that needs to receive shadows, and under the tilemap Renderer component in the inspector, select Material > Assets-tab > Default-material. 3. Tell the tilemap to receive shadows by giving it a scrip just like the one Fido789 made. That should be it
I found an easier way to do this. 1. Create a new standard material and put it in the tilemaps TilemapRenderer material. 2. In the very top right hand corner of the inspector, click the little icon that has 3 horizontal lines. It's right of the lock icon. 3. Select Debug. You should see extended fields in your components now. 4. In the TilemapRenderer, click Receive Shadows. 5. Change back to Normal. 6. Marvel at what you have done. 7. Get back to work.
This works, however how would you cast a shadow from objects? I've added a 3D cube but it doesn't cast the shadow on the tilemap.