Only this pageAll pages
Powered by GitBook
1 of 16

Documentation (ENG)

Loading...

Getting Started

Loading...

Loading...

3D Object

Loading...

Unity Scene

Loading...

Scene Manager

Loading...

Samples

Loading...

Loading...

NReal

Loading...

Loading...

Placement by Raycast

Placement by Raycast

This is a sample of placing 3D objects on to the surface of buildings with the point of contact. Using mouse or touch panel, ray is casted that connects to camera's focal point, and thus calculate code based on transactional points with building mesh.

MaxstSceneManager.cs
public void AttachLogo()
{
    Vector2 vTouchPos = Input.mousePosition;

    Ray ray = Camera.main.ScreenPointToRay(vTouchPos);

    RaycastHit vHit;
    if (Physics.Raycast(ray.origin, ray.direction, out vHit))
    {
        maxstLogObject.transform.position = vHit.point;
        maxstLogObject.transform.rotation = Quaternion.FromToRotation(Vector3.forward, vHit.normal) * Quaternion.Euler(-90.0f ,0.0f, 0.0f);
    }
}
Example of Placement by Raycasting

AR Navigation

Description of AR Navigation using MAXSTVPS

AR Navigation

The code to determine the point of departure and arrival to find the navigation path is as follows. If you wish to get a navigation path from the point of user's location, set arCamera.tranform.position as a point of departure. This will only be successful if the localization is practiced correctly.

MaxstSceneManager.cs
public void OnClickNavigation()
{
    NavigationController navigationController = vPSStudioController.GetComponent<NavigationController>();
    navigationController.MakePath(arCamera.transform.position, new Vector3(77.975977f, 0, 71.859565f), serverName);
}

NavigationController is collected from VPSStudio GameObject. Through MakePath() from Instance of NavigationController, you will receive the path from the point of departure to the point of arrival.

AR Navigation Sample

Enter 3D coordinate value as the point of arrival based on the mesh of VPS Map.

  • arCamera.transform.position is position of camera in relation to VPS Map's coordinate system.

Nreal Support

In order to support Nreal Glasses, Nreal Unity SDK is required. click to download the SDK. Download Nreal Unity SDK and click Assets/import Package to add onto your project.

In order to support Nreal Glasses, MAXSTVPS Unity SDK for Nreal Glasses is required. Click to download the SDK. Click Assets/import Package to add the SDK onto your project.

Unity Scene components for Nreal Glasses are as follows. Detailed information regarding Unity Scene components can be found in the link below. ARCamera from the former Unity Scene is replaced with NRCameraRig.

ARCamera from SceneManager is replaced with NRCameraRig Object

SceneManager Components for Nreal

‌Play() of Instance from NRCollect YUV starts Nreal Camera.

VPSTracker Start can be found in the page below.

This is a code for ARFrame Instance from Unity Update(). This is a code to obtain the posture of 6Degrees of Freedom on VPS Map at the time of update and reflect it on the virtual camera for rendering.

Nreal Unity SDK Download

MAXST VPS Unity SDK for Nreal Glasses Download

Unity Scene Components

SceneManager Components

here
here
Unity Scene Components
Unity Scene Hierarchy for Nreal Glasses
NRealSceneManager.cs
nRCollectYUV = new NRCollectYUV();
nRCollectYUV.Play();
TrackerManager.GetInstance().StartTracker();

if (serverName != "")
{
    string vpsquery = "{\"vps_server\":\"" + serverName + "\"}";
    TrackerManager.GetInstance().AddTrackerData(vpsquery);
}
NRealSceneManager.cs
void Update()
{
    TrackerManager.GetInstance().UpdateFrame();
    nRCollectYUV.UpdateFrame();
    var eyePoseFromHead = NRFrame.EyePoseFromHead;
    Matrix4x4 Mhe = MatrixUtils.ConvertPoseToMatrix4x4(eyePoseFromHead.RGBEyePos);

    ARFrame arFrame = TrackerManager.GetInstance().GetARFrame();

    if (arFrame.GetARLocationRecognizeState() == ARLocationRecognizeState.ARLocationRecognizeStateNormal)
    {
        Matrix4x4 targetPose = arFrame.GetTransform(Mhe);

        arCamera.transform.position = MatrixUtils.PositionFromMatrix(targetPose);
        arCamera.transform.rotation = MatrixUtils.QuaternionFromMatrix(targetPose);
        arCamera.transform.localScale = MatrixUtils.ScaleFromMatrix(targetPose);

        rootTrackable.SetActive(true);
    }
    else
    {
        rootTrackable.SetActive(false);
    }
}

