- Home /
The question is answered, right answer was accepted.
Still in UNITY 5 - Unbelievable: Spotlight Shadow cut off at "close" distance.
Edited: I downloaded Unity 5, and tested it there. Still the same embarrasing and immersion-killing bug. The following text is the original question#
Edit No 2: Updated to Unity 5.1! No fix or recognition of that bug anywhere. I got no response from my bug report. What went wrong in Unity?#
Edit No 3: I finally reached someone from Unity by reporting a completely unrelated bug in another ticket and asking them wtf is up with my report. It has been handed to the Developers now and will be fixed in the future. FINALLY. After 6 Years they started to LOOK into it.
Unity 5.1.2p3: still not fixed
Hi, this is my 3rd question here, I only post questions I can't find an answer to on Google.
The only entry relevant is another post on this forum but it is over one year old now and has no comments.
Here's my Problem:
For any Spotlight that is closer than some value, which seems to be corelating with the range, to an object, the object's shadow starts to get clipped/cut off.
For example:
I have a spotlight parented to my camera, no cookie, no script attached, nothing fancy attached. It is a plain spot light.
Spotlight has range 10. When moving it close to an obstacle, at some point the shadow of the obstacle starts clipping into the surface it is projected on. When moving even closer to the obstacle, the clipping continues until the shadow can't be seen anymore.
When increasing the range of said light, the clipping occurs earlier. I made a video to demonstrate it:
https://www.youtube.com/watch?v=fri2uwWIgtw
This video might be more useful to spot the bug:
https://www.youtube.com/watch?v=DdIKnxrc2AI
Please answer if you know what causes this problem. Thank you.
I found some posts from 2010 on Google, where people had a similar problem with spotlights only. There was no solution either. It seems that nobody cares about that problem.
This problem is more than 5 years old now!
It is a very annoying visual bug that makes using non-static spotlights impossible. Like flashlights, car headlights, etc.
Please note that this happens to spotlights only! Pointlights cast shadows until the "sink into" the obstacle.
If anyone has the slightest clue, please tell me!
It would really help if you could share your scene file with others, ins$$anonymous$$d of video.
pedja, the scene file would be useless since you could not open it.
I made another project in Unity 5 and uploaded it so you can look at it:
https://www.dropbox.com/sh/codk32octf45rz9/AADWBwmgZxEadfDrs-xklegNa?dl=0
You have to know something how to fix this, otherwise you would't have asked for the scene file, so please tell me what's wrong with my settings.
Thanks
So, pedja. 2 Weeks have passed, how did it help you looking at a project of $$anonymous$$e?
If you have any information about this, which I'm sure you do, because why else would you have asked for the scene file, please share it with me, and the internet.
Answer by Le-Pampelmuse · Oct 28, 2015 at 09:13 AM
Everybody, I'm sick of it now. Since that Unity employee told me, they would update the spotlight inspector to show the near clip value but it will NEVER be below 0.02f I am officially banning spotlights from everything I do in Unity.
Thank you Datapax for your input!
That's one of reasons why I joined Unity Answer because this is a big problem and I cant find on Internet anything. :(
It's a joke if you ask me. A very bad joke.
Answer by LSPressWorks · Apr 01, 2015 at 01:13 PM
try seeing if the shadow distance and cascade settings in quality helps. From what the video shows though, it looks like the near proximity is causing the Light objects cone to penetrate the object. Thus, from the perspective of the Engine, the light is shining from beside or behind those shelves.
Relax. People lose interest in helping if you're combative.
I cannot shrink the shadow distance anymore. I got it down to 50, which is my limit because that is the longest my player can "see" inside my level. I have tried all quality settings and lighting methods (deferred, deferred legacy, cascades, shadow resolution, etc...even linear or gamma color space which has nothing to do with it).
Can you answer me the following: Do you have that bug too? Can you try it please?
I have to know if Unity has terrible lighting on purpose, or if it has something to do with my setup..
Please can you try it?
Take any scene with a wall, a cube (1x1x1) and a spotlight (range 20) and move the light closer to the cube.
Thank you!
LSPressWorks, can you please tell me if you have this problem too? All the answers are fine and I am grateful for them, but no one has yet answered me the question if they have that problem too, or had it but solved it.
Answer by Datapax · Sep 16, 2015 at 03:34 PM
My friend, I am facing the same nightmare as you and I also think this is ridiculous and the dev's really have to get rid of this ASAP - it is just so annoying and painful for the eye and for my brain being unable to fix it.
However, I came up with a "FIX" for this problem and I would like to share it with you and others that can end up on this thread with this problem. So here is a little step by step for everyone, until they fix this bug from our worst nightmares ;D
Get a 3D modelling program, 3D MAX / Maya / Blender ... whatever you like and want.
Create a cylinder and make it hollow, so it represents the mesh of a real flashlight. I put a small box inside of the flashlight so I can use it later for a reference to attach the light. Finally - export and import to Unity.
Attach, scale and position your flash light as you like.
In the inspector be sure that you configure your cylinder "Mesh renderer" to cast "Shadows Only" and disable receive shadows. (this will hide the object and only leave us with the light effects, if you like it otherwise please feel free to configure as you like).
Attach a "Point Light" object to your "box" reference that you created earlier.
Set up the light as you like (range, color, intensity, shadow types and etc.)
Don't turn off your original "Spotlight". Instead just set the Shadow Type to "No Shadows" but leave the rest as you had it before. This way you still use the cookie texture and light settings if you had one before. It is your choice if you want to turn it off or change the settings in another way, but I recommend to keep it so it looks pretty much as intended.
This should be enough to have a nice looking flashlight with proper shadow mapping and no more "cutoff". You can adjust your settings even more if you want to reach a better effect and set your lights properly for your scenes. Be sure to review all the settings and polish everything to improve this effect. I hope this helps till we get some solution from the dev's.
Best regards and good luck to all. :)
I actually set the "Bias" and "Normal Bias" to 0 on the spotlight and the problem was fixed. No more "Point Light Flashlights" ;D .... Hope this helps for others. Good luck!
Buddy, I just wanted to update you on a completely working solution until Unity decides that spotlight have NO near shadow clipping, just like the pointlights:
Create a PointLight. Create a Cubemap with the Front(Z+) texture being the actual cookie you want to have, and the other 5 textures assign a plain black texture (check Alpha from Grayscale + Alpha is Transparancy). Assign the Cubemap to be the cookie for the light. It works like a charm since it is a pointlight.
If you don't want a characteristic cookie, just assign the "Default Particle" texture ;)
I will refuse to use spotlights until Unity is actually capable of todays standards in lighting (try the same in Unreal Editor, no problems at all, no clipping, nothing.)
I guess I will mention it in this thread when the day comes! Good Day to all of you
Hahaha, I did something similar, i actually made a "real" flashlight. The cone part, that reflects the light forward in real life, had a hole and I attached a point light as a child to it. Voila. It works perfect, the rendering impact (Cubemap-Shadowmaps for Point Lights) is 100% unnoticable.
I have just been informed by a Unity employee that:
"Indeed, our spot light shadow rendering code was setting up near clip plane for shadowmap at 4% of the light range. So the larger the light range, the further away near clip plane was. We just made the change that makes the shadow near clip independent on the range, smaller by default, and configurable in light inspector. That will probably ship in Unity 5.3."
Well, ok so why did they decide that Near Clipping Distance is 0.04*Range ? -.- I don't even want to know!
Finally! Can't wait for that EPIC moment.
Next thing would be the ugly point light 4-circle artefacts that occur on nearby surfaces. xD
Thanks for taking the time to write that reply! Hope this reaches out tho anyone who suffered like us.
Answer by pedja · Apr 03, 2015 at 05:18 AM
The only thing I found that helps at least reducing this problem is setting the range of that spotlight to much lower value, for example 5 (and you already know that). After that, you might increase light intensity a bit, just to get back similar level of light. Like LSPressWorks said, it's definitely happening when cone penetrates the object.
Follow this Question
Related Questions
How do you Turn off the Light Indicator Graphic(doesn't let me see my Characters)? 1 Answer
Unity 5 Spot Light no shadows or break in the light 2 Answers
Spotlights "turn off" a certain distance from camera? Possible Lab Renderer issue (maybe not). 0 Answers
How can I get spot light direction in forward add pass? 0 Answers
Getting trouble with lights 2 Answers