Jump to content

Detecting shadow


Alienhead
 Share

Recommended Posts

Working on my competition entry,  I'm kinda stuck on something, and I may end up ditching the idea before I spend to much time on it. .  I was wondering if anyone may have derived a solution to detect when a player ( or any entity mesh ) is in a shadow volume ?

Think back to the game Thief, when hiding in the shadows was possible via Lightmapping but I haven't found a way to do it with these real time lights..  

I'm only happy when I'm coding, I'm only coding when I'm happy.

Link to comment
Share on other sites

I've seen this asked elsewhere and the answer was to try casting rays at the lights. However, that method could trigger when only partially covered in shadow.

  • Like 1

i now hate love C++

Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep

RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect

Link to comment
Share on other sites

What if you casted a ray from a few of the players AABB corners to the light and used a weighted average of each result?  I'm not sure how fast each ray cast is though.  You could do a quick ray cast to see if there are any AABB's along the way to the light, then do the more complex check after that.   Maybe there's also a way to use the shadow map - if you can access it...  I don't know exactly how the shadows work but if  you could see how much of your player was visible in the shadow map that might do the trick.

  • Like 1
Link to comment
Share on other sites

Thief also had very much approximate shadow detection so I don't think it was much more complicated than couple raycasts. I remember light indicator randomly changing while moving in an evenly dark hallway.

What's much cooler is that supposedly the guards in Thief 3 can see your shadow even if they don't see you directly.

  • Like 1
Link to comment
Share on other sites

16 minutes ago, Genebris said:

What's much cooler is that supposedly the guards in Thief 3 can see your shadow even if they don't see you directly.

To get that effect one could probably make an object that positions itself so that the player is in-between it and the lights. And then check if the guards can see that object.

i now hate love C++

Beeeeeeeeeeeeeep~~This is a test of the emergency signature system~~Beeeeeeeeeeeeeep

RX 6800XT | i5-13600KF | 32GB DDR5 | 1440p is perfect

Link to comment
Share on other sites

2 hours ago, IceBurger said:

To get that effect one could probably make an object that positions itself so that the player is in-between it and the lights. And then check if the guards can see that object.

I would say you project from a light into player bone and then further into first surface hit. This is basically a point inside player's shadow and you can check it's visibility now. But it might also be inside some other shadow 🙃

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...