Notifications
Clear all

[Closed] cut shadows into mesh

Hi all,

I need to write a script that takes a spotlight/directional light and cuts a shadow into the target mesh. Any objects in front of the target mesh that casts a shadow onto the target mesh should be cut out as well.

I realise this may not be as easy as it sounds so if anyone can point me in the right direction of how to go about this would be much appreciated.

THanks

3 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

may i ask you why you need to cut and what do want to cut? do you want to delete all nodes which are casting shadows onto the target?

Get vectors from light source –> series of points along the perimeter of the object casting the shadow. Create rays from those vectors, and cast intersectrays from light source to shadowed surface. Cast enough rays to create a perimeter of points following the outline of the shadow area, then use those points to construct a spline. Then, extrude that spline and use a boolean operation to subtract it from the surface.

Hey thanks for that. Seems like a 5 minute job.

I need to light a cityscape but texture budget is tight. I’m currently using lightmaps but there is a probabillity that this will not be viable and I will have to try and cut the shadows into the geometry. (it’s for a game)