Giter Site home page Giter Site logo

lzqlawrence / arexperiments-portal-painter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlecreativelab/arexperiments-portal-painter

1.0 1.0 0.0 16.42 MB

Doodle new worlds onto your own, with Google ARCore.

Home Page: https://experiments.withgoogle.com/ar/portal-painter

License: Other

C# 84.23% ShaderLab 15.77%

arexperiments-portal-painter's Introduction

Portal Painter

Doodle new worlds onto your own, with Google ARCore.

Portal Painter

Technology:

Portal Painter is built in Unity with Google ARCore. Portal Painter uses ARCore’s motion tracking and environmental understanding to let users paint, wander around, and peer into the portals they create.

When the user starts the app, they see particles appear on parts of the environment that they can interact with. When the user touches the screen, we use ARCore to detect whether their touch intersects with any detected real-world features. If we have a hit, ARCore returns data on what intersected with our raycast. If we intersected with a flat (i.e. horizontal) plane, we instantiate a portal at the correct location and orient it to match our plane's normal. If we intersected with a point in the point cloud (e.g. vertical features, which don't have planes or normals), we instantiate a portal at that location, but rotated to face the camera instead.

A portal contains a child canvas (invisible) and a child camera (spawned in one of the fantasy worlds). As the user continues to draw their portal, we raycast their touch onto the invisible canvas to figure out what pixels should become visible, while rendering the child camera feed to a texture. We then use a shader to combine these two textures into one, which we put on the portal itself, revealing the other worlds.

This is not an official Google product.

Develop:

After setting up and getting ARCore, you will want to do the following:

  • Make your worlds. Each world should be its own GameObject, and should have a child called Center located at whatever point you’d like the portal-camera to be. Whenever you spawn a portal, the UIManager will look for this Center object and place its camera there. (See the default DemoWorld object for an example.)

  • Add them to the UIManager GameObject. They will be accessed in the WorldTracker script. You may add a custom skybox for a particular world there as well (make sure their indexes match).

  • Build and run. Point your camera at your environment and wait until you see faint particles rise up from it. You can then use your finger to draw.

More granular instructions here.

Debug commands:

  • 2-finger tap to start painting with the next world (won’t change old portals)
  • 3-finger tap to remove all portals on-screen

Acknowledgements:

Built by Jane Friedhoff with friends on the Creative Lab team at Google. Sample model created by Alex Jacobo-Blonder. Check out more at AR Experiments or read more about ARCore.

arexperiments-portal-painter's People

Contributors

friej715 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.