MixedReality-GraphicsTools-Unity icon indicating copy to clipboard operation
MixedReality-GraphicsTools-Unity copied to clipboard

MeshOutline that works with depth sorting

Open Zee2 opened this issue 2 years ago • 3 comments

Describe the problem

It would be really neat to be able to use properly sorted depth with a mesh outline, in order to render hands using a nice outline, like so:

image

However, it gets wonky when other objects are involved:

image

Describe the solution you'd like

Out-of-the-box support for mesh outlines that respect depth.

Describe alternatives you've considered

A depth pre-pass/multi-pass shader should be able to do this.

Zee2 avatar Jun 07 '22 05:06 Zee2

You might be able to solve the issue in the bottom screenshot by rendering the hand at the end of the frame (in the overlay queue or manually with a URP render object feature).

But I agree this should work better out-of-the-box. We'll see if we can come up with a solution!

Cameron-Micka avatar Jun 08 '22 18:06 Cameron-Micka

Related issue: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/9630

Cameron-Micka avatar Jul 06 '22 22:07 Cameron-Micka

image

Cameron-Micka avatar Oct 25 '22 16:10 Cameron-Micka

Current plan is to add a checkbox to the inspector to automatically enable stencil based workflows.

Cameron-Micka avatar Oct 31 '22 21:10 Cameron-Micka

To mention one important architectural requirement as discussed:

The solution should work without restricting the design of the scene, specifically it should not add requirements to the materials used in the scene.

One way to achieve this may to move the stencil testing functionality shown in the above screenshot on left-hand side (on Gray material) could be moved to a tertiary invisible materials, added by MeshOutline. The primary material of the body could then be untouched whatever it may be.

NorbertNemec avatar Nov 02 '22 09:11 NorbertNemec

Totally agree @NorbertNemec, we'll make sure to add an option for a third material in charge of stencil writing.

Cameron-Micka avatar Nov 02 '22 17:11 Cameron-Micka