C
CoderJoe
Guest
Hey there. I have been working on a lighting engine for my game. I've tried multiple iterations of it but the basic idea is this: I want only shadows to be draw instead of light.
The levels of my game are divided up into sections. The player object moves and there are some lights in each section. To keep things quick, I am baking the shadow of the static objects on the start of the room. However my main problem is that I can't figure out how far to draw the shadow. It's a little hard to explain so here is a picture:the left is what I want to happen but the right is what currently happens. I thought if I had an invisible object that covers the section, I could calculate the intersection to stop the shadow from drawing so far but I haven't figured that out yet. Any suggestions or equations for finding an intersection of a line with the edges of a rectangle?
The levels of my game are divided up into sections. The player object moves and there are some lights in each section. To keep things quick, I am baking the shadow of the static objects on the start of the room. However my main problem is that I can't figure out how far to draw the shadow. It's a little hard to explain so here is a picture:the left is what I want to happen but the right is what currently happens. I thought if I had an invisible object that covers the section, I could calculate the intersection to stop the shadow from drawing so far but I haven't figured that out yet. Any suggestions or equations for finding an intersection of a line with the edges of a rectangle?