Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Customizing the Reflect Viewer with Unity Pro

Discussion in 'Unity Reflect' started by FredMoreau, Jul 20, 2020.

  1. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
    Hi,

    to those who want to customize the Reflect Viewer, here's some information to get you up to speed.

    I've created a "non officially supported" Unity Project Template that you can use.
    Here's a video that shows how to use the template to customize the viewer.

    A link to the template is provided in the video description.

    Now this template is based on Reflect 1.1 for now.
    Which means that using it, you will miss the latest features from 1.2 (Cloud support, Teleport and SunStudy).

    In the meantime, you can also start from scratch, following those steps :
    • Create a new Unity Project (from the standard 3D template)
    • Add the latest Reflect Package from the Package Manager (1.2.0-preview.6)
    • Add the VR package (https://github.com/Unity-Technologies/com.unity.reflect.vr) as it's been separated from the main package.
    • Add the AR package (https://github.com/Unity-Technologies/com.unity.reflect.ar)
    • For both packages, download and extract the content of the tgz file, then put it in your local packages folder, or anywhere on your drive and them through the Package Manager using "Add from disk".
    • Locate the Reflect prefab (in Packages/Unity Reflect/Runtime/)
    • Duplicate the prefab in the Assets folder (so that you can edit it)
    • Instantiate the prefab copy in the scene, and delete the original camera and directional light (1.2 instantiates a light with SunStudy)
    • if you want to modify one of the nested prefabs beyond simple overrides, you will need to also copy them in the Assets folder for editing
    • make sure the project uses Linear Color Space in Project Settings / Player / Other Settings
    • API compatibility level should also be set to .Net 4.x
    • also, upon import, there should be a prompt, twice, to "patch" the Input system, simply accept it
    • if you want to customize the VR mode, there's an option in Project Settings/EditorXR/Context Manager, to show the gameObjects that are created at runtime and otherwise hidden from hierarchy view
    I'll post an update here when I'm done updating the template to 1.2.

    Hope this helps!
     
    DavidMenard, UnityPeterD and Kjelle69 like this.
  2. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
    This is version 1.2.0 of the template, working with Reflect package 1.2.0-preview.26.

    To install it, download and unzip the zip file.
    Place the tgz file in the following location :
    C:\Program Files\Unity\Hub\Editor\2019.4.4f1\Editor\Data\Resources\PackageManager\ProjectTemplates

    Note that it does not include the Reflect AR nor Reflect VR packages, that you need to download from the following repositories, extract and add to your local packages folder.

    Reflect VR package : https://github.com/Unity-Technologies/com.unity.reflect.vr
    AR package : https://github.com/Unity-Technologies/com.unity.reflect.ar

    This version of the template includes a different example script from the first, showing how to access metadata and interact with the view filter.
    It also adds Input Fields to the SunStudy Lat/Long Sliders.

    Please post your feedback here.

    Also, check out our tutorials on customizing the Viewer here :
    https://learn.unity.com/course/basic-reflect-customization
     

    Attached Files:

  3. Murray_Zutari

    Murray_Zutari

    Joined:
    Jun 1, 2017
    Posts:
    29
    Thanks Fred, this update is working with cloud projects :)
     
  4. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    Is this compatible with MRTK and Hololens as well?
     
  5. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
  6. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    98
    Hey MattJezyk!
    We don't support the Hololens yet. The problem is that we use gRPC in Reflect for Syncing data, and it doesn't officially support Windows ARM64 devices like the Hololens 2. We willg et there in time thuogh.
    The other problem is model size - As yuo can imagine, most models will be too big to run at a smooth 60FPS on what is essentially a phone strapped to your forehead :) We're working on several improvements that will really help performances, but while we're waiting, we prefer to stay on the safe side and not officially support devices like the Hololens.
    David
     
  7. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    Hi @FredMoreau,

    I have some Revit 2020 models that successfully show in the Unity Reflect Viewer but when I try and load them in to Unity Pro using the instructions in this thread I get a bunch of "Failed setting triangles. Some indices are referencing out of bounds vertices" errors - seems like all the Host Objects (walls/roofs/floors) are failing to create the right geometry. Any ideas?

    -matt
     
  8. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    Hi @DavidMenard,

    I totally understand the issues here. We have solved similar problems both on the gRPC side and also the model size problem in other Unity projects we have worked on. For gRPC we used Web Sockets to connect to a small server on the laptop/desktop and relay to gRPC.

    For the geometry/facet/memory limits there are other ways to optimize the geometry and also manage what is on the HL2. We are currently using Bentley SynchroXR with the HL2 and it works pretty well within the hardware limitations of the device. There are also other ways to stream from the laptop/desktop or us Azure Remote Rendering.

    Would love to discuss more.

    -matt

     
  9. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    98
    That's a smart workaround, with the websocket! Our plan at the moment is actually just try and add the platform support to gRPC,since it's open-sourced. There was a PR for it but it was rejected, so we'll have to look deeper into it.

    We're working on a bunch of new data pipeline stuff in Reflect to handle streaming data directly ni the viewer, which will help a lot. Then of course we'll have to look into decimation an a whole bunch of other things. In the end we're confident we will get there, I just don't know when yet!
     
  10. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
    Can you share those models with us ?
     
  11. odehit

    odehit

    Joined:
    Aug 5, 2020
    Posts:
    6
    I have a feeling you ran into the same issue I had. See this thread:
    https://forum.unity.com/threads/problem-when-using-reflect-prefab-from-package-manager.946000/
     
  12. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    @odehit Good call. I was using 2019.2.12f1 and did see the same behavior you did. Upgrading to newest 2019 version now.

    @FredMoreau What is the minimum required version? Does reflect work better with 2020 versions at all?
     
  13. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    upgrading to 2019.4.x fixed the faceting issue
     
  14. mattjezyk

    mattjezyk

    Joined:
    Apr 29, 2019
    Posts:
    6
    hi @FredMoreau,

    I have the scene working well now in Unity Pro and have followed your sample videos.

    I'd like to:
    - Change the default camera position to one of my Revit cameras, so this is used on Play
    - 'Bake' a few of the loaded buildings into the scene, retaining the correct position, geometry, and material mappings. I have used the Reflect Package previously to import revit models into the Unity scene, is that still in the best way to end up with static content, not loaded at runtime inside the player?

    thanks,

    -matt
     
    Last edited: Aug 30, 2020
  15. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
    Hi Matt,

    yes, importing the model in the Editor is the easiest way to do all that.
    Although for Material Remapping, there's also a solution to add custom remaps to a custom Viewer in the Reflect Extensions package.
    For the Revit Camera, there's also something in that package. You need to import the samples.
    That said, note that it's only compatible with Reflect 1.1 for now.

    Hope that helps.
     
  16. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    226
    Hello,

    I'm a Unity developer and have an opportunity to develop a visualizer for an architecture firm, and this template sounds like the perfect solution. But there are a few things I need to understand better before I accept the challenge...

    - Is this custom viewer compatible with macOS?
    - Is this custom viewer compatible with HDRP and URP?
    - When you hit Play and select the project, is it actually loaded into Unity? I think that's what's inside Sync Root, correct?
    - Can I make a multi-camera setup to browse the project? On my player I will need to render two cameras and stitch into one big panoramic image, something I already do without Reflect.
    - My client's projects are all in 3DS Max, and I can't find anywhere if Reflect can read Max files. Can it?

    Thanks,
    Roger
     
    Last edited: Sep 8, 2020
  17. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    98
    Hey rsodre!
    - Is this custom viewer compatible with macOS? yes it is!
    - Is this custom viewer compatible with HDRP and URP? The viewer is currently built on the built-in pipeline, but you can switch it to URP & HDRP in the editor. We're currently working on a URP version of the viewer that we'll release in a few weeks.
    - When you hit Play and select the project, is it actually loaded into Unity? I think that's what's inside Sync Root, correct?
    Yes, it's actually loaded as GameObjects in Unity. You can download the project as assets in the editor, or keep working with the Runtime workflow, where the user publishes projects and the viewer loads them, without having to go through the editor. In that case, you will be customizing the viewer.
    - Can I make a multi-camera setup to browse the project? On my player I will need to render two cameras and stitch into one big panoramic image, something I already do without Reflect.
    Yes, no problem. Pretty much anything you can do outside Reflect can be adapted to work with Reflect. The Reflect project uses a good-old-fashion regular Unity Camera. Simply replace it with your rig!
    -
    My client's projects are all in 3DS Max, and I can't find anywhere if Reflect can read Max files. Can it?
    We don't have a 3dsMax plugin at the moment. We do ahve a publisher API available if it's something you'd be interested in building for your client. DM me if you'd like o know more!
     
    rsodre likes this.
  18. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    226
    Good!

    You mean I can load the Reflect project (models and materials) as assets in the Editor, without that template?
    If my client uses Reflect to build the scene, will I need Reflect+Pro to import and use it?
     
  19. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    98
    Yup, you can, without using the Reflect template! You will also need a Reflect+Pro license to build. The reason is that Reflect has a variation of a prefab, called a SyncPrefab, that keeps the link with the source, so you can update it. Meaning if your Revit project changes, you can sync those changes with the prefab.
    It also prevents one person being the "import monkey" for the rest of the company XD
     
  20. rsodre

    rsodre

    Joined:
    May 9, 2012
    Posts:
    226
    Sorry, but the Unity Pro requirement is a big marketing stupidity. There's no technical need for it.
    It just makes ArchViz harder and farther for independents.
    I could be using Reflect, but but the project got too expensive and I opted for some third-party plugin.
     
  21. DavidMenard

    DavidMenard

    Unity Technologies

    Joined:
    Jun 3, 2019
    Posts:
    98
    Thanks for letting us know you views on this. We're currently tracking usage and user feedback and I'll make sure we take this into consideration for our future plans.
     
  22. ohms99

    ohms99

    Joined:
    Dec 11, 2020
    Posts:
    1
    Hi, when I download reflect from the package manager, I don't see the reflect prefab to customize. I'm using unity 2019.4.16.
    Also if we want to make a custom solution for multiple clients, how would we import their revit projects into our application? Right now it sounds like each one of them would need a reflect license to export their files using the plugin even if they would be using our custom solution.
     
  23. FredMoreau

    FredMoreau

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    31
    From version 2.0, there is no more Reflect Prefab. To customize the Viewer, you want to fork the public repo.
    https://github.com/Unity-Technologies/com.unity.reflect.viewer

    Hope this helps.
     
    ohms99 likes this.
  24. XR_BBRI

    XR_BBRI

    Joined:
    Feb 25, 2020
    Posts:
    4
    Thanks for the information, it is not clear to me how can I make my own "viewer" in the Unity Pro Editor.
    Is there somewhere more information about that?

    Best regards,
     
  25. emmabnz

    emmabnz

    Joined:
    Jan 23, 2018
    Posts:
    5
    Is there a tutorial that shows how to customise the viewer after we have forked the repo? If I'm looking at the first post in this thread, what step does this one replace? apologies in advance if this is a silly question, just starting to learn Unity. Thanks!
     
    JNoon1 and boulakhoury like this.
  26. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,615
  27. JNoon1

    JNoon1

    Joined:
    Apr 21, 2020
    Posts:
    1
    yeah same question. Is there any documentation of this change and what the new fork and edit process is?
     
  28. eslamalmohandes

    eslamalmohandes

    Joined:
    Jul 10, 2017
    Posts:
    1
    so it seems that unity has changed its plans, and now you have to pay extra license fee to distribute your custom made viewer for your clients. I tried to connect unity but with no replies till now. can anyone here help me to know how much will i pay to distribute my custom reflect viewer for users?
     
unityunity