How do i add shadows to my game?

i already have a direct sunlight shader that i’m satisfied with, but i want to add shadows to it

can i raycast from the sun direction to the surface, and draw a material based on that?

should i use some other method?

2 Likes

Yes, classic shadow mapping is one of the nicest methods :wink: You can check out how it’s done in Lights and Shadows:

Or in the newest Defold 3D Playground with shadow mapping:

2 Likes