- Home /
Always Show Distant Objects?
Hi there!
I placed an object as well as some terrain outside my actual game space to be part of the backdrop however I realized a few issues:
Once the game camera reaches the furthest areas of the map, the far clip starts to consume the distant objects. Also the objects shadows won't show because of the shadow draw distance being set to a reasonable number.
Is their some way to have these background object always visible along with their shadows with out setting the scene settings extremely high?
Thank you :)
Answer by FortisVenaliter · Aug 25, 2017 at 03:01 PM
The best way I've found is to render twice.
You have a background camera that just renders the low-res background. Set it's z-clip to, say, 100-100000 (good rule of thumb is to make your far clip 1000x your near clip).
Then set up your foreground camera to clear depth only and render after your background camera. Use your normal z-clip, but make sure the far clip is just beyond your far camera's near clip. If they're the same, there will be a seam (actually there will be a seam anyway for transparent bits like water, but there are ways to mitigate that).
Then simply make sure your far camera matches the position and rotation of your near camera each frame.
This technique is trickier in VR, but for single-camera setups, it tends to work quite nicely.
This worked out perfectly! Thanks for the detailed response and advice here :)
I'm still not sure how to get the shadows to display on the background objects though so if you have an idea for that, I would be grateful to hear it. As far as I can tell, it's a global quality setting and, unless I move the camera closer to the background objects, it won't display shadows within my shadow distance range.
Correct. There is a way to do it, however.... Scale down your background and put it in a new layer. Then make sure your far camera will only see the background layers and your near camera will only see the foreground. $$anonymous$$ake sure to scale the position too when syncing it.
That way, the background will be scaled down and will have it's own shadows (since objects on different layer in different renders won't cast shadows on each other).
However, this can look like garbage, depending on your scene. $$anonymous$$ost games, when doing this, will bake the lighting into the background so it doesn't need any lights when rendering (think the matte painting backgrounds in Halo or the Witcher 3), and still looks good. Obviously that won't work if you have dynamic time of day, however.
Okay I understand! That gives me plenty to go on while creating my own setup. Thanks a bunch!