Jump to content

Recommended Posts

Posted

Hey,

 

Is there any possibility to check if you are in a shadow?

I need this for a stealth like game (like the thief series).

 

And maybe how much of a object is in the shadows?

 

Thanks :)

C++ :3

Posted

Can you please give me some more information on this?

I don't see why I could use a raycast for this?.. Maybe I just got a blackout at the moment but, no idea...

:P

C++ :3

Posted

If there is a clear line of sight between the character and the light, it is lit and not in the shadow.

  • Upvote 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Posted

Actually not. If I have a point light shining to west and the character stands east, the raycast will say, there's no object between you and the light, but the light is shining into another direction...

C++ :3

Posted

You could always brute force it by making volume triggers where the light is shinning. When the character hits the trigger it sets a variable saying they are now be seen.

Posted

If directional light, just perform a raycast to the light - if clear line of sight then you are in the light. For spot / point lights, try setting up trigger shapes that match closely to the light's cone/diameter. If triggered, then you are in the light. If looking for stages of blending between light and shadow, maybe have multiple trigger shapes at various cone heights/ radii. Sounds like a perfect place to make heavy use of prefabs.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Posted

Yeah, prefabs would be great for that. You could combine a cone with a spotlight, and attach a script that could maybe resize the cone with the spotlight values inside Script:Start(). Same with a sphere and pointlight. Then just use the prefabs wherever you want to place your lights and you won't have to think about it ever again when you place a bunch in your scene.

  • 1 month later...
Posted

Well, culling will tell you if the object is within a light's volume. Point and spot lights do not use occlusion culling when rendering shadowmaps because the test involves latency, and the results are only available 1-2 frames after the fact. Since point and spot lights are only updated when needed, this would not be useful for them.

 

The raycast test would tell whether the object's center has a clear line of sight to the light, and is a pretty good blunt solution.

My job is to make tools you love, with the features you want, and performance you can't live without.

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.

×
×
  • Create New...