Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

How do I cast shadows in ARCore?

Discussion in 'ARCore' started by tomicz, Mar 24, 2018.

  1. tomicz

    tomicz

    Joined:
    Mar 16, 2015
    Posts:
    116
    Hello there,

    I can't find a way to cast shadows in ARCore, is there some solution to this? I tried with planes and shadow shader that I use in Vuforia, but it does not work with ARCore.
     
  2. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    61
    Shadow casting is something you have to make yourself on top of ARCore. You need to add a light source with shadow casting enabled, you need to add a plane that receives shadows (and that plane need to be aligned with the tracking plane), and you need to use objects that have cast shadows enabled.

    The plane that receives the shadows need to have a transparent material that receives shadows, in order to make it look like the shadows are cast onto the "real world". Such a shader isn't included in the ARCore package, but I've attached one here. It's made in Amplify Shader Editor, but you should be able to use it without Amplify.
     

    Attached Files:

    asa989, Privateer and robrtoprz like this.
  3. tomicz

    tomicz

    Joined:
    Mar 16, 2015
    Posts:
    116
    But what about the size, I need to make my targets small, but shadows are pixalated, because ARCore is using real life measurements, like 0.1f is 10cm. Can I make 1f equal 10cm? I need larger objects for better quality shadows.
     
  4. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    61
    Try to decrease shadow distance under quality settings
     
    ted537 likes this.
  5. Privateer

    Privateer

    Joined:
    Jun 5, 2016
    Posts:
    7
    I've tried this shader. Thank you, by the way.
    But it renders the ground plane opaque grey.
     
  6. Shunaev

    Shunaev

    Joined:
    Mar 4, 2015
    Posts:
    8