Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed May 20, 2021 at 01:09 AM by NatCracken for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by NatCracken · May 30, 2020 at 07:00 PM · shadowsprecision

Is it possible to manually set the origin of shadow cascades

I am prototyping a game that makes heavy use of telescopic sights. For the sake of visual fidelity, I would like realtime shadows to sometimes be visible at extreme ranges; so that the player has a good view of the environment when using a scope. My current implementation simply multiplies the maximum shadow range by the magnification factor of the current scope, and it does the job.

Unscoped

alt text

Scoped

alt text

This works great, but only when the camera is still. When the camera moves, shadows in the distance flicker and flash. I suspect this is a precision thing that can't be solved without the brute force of a beefy computer. (If I'm wrong about this assumption, please let me know. I'd love a solution that doesn't involve messing with backend systems)

With that established, I'm wondering if its possible to provide whatever part of unity handles shadows with, say, a point in 3d space from a raycast; and then have the shadow cascades expand out from that point, instead of the active main camera?

This is only what I infer would be the best solution to high precision realtime shadows at a distance. If there's a better way to get a similar effect, I would be equally appreciative of a nudge towards it. Thanks in advance

smallcascades.png (336.2 kB)
largecascades.png (197.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by xibanya · May 31, 2020 at 01:47 AM

This is happening because the cascades are based on the position of the camera. When you use the low FOV to simulate the scope, you're "zooming in" but the camera position isn't changing. There are a few ways to address this:

  1. bake the shadows in (I don't like this because it's time consuming and harder to maintain, but it's an option)

  2. switch to a camera that is actually closer for the zoom view

  3. adjust the shadow settings on the fly at runtime. You can adjust Shadow Distance to change the shadows -- larger distance means they'll draw farther, but at lower res. This can be a good strat to employ combined with other things; if you do it when swapping views or cameras it can be seamless.

  4. use a post processing effect to draw fake shadows with rays. Have a look at the built-in UnityShadowLibrary.cginc and Internal-ScreenSpaceShadows.shader for a foundation to start with. Basically, calculate the angle of the directional light against the world normal of the objects in scene and color in shadows where they ought to be yourself. You can view those included shaders by going to where your version of Unity is installed in program files or by downloading a separate copy here https://unity3d.com/get-unity/download/archive

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NatCracken · Jun 03, 2020 at 04:25 PM 0
Share

Thank you for the insight, marked as correct

Follow this Question

Answers Answers and Comments

127 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I would like to trie to make the shadows of my dungeon more pronounced 2 Answers

Why Inspector and Main camera are such different? No shadows as well :( 0 Answers

Unwanted shadows after baking lightmapping 0 Answers

How to remove weird "shadow/light" lines? 3 Answers

Shadows not being baked on static objects 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges