Coder Social home page Coder Social logo

overlay-demo-unityxr's Introduction

Overlay-Demo-UnityXR

  1. Create a Camera that is only used for UI rendering. And remove other camera from the UI layer. UI uses Unity’s default interactive class. It is shown as below:

  2. Remove InputModule script within EventSystem, and add PUIInPutModule class and PicoBaseInput class as shown below:

  3. Create a RenderTexture whose size must be big enough to display complete UI. Assign RenderTexture to the UICamera created.

  4. Create a material which uses UnderlayHole.

  5. Create a Quad named as Hole (or else). The scale and position of Hole are subject to actual needs, but its aspect ratio should be consistent with that of TargetTexture in UICamera. Assign UnderlayHole to Quad.

  6. Create a new Quad named as Overlay (or else). Uncheck Box Collider and Mesh Render, and add PXR_OverLay class in Overlay. Transform information should stay the same as Hole.

  7. Assignment of the two parameters in ControllerPhysicRaycastManager class is necessary. The assignment for ray need to be updated per frame (normally the value is the direction of ray), and assign the Size of TargetTexture in UICamera to RT_Size, (i.e., Size of RenderTexture).

    Hole is the only detection object of rays, but detection codes can be modified based on actual needs.

  8. Update RenderTexture to Hole and Overlay per frame.

Note:

  • This demo is implemented in Unity 2020.3.36f1.

overlay-demo-unityxr's People

Contributors

picoxr 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.