Nreal Camera Start/ VPS Tracker Start

Get result for VPS Tracker

SceneManager Description

SceneManager Description

Description of Scene Manager

The following is code for required components of SceneManager

When rendered 3D Objects are visibly hidden from the building mesh is called Occlusion Culling. Occlusion is applied when runtimeBuildingMaterial is rendered.

스마트폰과 스마트 글래스와 같은 모바일 기기 환경에서는 아래 코드를 통해 하드웨어 카메라가 시작됩니다. MAC OS X와 Windows 환경에서는 VPSStudioController를 통해 선택한 시뮬레이션 데이터가 시작됩니다. 이를 통해 현장에 직접 나가지 않아도 앱 개발이 가능합니다.

VPS Tracker를 시작하기 위해서는 해당 VPS 공간지도에 접근할 수 있도록 서버 이름을 입력해야 합니다.

트래킹 결과는 UpdateFrame()과 GetARFrame()을 통해서 얻을 수 있습니다. GetARFrame()을 통해 얻은 ARFrame의 인스턴스에는 현재 트래킹 상태, 이미지, 6자유도 자세를 포함되어 있습니다.

ARFrame의 GetARLocationRecognitionState()를 통해서 현재 위치 인식 상태를 얻을 수 있습니다. 이 상태 정보에 맞춰 증강시킬 3D Object의 활성화 여부를 결정합니다.

Required components of SceneManager

Required Components

  • ARManager

  • ARCamera

  • VPSStudioController

  • CameraBackgroundBahavior

  • RootTrackable

Use VPSStudioController to learn the name of server using location positioning

Occlusion Culling

카메라 시작 / 시뮬레이션 시작

VPS Tracker 시작

VPS 트래킹 결과 얻기

MaxstSceneManager.cs
ARManager arManagr = FindObjectOfType<ARManager>();
if (arManagr == null)
{
    Debug.LogError("Can't find ARManager. You need to add ARManager prefab in scene.");
    return;
}
else
{
    arCamera = arManagr.gameObject;
}

vPSStudioController = FindObjectOfType<VPSStudioController>();
if (vPSStudioController == null)
{
    Debug.LogError("Can't find VPSStudioController. You need to add VPSStudio prefab in scene.");
    return;
}
else
{
    string serverName = vPSStudioController.vpsServerName;
    vPSStudioController.gameObject.SetActive(false);
}

cameraBackgroundBehaviour = FindObjectOfType<CameraBackgroundBehaviour>();
if (cameraBackgroundBehaviour == null)
{
    Debug.LogError("Can't find CameraBackgroundBehaviour.");
    return;
}

if(rootTrackable == null)
{
    Debug.LogError("You need to add RootTrackable.");
}
MaxstSceneManager.cs
foreach (GameObject eachGameObject in occlusionObjects)
{
    Renderer[] cullingRenderer = eachGameObject.GetComponentsInChildren<Renderer>();
    foreach (Renderer eachRenderer in cullingRenderer)
    {
        eachRenderer.material.renderQueue = 1900;
        eachRenderer.material = runtimeBuildingMaterial;
    }
}
MaxstSceneManager.cs
if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsEditor)
{
    string simulatePath = vPSStudioController.vpsSimulatePath;
    if (Directory.Exists(simulatePath))
    {
        CameraDevice.GetInstance().Start(simulatePath);
        MaxstAR.SetScreenOrientation((int)ScreenOrientation.Portrait);
    }
}
else
{
    if (CameraDevice.GetInstance().IsFusionSupported(CameraDevice.FusionType.ARCamera))
    {
        CameraDevice.GetInstance().Start();
    }
    else
    {
        TrackerManager.GetInstance().RequestARCoreApk();
    }
}
MaxstSceneManager.cs
TrackerManager.GetInstance().StartTracker();

