MexSource Posted July 10, 2014 Share Posted July 10, 2014 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 Quote C++ :3 Link to comment Share on other sites More sharing options...
Josh Posted July 10, 2014 Share Posted July 10, 2014 A raycast can be used for this: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitypick-r158 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
MexSource Posted July 10, 2014 Author Share Posted July 10, 2014 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... Quote C++ :3 Link to comment Share on other sites More sharing options...
Josh Posted July 10, 2014 Share Posted July 10, 2014 If there is a clear line of sight between the character and the light, it is lit and not in the shadow. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
MexSource Posted July 10, 2014 Author Share Posted July 10, 2014 Well now I understand, thanks josh Quote C++ :3 Link to comment Share on other sites More sharing options...
MexSource Posted July 10, 2014 Author Share Posted July 10, 2014 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... Quote C++ :3 Link to comment Share on other sites More sharing options...
gamecreator Posted July 10, 2014 Share Posted July 10, 2014 Then you would need to take into account the angles between the light and the raycast. If they're too large then the character's in a shadow. Quote Link to comment Share on other sites More sharing options...
MexSource Posted July 11, 2014 Author Share Posted July 11, 2014 Sounds complicated, because i would have to try what are the angles myself, right? Quote C++ :3 Link to comment Share on other sites More sharing options...
gamecreator Posted July 11, 2014 Share Posted July 11, 2014 There may be a simpler solution but that's what I would experiment with. I think you may need to take relative positions into account as well. Quote Link to comment Share on other sites More sharing options...
Rick Posted July 11, 2014 Share Posted July 11, 2014 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. Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 11, 2014 Share Posted July 11, 2014 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. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Rick Posted July 11, 2014 Share Posted July 11, 2014 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. Quote Link to comment Share on other sites More sharing options...
MexSource Posted July 11, 2014 Author Share Posted July 11, 2014 Thanks for the answers, i will experiment with it tomorrow. Feel free to post more ideas Quote C++ :3 Link to comment Share on other sites More sharing options...
Josh Posted August 22, 2014 Share Posted August 22, 2014 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. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
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.