- Home /
Is it possible to create a light only casts shadows?
I'm currently in need of a way to make a light that only casts shadows and does not apply any light to the scene or any objects. I know its possible to have a light with a very low intensity cast a shadow but this does not work for my current needs. I'm not familiar enough with how shadows are done in engine to understand if this is possible with custom shadows, or custom code.
With the way it works that would be impossible. A shadow is simply not applying the light from that point light. If your point light has 0 intensity, technically everything is a shadow. What are you trying to do with this behaviour. I can't understand how that would even work???
Not exactly. Shadows, (like a lot of things in computer graphics) work the opposite way from how they do in real life- by default, everything is illu$$anonymous$$ated and you need to remove the lighting from specific areas if you wish to cast shadows. What you do with the shadow map when you have generated it is the interesting part here- where usually, yes- it is used to disable lighting on specific geometry, it could also be used to create negative light (to reduce the amount of light created by other lamps).
Unfortunately, I have no idea how to do this in Unity. It's kind of a complicated question.
@syclamoth Yes, that is how the light is applied, however that does not change the fact that you can't cast shadows without light. Negative light is an interesting idea (it might cause problems if HDR isn't enabled though, aka colour loss), but I believe the OP is looking for something more along the lines of a "Projector"
Negative lamps are super useful for making tricked-out lighting, and I really wish Unity supported them. In this case though, a projector would work assu$$anonymous$$g the shadows only need to be cast in a single direction.
Answer by kondrup · Oct 08, 2013 at 03:11 PM
Maybe this can help?
http://answers.unity3d.com/questions/269292/having-an-invisible-object-that-casts-shadows.html
Hmmmm, I don't know Ben. I think he may be on to something...
why is the best answer in here downvoted? This does almost exactly what he is asking for.
This is not what the original question is asking for.
The original question was for a "light that only casts shadows", essentially darkening regions of the scene which would be in-shadow for an "imaginary" light.
This suggestion creates an object which casts shadows, but is not otherwise visible. It would cast shadows for all of the existing, visible lights, but would not add shadows without a light in the scene.
Answer by PS3_and_PC_Geek · Oct 14, 2013 at 08:45 PM
usually, the objects themselves have a check box that have Cast shadows and receive shadows, The free edition of unity now has shadow support for Directional lights though
Answer by DHoffman · Oct 14, 2013 at 07:19 PM
I had a similar need, for which Projectors would not be the answer. I wanted to have a light that casts a shadow under the character - which moves of course, so the shadow would also have to move. The purpose is to make it so that you can easily see where the character is over the ground when they jump. Without it, it's hard to tell whether you're in the air or just further away from the camera.
My solution was to do this with one directional pointed straight down with a very low intensity to cast the shadows, and a second directional with no shadows and higher intensity that serves as the primary lighting. (Also some point or spot lights for localized effects, but that's unrelated.) To avoid the washed out effect, I subtracted the shadow-light's intensity from the original fill-light's intensity, and it looks almost the same as it did with just the fill-light and no shadows. Not ideal, but may be the best you can do without some really heavy shader coding.
Answer by ratamorph · Dec 20, 2013 at 12:20 AM
I'm also needing something like this. All my lighting is done using lightmaps and light probes, I just want a dynamic shadow for my character, but is it somehow possible to skip all the lighting computation on the shaders and just do the shadow projection? I think it would be much more efficient.
Your answer
Follow this Question
Related Questions
How can I add volume/depth to shadows? 0 Answers
Dir Lightmap Performance VS Single Dir Light 0 Answers
How would I occlusion cull lights? 1 Answer
shadow problem , Android 1 Answer
Optimize Shadows for Moving Light 0 Answers