I'm trying to make dynamic sunrises and sunsets in my game but I have some problems. My scene is surrounded by mountains and when the sun tint is still hot the sun is not visible but, the trees that are far from the player (Around 100 meters) are lighted like if the mountains are not casting shadows, and when I get closer to theses trees they become black as they should be. If I extend the shadows distance it changes nothing. Also, when the sunrise, even if it should not be visible it should do some ambient lighting, but everything is totally black except some trees.
1 Answer
I would look at perhaps the shader materials, Light distance in shader.
https://forum.unity.com/threads/light-distance-in-shader.509306/
PeerPlay has great tutorials on shaders https://www.youtube.com/watch?v=t8qBCltSqV4
Custom fall-off https://docs.unity3d.com/Manual/ProgressiveLightmapper-CustomFallOff.html
Alternately the asset store might have something fun. https://assetstore.unity.com/packages/vfx/shaders/free-skybox-extended-shader-107400
https://assetstore.unity.com/packages/vfx/shaders/top-projection-shaders-pack-106862 https://www.youtube.com/watch?v=-XVxlqzcwR8
-
\$\begingroup\$ This answer would be even better if it included an example of how to use light distance in a shader to solve this issue \$\endgroup\$– DMGregory ♦Mar 5, 2020 at 23:55
-
\$\begingroup\$ Which object should have the shader on it? The mountains or the trees? I never used shaders \$\endgroup\$ Mar 6, 2020 at 1:23
-
\$\begingroup\$ I think I'd start with the trees, since they seem too bright I'd look at PeerPlay tutorials first to wrap your head around shaders, what they do, how they work. Shaders make the difference :) \$\endgroup\$ Mar 6, 2020 at 10:22
-
\$\begingroup\$ unity samples and documentation has examples to experiment with docs.unity3d.com/Manual/SL-SurfaceShaderLighting.html docs.unity3d.com/Manual/SL-SurfaceShaderLightingExamples.html docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html docs.unity3d.com/Manual/SL-VertexFragmentShaderExamples.html reddit.com/r/Unity3D/comments/5ij7uc/shader_examples \$\endgroup\$ Mar 6, 2020 at 10:32
-
\$\begingroup\$ Just adding more links to your answer increases the amount of information it could lose to link rot. Please edit your answer to actually describe the solution that you hope OP will glean from these links. You can use the links to give credit to sources you learned from, or give further reading/details/justification/evidence, but an answer should always be an answer — a self-contained solution — not just a breadcrumb trail to follow to the possibility of a solution somewhere off-site. \$\endgroup\$– DMGregory ♦Mar 6, 2020 at 12:25