if (serverName != "")
{
    string vpsquery = "{\"vps_server\":\"" + serverName + "\"}";
    TrackerManager.GetInstance().AddTrackerData(vpsquery);
}
MaxstSceneManager.cs
void Update()
{
    TrackerManager.GetInstance().UpdateFrame();

    ARFrame arFrame = TrackerManager.GetInstance().GetARFrame();
    
    TrackedImage trackedImage = arFrame.GetTrackedImage();


    if (trackedImage.IsTextureId())
    {
        IntPtr[] cameraTextureIds = trackedImage.GetTextureIds();
        cameraBackgroundBehaviour.UpdateCameraBackgroundImage(cameraTextureIds);
    }
    else
    {
        cameraBackgroundBehaviour.UpdateCameraBackgroundImage(trackedImage);
    }

    if(arFrame.GetARLocationRecognizeState() == ARLocationRecognizeState.ARLocationRecognizeStateNormal)
    {
        Matrix4x4 targetPose = arFrame.GetTransform();

        arCamera.transform.position = MatrixUtils.PositionFromMatrix(targetPose);
        arCamera.transform.rotation = MatrixUtils.QuaternionFromMatrix(targetPose);
        arCamera.transform.localScale = MatrixUtils.ScaleFromMatrix(targetPose);

        rootTrackable.SetActive(true);
    }
    else
    {
        rootTrackable.SetActive(false);
    }
}

Setup Guide

Setup Guide of MAXSTVPS SDK

Requirements & Supports

Requirements

  • MAXSTVPS SDK recommends Unity 2020 or higher

  • In order to use MAXSTVPS SDK for Unity, you need basic knowledge of Unity developer tools and developer resources.

  • To find out more about developer tools for Unity, click for more information.

  1. Download MAXSTVPS SDK

  2. Create or Open Unity Project

  3. Newly created project, must download MAXSTVPSSDK_0.8.0.unitypackage and install on Unity

Description of File/Build Settings/Player Settings for Unity

Refer to the following Github links for Manifest and Gradle

MAXSTVPS SDK requires Editor Coroutines Package in Unity

VPS Map includes mesh, reference images and simulation data of the location. As suggested below, VPSData folder needs to be created at same hierarchy as Unity Project folder (MAXSTVPSUnity), and VPSMap folder needs to be saved under VPSData.

Once you unzip VPSData_yangjae_indoor.zip by MAXST, it automatically opens under VPSData folder as VPSMap and VPSSimulationData. yangjae_indoor folder will be generated automatically under these two folders.

Download VPSData and install VPSMap in accordance to location

Github Link

AndroidManifest.xml

MainTemplate.gradle

The type or namespace name 'EditorCoroutines' does not exist in the namespace ‘Unity'.  

Install MAXST VPS Unity SDK

Download these files via email.

Unity Setting

  • Android must only select OpenGLES3 in Graphic APIs on Other Settings

  • Android must uncheck Multithreaded Rendering

  • Android must have Custom Main Manifest & Custom Main Gradle Template installed on Publishing Settings

iOS must include descriptions for Camera Usage Description and Location Usage Description

Install Editor Coroutines Package

If the following message pops up, go to Unity > Window > PackageManager > Search Editor Coroutines and download the package

Install VPS Map

You must follow VPSMap Folder Structure in order to successfully activate VPS Map

here
VPSMap Folder Structure

VPS Map Coverage

Currently available VPS Maps

Around Yangjae Station, Seoul, South Korea

Gross Area: Approx. 79,659 m²

Landmarks

Latitude

Longitude

MAXST Office (1)

37.48513

127.03492

Yangjae Station Crossroad (2)

37.48450

127.03408

Map boarders (3)

37.48756

127.03168

Map boarders (4)

37.48798

127.03300

Map boarders (5)

37.48509

