Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Latest ARFoundation experiment: Blending digital objects with your environment.

Discussion in 'AR' started by KingOfSnake, Apr 4, 2019.

  1. KingOfSnake

    KingOfSnake

    Joined:
    Feb 24, 2013
    Posts:
    31


    Breakdown
    1/6 Blob Shadow - Ground your digital object with a blob shadow.
    2/6 Light Estimation - Calculate light intensity based on the average color of the camera feed.
    3/6 Sun Direction - Determine sun direction based on your mobile's longitude, latitude, time of day and true north.
    4/6 Real-time Shadow - Use ARKit's ARSurface shader for real-time shadow and determine shadow intensity based on light intensity.
    5/6 Realtime Reflection - Use the camera feed as input for your real-time reflection probe.
    6/6 Camera Effects - Add additional camera effects like Color Grading and Fast Vignette for a stylish look.
     
    AlbyDj90, enhawk, dnnkeeper and 3 others like this.
  2. Saicopate

    Saicopate

    Joined:
    Sep 25, 2017
    Posts:
    76
    Does it work for Android as well?
    3/6 seems very innovative, would love to know how you made it and how effective it is knowing the wobbliness of compass readings :)
     
  3. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    198
    I got a similar result with my own implementation. My question is, did you use anything special for realtime reflections ? I use microsoft's mixedreality toolkit, it comes with a runtime cubemapper, than assigns it to reflection probe. But I wonder about your implementation, because performance is a concern in realtime reflections.
     
  4. BinaryBanana

    BinaryBanana

    Joined:
    Mar 17, 2014
    Posts:
    81
    Looks great! Which values are you taking from light estimation? Any chance to get a sample code at some point?
     
  5. KingOfSnake

    KingOfSnake

    Joined:
    Feb 24, 2013
    Posts:
    31
    This is a screencast from my Samsung S8 and runs at 45 FPS.

    For the sun direction, I am taking the moving average of the last x values of compass reading before the object is placed. When the object is placed, the moving average at that specific moment is set as true north.
     
  6. KingOfSnake

    KingOfSnake

    Joined:
    Feb 24, 2013
    Posts:
    31
    I update the reflection probe via script every x frames, set the time slicing to individual faces and set resolution low. This step has definitely got the biggest performance hit.
     
  7. KingOfSnake

    KingOfSnake

    Joined:
    Feb 24, 2013
    Posts:
    31
    First I calculate the average color of the camera feed.
    Second I calculate the light intensity of the average color.
    Result is actually the same as ARCore light estimation :p
     
    BinaryBanana likes this.
  8. pedrobarrosbrasil

    pedrobarrosbrasil

    Joined:
    Apr 4, 2019
    Posts:
    8
    amazing work!
     
  9. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    Really a great job.
    Please make a tutorial.
     
  10. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    82
    Super cool! I'd like to know how did you make Realtime Reflection? Is it ARKit specific? I'm looking for an android solution.
     
  11. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    reflection probes are now cross platform afaik
     
  12. dnnkeeper

    dnnkeeper

    Joined:
    Jul 7, 2013
    Posts:
    82
    Couldn't get them working in the latest AR Foundation sample project. Have you got some info about it? Can't find anything about XREnvironmentProbeSubsystem supported platforms.
     
  13. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
  14. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    60
    Hey bro really mind blowing example , can you share your project for learning or create tutorial ? because light is most headache for me or as well as lots of member.
     
    DeanGiddy likes this.
  15. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,236
  16. SweetMei25

    SweetMei25

    Joined:
    Nov 17, 2018
    Posts:
    33
    Hello
    Skybox Reflection Probe not working in ARFoundation, I would appreciate if any professional can help me
    Thanks
     
  17. jalajshah

    jalajshah

    Joined:
    Mar 5, 2018
    Posts:
    60
    backed you probe it defiantly work
     
  18. heapify54

    heapify54

    Joined:
    Feb 23, 2019
    Posts:
    2
    Hello! How I can add realtime shadows for android with ar foundation? Can you give example?