Closed Aleana27 closed 10 months ago
@Cameron-Micka Any insights?
Thank you for bringing this up @Aleana27. Unfortunately the mesh outline technique in MRTK has a few caveats which are mentioned in the docs:
Limitations of this effect include it not working well on objects which are not watertight (or required to be two sided) and depth sorting issues can occur on overlapping objects.
Your issue brings to light the "overlapping objects" problem. Which is also evident in the outline examples scene:
Note, one would expect the outline to be visible in the red circled area.
In order to stay inexpensive for mobile hardware the outline technique performed in MRTK happens in "world space" whereas most modern outline technique happens in "screen space" via a post process and/or offscreen rendering technique which makes this issue difficult to solve.
If you scenario only requires one object to be outlined at a time you might be able to achieve your desired look by using the outline feature and stencil buffer support built in the MRTK/Standard shader in conjunction. The setup is a bit more complex, but if you ensure the highlighted object writes a value in the stencil buffer and the outline material renders late in the scene (render queue 3000 or above) and checks the stencil buffer for this value you can achieve something like this:
We don't have an example of this in the toolkit, but a good starting point would be to see how the stencil testing feature works in the MaterialGallery example scene.
Typing all of this makes me thing we need an example of this at some point.
Thank you for your support. I managed to reproduce your solution in the example scene.
@Aleana27 can this issue be closed with this solution or are there other improvements you'd like to see here?
Yes, you can close this issue from my side. Thank you. Although it would be nice to see an example in the MRTK tutorials in the future like Cameron-Micka suggested.
Makes sense to keep this open until we can provide better examples. Thank you!
Assigning me and you Cameron for tracking
Linking this task since they are similar: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/8252
Mostly need example improvements.
This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.
We appreciate your feedback and thank you for reporting this issue.
Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.
Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.
Please note that MRTK3 was released in August 2023. It features an all new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visithttps://www.mixedrealitytoolkit.org.
Thank you for your continued support of the Mixed Reality Toolkit!
Overview
Hello, in our project we would like to use the Mesh Outlines as described here: https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/README_MRTKStandardShader.html#mesh-outlines Currently the outline shader is setup with Depth Write off so that it does not prevent other objects from rendering.
For our project we need the outline to highlight a part of a 3D object. If the part is embedded in the 3D model e.g. a screw on a wheel the whole outline would be missing due to the object being around it. On the other hand we also have separate floating menus which should not be overlaid by the outline when in front.
So the outline should be always in front regarding the 3D object but not regarding the menu items. In addition the menu items should also not be in front when the 3D model would be actually in front.
To conclude the outline should overlay some 3D objects but not all of the provided ones in the scene. Do you have a recommendation how we could achieve this behaviour with the MRTK Mesh Outlines?
Unity editor version
2019.4.11f1
Mixed Reality Toolkit release version
2.3