127.03555

Map boarders (6)

37.48369

127.03500

Map boarders (7)

37.48441

127.03214

VPS Map _ Around Yangjae station
VPS맵커버리지(영문).pdf
PDF · 397KB
Open
VPSMapCoverage_YangjaeStation

3D Object Placement

Easily place rendered 3D Object in UnitySceneView and precisely arrange its positioning via simulation using reference camera

Load VPS Map

Load VPS Map on VPSStudio GameObject via VPSStudioController

Select map in VPSStudio

Once VPS Map is loaded, it is presented in UnitySceneView as depicted below.

Unity Scene View once the map is loaded

Contents Placement

Placing content on Map is based on the location of the mesh. Place contents around mesh and confirm through ReferenceCamera

Place content around the mesh
Select ReferenceCamera around the mesh
Confirm through ReferenceCamera

Change the location of the content upon selecting ReferenceCamera, and the user will be able to accurately pinpoint its position.

Check the status of Content Generation via Simulation Data

Upon completion of content generation, you will be able to confirm through VPS Simulation Data on VPSStudio. The Simulation Data of the particular regions will be available on OSX or Windows.

The features of occlusion (Hidden features of building meshes) is specified on the page below

Mesh Settings for Occlusion

SceneManager Description
Unity Game View

Prerequisites

Requirements to MAXSTVPS SDK

MAXSTVPS Unity Project for Smart Phones

Included SDK Version

0.8.0

Requirements

Unity 2020 or later

Supported Devices

iPhones (supporting ARKit), Android Phones (supporting ARCore)

VPS Map includes the following information of the locations: Mesh, Reference Camera, Simulation Data

Placement by Raycasting, AR Navigation

Samples

Placement by Raycasting, AR Navigation

Included SDK Version

0.8.0

Requirements

Unity 2020 or later, Nreal Unity SDK

Supported Devices

Nreal Glasses

MAXSTVPS Unity Project for Nreal Glasses

VPS Map

Samples

Unity Scene Components

Detailed Information on Unity Scene components of MAXST VPS

Scene Components

The Unity Scene Hierarchy for MAXSTVPS is as follows.

  • ARCamera GameObject : Process tracking camera images and positioning

  • VPSStudio GameObject : Manage VPS Map data

ARCamera GameObject

ARCamera components

ARCamera reflects 6Degree of Freedom (Position/Rotation) of the camera on user's device

CameraBackground GameObject

CameraBackground display images extracted from hardware camera

VPSStudio GameObject

VPSStudio manages VPS Map data

VPSStudio Inspector

VPSStudio Controller menu is as follows:

  • Using VPS Map combo box, check the VPS Map list under VPSData Folder and select the desired location

  • Using VPS Map combo box, check the simulation data list under VPSData/VPSSimulationData/your_vps_map and select the desired simulation data

  • The mesh information & reference camera of the selected location will be loaded when you press Load VPS Map button

  • The mesh information and reference camera will be deleted when you press clear button

Navigation Controller will offer navigation function within the selected location

  • Position Distance indicates the interval between rendering arrow objects in alignment to navigation path. The unit is in meters.

  • Arrow prefab is 3D arrow objects in the navigation path.

  • Root Trackable is Root GameObject to render 3D Object on the navigation path based on tracking position

SceneManager manages VPS controls

  • Disable Objects are GameObjects that needs to be disabled from the perspective of Unity Play. (VPSStudio Game Object includes camera eye, thus needs to be disabled).

  • Root Trackable is GameObject that includes all tracking contents

  • Occlusion Objects are Mesh that needs to add occlusion from the perspective of Unity Play. If there are additional mesh that needs occlusion culling, you can simply add the following element.

RootTrackable GameObject : Root Object of rendered 3D objects on VPS Map

  • (Rendering 3D Objects must be placed under Root Objects)

  • SceneManager GameObject : Control MAXSTVPS actions

  • Reference Camara Controller will find the optimized perspective for 3D object placement

    Scene Manager

    SceneManager Inspector

    API Reference

    API Reference Link

    Click to check API Reference

    here