microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Spatial Mapping Renderer = Hot Pink #58

Closed richiecarmichael closed 8 years ago

richiecarmichael commented 8 years ago

After adding the HoloToolkit to a new Unity project and assigning it to collection of holograms, the inside of my office is rendered in spectacular hot pink. By default, my holograms should be occluded by my office walls. I suspect that the renderer is not locating the occlusion material.

My fix:

  1. Set the Renderer Mode to Material, and
  2. Drag and drop HoloToolkit/SpatialMapping/Materials/Occlusion on to Render Material.
angelaHillier commented 8 years ago

Hi @richiecarmichael, When did you pull the HoloToolkit? Change #57 should have addressed this. It was just checked-in yesterday.

richiecarmichael commented 8 years ago

Hi @angelaHillier, it appears that my download does include the material path name fixed in #57.

richiecarmichael commented 8 years ago

Hi @angelaHillier, I just created a new Unity app from scratch with the toolkit's Spatial Mapping Renderer. Still hot pink. Had to explicit set mode to "material" and material to "occlusion".

jwittner commented 8 years ago

I'm up to date with master and am also seeing hot pink SR meshes.

  1. Create an empty scene.
  2. Create Empty object in scene.
  3. Add SpatialMappingRenderer component to the object.
  4. Build, Deploy, Run
  5. Observe pink walls.

I'm focusing on another issue, but thought another repro would be good on this. I can also confirm that the work around works for me too.

umamialex commented 8 years ago

Just cloned the repo today and enabled spatial occlusion in my project. I also saw hot pink. @richiecarmichael thanks for the heads-up.

angelaHillier commented 8 years ago

Found the problem. Resources.Load() is being used to load the occlusion material, but that material does not exist under a Resources folder. Since loading materials from Resource is actual not recommended, I'm going to expose two public properties on the Spatial Mapping Renderer component: Occlusion and Render Material, which will have the occlusion and wireframe materials pre-mapped.

angelaHillier commented 8 years ago

I currently have a pull request out to help address this issue. Note: my change will still require that you manually set the 'Occlusion Material' and 'Render Material' for the Spatial Mapping Renderer component, or else you will see hot pink for the mesh. I considered making a prefab that has these materials pre-wired, but it did not offer as much flexibility as keeping the components separate....

angelaHillier commented 8 years ago

I've updated the rendering component to expose an 'Occlusion Material' property. You still have to set the material manually to avoid seeing hot pink though! We've moved away from loading the materials for you, since there is no guarantee that they'll be there and/or that the folder structure won't change again.