microsoft / MixedReality-GraphicsTools-Unity

Graphics tools and components for developing Mixed Reality applications in Unity.
MIT License
178 stars 41 forks source link

MeshOutlines effect is really bad. Is it possible to use the post processing in built-in Render Pipeline or Renderer Feature in URP? #209

Open Hanning-Liu opened 5 months ago

Hanning-Liu commented 5 months ago

As the title saying.

Cameron-Micka commented 5 months ago

Hi @Hanning-Liu, thanks for asking. Many modern mesh outline techniques are done using post processing. Post processing provides great quality outlines but can be prohibitively expensive on most mobile mixed reality devices (like HoloLens 2, Quest 2 & 3, etc.).

If you are targeting a device that is powerful enough to do post processing, I'd recommend exploring a technique like this: https://roystan.net/articles/outline-shader/

Else, you may be limited to mesh outlines. Do you have any scenarios which are particularly bad? I may be able to provide some advice.

Hanning-Liu commented 5 months ago

Hi @Cameron-Micka, thank you for your reply! I've seen the post you mention. And I'm using a similar package named "OutlineToolkit" downloaded from Asset Store: https://assetstore.unity.com/packages/tools/particles-effects/outline-toolkit-98020 And I also saw a method to implement this effect in URP: https://www.youtube.com/watch?v=LMqio9NsqmM

I'm developing an app on HoloLens2 only run with Holographic Remoting for now, so I think maybe it's ok to use post processing method to calculate the outlines. But it's definitely better if the ideal effect can be implemented using the MRTK MeshOutline package.

The ideal effect should be:

  1. The silhouette lines and the sharp lines inside the silhouette can both be displayed.
  2. The mesh object itself should be transparent.
  3. The front and rear occlusion and the intersection effect of lines should be correct.

The ideal effect looks like the image below: image

The problem with MRTK MeshOutline is that when the material of the gameobject attached with meshoutline script is changed to transparent, the outline will become a solid silhouette rather than lines. And it cannot display the sharp corner lines inside the silhouette. Like the image below showing: image

Cameron-Micka commented 5 months ago

Oh awesome, yes if you are using Holographic Remoting then rendering is happening on your PC so the use of post processing should be fine!

Thanks for the detail breakdown of where Mesh Outlines don't work and how you would like them changed. I'll keep this issue open to track this work.