Hello community
in my space game I have troubles getting a nice shadow from the moon onto the earth. After solving the problem, that far away objects (moon) don’t cast shadows (solved by setting Dynamic Shadow Distance MovableLight to 10000000.0), I have now a disappearing shadow if I get to close with the camera to the earth.
The scene is lighten up by a movable directional light (embedded in a blueprint) at the position of the sun. The moon is also movable.
I have no idea, why the shadow is dissappering when I get closer (no transition). I played around with the values of the cascades but without any success. Does someone know why this is happening?
Thanks in advance!
Earth with shadow:
Earth without shadow (camera just was moved a little bit forwards):
Setup for the directional light (in blueprint):
Hello mgreg,
If you would go into your top/down viewport and middle mouse from your object to your moon you can then calculate how far you need those shadows to be drawn.
Also, make sure that you have Mesh Distance fields enabled, this will allow you to enable User RayTrace DistanceFields on your light.
Thanks,
Hello mgreg,
I haven’t heard from you in a few days. I was wondering if you were still experiencing this issue or had a chance to troubleshoot using the above mentioned steps.
Thank you,
Hello mgreg,
Due to tracking issues I will be marking this post as closed at this time. If you are still having this issue then please post again and I will continue to look into this issue at that time.
Thank you,
Hello Mgreg,
Due to tracking purposes I will be marking this thread as closed at this time. if you are still experiencing this issue then please post again and I will continue to work on this issue at that time.
Thank you,
Hello ,
thank you for your comment!
Unfortunately, this didn’t solved my problem. I have activated user raytraced distancefield shadows and set the value Distancefield shadow distance to the distance between sun (where the directional lights is situated) and earth - without any effect.
My obersavtion is the following:
As closer I set the moon to earth, the closer I can get with my camera (without losing shadow). E.g. if they are near to each other, shadows doesn’t disappear, even if I get very close to the earth.
Can this be connected to settings with cascades (cascaded shadow maps)?
Thank you very much!
Hello mgreg,
I have recreated a test project with a similar setup without adding the directional light to a blueprint.
Zoomed out View :
Zoomed In :
There have been vast improvements to shadow calculation from 4.7 to 4.8.3. There were issues with calculations of shadows from extreme distances and the feature of DistanceFieldShadows has addressed this.
What I would like you to do is to test this project in 4.8.3 and see if this fixes the calculation issue. You do not have to transfer anything over to go from 4.7 to 4.8. What you will do is launch 4.8.3 and then when the second window appears you can search for where you have your project saved. Another window will appear and say this project was made in a later version would you like to a make a copy. You will click yes and it will make a copy of your project and open it in 4.8.3.
If that doesn’t work then you can try taking your directional light out of your blueprint and using it as a stand alone standard light.
If these steps do not work. If you are willing to give me a copy of your project I can attempt to recreate the issue on my end using a controlled test. This way I am using all of your features that you have implemented so that there is no guess work with where the problem could be.
Let me know if this works,
Thank you,
Thank you very much for your effort! Unfortunately this didn’t solved the problem either. Sorry! I opened the project in 4.8.3 and tried to put the directional light without blueprint in the scene, with no success.
I guess its something stupid, some values I don’t understand so far and that I set in a wrong way. For this case I added 2 screenshots with all my settings of the directional light - just in case.
I absolutely would share the current state of the project with you for finding the reason. How can I contact you? Is there an option to drop a PN?
Hello Mgreg,
You can either link me a dropbox file here or you can zip it and e-mail it to me. You can e-mail me by clicking on my name and looking under contact info.
Thank you,
Hello ,
I didn’t found a contact info section in your profile, so I give you a link to my project here (Google Drive).
When you start the game (its actually an application for learning), you are near the sun. By facing the button (with the red cross) with name “Beamen” and clicking it with right mouse key and clicking on the earth beneath it (“Erde”), it will teleport you to the position of earth. There is a sphere for simulating the moon (on axis between sun and earth).
The link:
https://drive.google.com/file/d/0B46wleeU7VtLdEhwT2JNdHNZU2s/view?usp=sharing
Please, give a short sign,if your download finished successfully. I would like to take the file offline after that.
Thank you for your time!!
Hello mgreg,
So, I have opened your project and in theory it should work. However, at some point UE$ has it’s limitations and so do raytraces and the way light is calculated. UE4 is not a space simulator and my suggestion is to build at a much smaller scale. I played your game and in 10 minutes I still haven’t reached earth.
I handled a similar issue where someone had built a very large scene and then put a static mesh at a very long distance away. After zooming in then he saw z-fighting and issues with culling and calculation at distances that exceed what can be calculated.
Thank you very much for reporting this issue,
Hello ,
thank you very much for bringing light in the dark!
I know that it is very difficult for an engine to handle such large scales (due to floats). For that reason I have enabled origin rebasing, which works pretty well so far (beside at fast movement speeds, but I have implemented a workaround for this).
I would love to scale things down, but for a learning application the requirement was to simulate existing positions and relations.
Once again, thank you very much for your time and effort! I’m glad that I could discuss this issue with someone with more insights!