Code Monkey home page Code Monkey logo

ar-portal-arfoundation-urp's Introduction

Get Flower from the mirror Touch Moon from the water

镜花水月 Kyōka Suigetsu: Fower in the miror, moon on the water
This Unity project is for achieving the aesthetics above that is visible but cannot be touched and cannot be described in words.

Installation

Unity 2022.3.17 Universal RP 14.0.9
AR Foundation 5.1.2
Apple ARKit XR Plugin 5.1.2
(optional, stable diffusion function required) Newtonsoft Json 3.2.1

1️⃣ Impossible Box

Introduction

Stencil function can be achieved through Renderer Feature in Universal Renderer Data to create portal effect. Through each portal the specific gameobjects can be seen and the maximum quantity of portals is 15 due to Universal Renderer Data.

Key Assets

Assets/RP/ArPortal_Renderer.asset

Filtering\Opaque Layer Mask Portal n and InWorld n should be unchecked.
Filtering\Transparent Layer Mask Portal n and InWorld n should be unchecked.
Portal n\Event BeforeRenderingOpaques
Portal n\Filter\LayerMask Portal n
Portal n\Overrides\Stencil Checked
Portal n\Overrides\Value n
Portal n\Overrides\Compare Function Equal
Portal n\Overrides\Fail Replace
World n\Event AfterRenderingOpaques
World n\Filter\LayerMask World n
World n\Overrides\Stencil Checked
World n\Overrides\Value n
World n\Overrides\Compare Function Equal

Layer of gameobject portal should be set to Portal n and gameobject masked by the portal should be set to World n.

Scene Recording

Impossible Box

2️⃣ Portable Door

Introduction

AR user can walk through the portal with AR device from AR experience to VR experience.

Key Assets

PortalDoor.csharp as the component of gameobject Portal which is the child of gameobject Portal Door.

Innerworld gameobject should be the parent of all the gameobject inside the portal, everything will be automatically controlled.
In World Layer int should be the number of layer InWorldN.
Out World Layer int should be the number of layer OutWorldN.

Scene Recording

Portable Door

3️⃣ Portable Object

Introduction

specific gameobject such as the blue ball in the scene can move through the portal from inner world to outer world.

Key Assets

PortableObject.csharp as the component of gameobject Portable Object which is the child of gameobject InnerWorld.

Innerworld gameobject should be the parent of all the gameobject inside the portal, everything will be automatically controlled.
In World Layer int should be the number of layer InWorldN.
Out World Layer int should be the number of layer OutWorldN.

Scene Recording

Portable Object

4️⃣ Halfway Through Door

Introduction

Show how to use both Stencil and Depth buffer to make object halfway through the portal door.

Key Assets

ArUrp.assets Universal Render Pipline Assets's Depth Texture should be turn on
DepthMask.shader The shader of Depth Mask gameobject to mask object
SetRenderQueue.cs The script Depth Mask gameobject to force the render queue of depth mask

Queue Element0 should be 1980

Art Assets

Animated Model used in this project Animated 3D Tyrannosaurus Rex Dinosaur Loop by LasquetiSpice is licensed under Creative Commons Attribution.

Scene Recording

Halfway Through Door

5️⃣ Dome Slider

Introduction

Dome Slider has a slider in the right side of the screen which can be used to fade in and out gameobject Dome.

Key Assets

DomeSlider.shadergarph The shader of Dome's material

Skybox Texture Texture2D a HDRI texture
Smoothness Float for better edge between skybox texture and reality world
Distance Float strength of VR

DomeSlider.csharp on gameobject Dome

Slider Slider control the level of transition of skybox

Scene Recording

Dome Slider

6️⃣ Dome Transition

Introduction

Skybox texture of the dome can be transited by a button and the name of the skybox should be shown in a inputfield which can be prompt input area for AIGC such as Skybox AI Generator by Blockade Labs.

Key Assets

DomeTransition.csharp on gameobject Dome

Textures List<Texture2D> HDRI textures
Switch Button Button switch to next skybox
Input Field InputField
Initial Transition Speed float main transition speed
Acceleration float the accelaration that when fade out will speed up transition and speed down when fade in
Maximum Transition Speed float for better user experience during transition
Minimum Transition Speed float for better user experience during transition

Scene Recording

Dome Transition

7️⃣ Dome Transition Stable Diffusion

Introduction

This sample upgrade Dome Transition into a AIGC project that you can type prompt to have AI generated skybox texture on the dome.

Installation

  1. Stable Diffusion WebUI is required. I have made a basic Unity project RuntimeSD for using stable diffusion in realtime through the app you build to connect with your stable diffusion API. You can follow the instruction to install SD.
  2. Adding Launching Web UI with arguments: --api --share to the command line options in webui-user.bat will generate a random share link that is displayed in the command window, that you can fill in DomeTransition_RuntimeSD.csharp's Url.
  3. 360 Diffusion LoRA is required for Stable Diffusion in this project. This LoRA model should be put in ..\webui\models\Lora.

Key Assets

DomeTransition_RuntimeSD.csharp on gameobject Dome

Scene Recording

Dome Transition Stable Diffusion

ar-portal-arfoundation-urp's People

Contributors

tongzhou-yu avatar

Stargazers

Artem Pavlovsky avatar  avatar YL10 avatar  avatar Ju Zhang avatar Nix Liu Xin 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.