I’m trying to generate outlines for all meshes within a scene for an AR application (HoloLens/iOS). The 3D content will be imported into the app via assetbundle, and the requirements are as follows:
Each mesh (or cluster of meshes) will require a full outline. The model can include 1000s of meshes, so potentially 1000s of outlines.
All outlines in the FoV must be rendered in full (even if partially/fully occluded by another mesh)
Must run reasonable fast on indicated target platforms
I’ve found some screen space/post processing implementations that have been able to meet requirement 1 and 2, but fail on 3 (I was getting 1-2 FPS on HoloLens, and maybe 10 on iPad). I’ve also seen quite a few geometry/shader based approaches that fulfill requirement 3, but fail 1 and 2.
For further context, the meshes are planned to be rendered transparently, and only the outline should be visible. Essentially, I’m trying to give the user an idea of where something should be placed and giving them a view that will allow them to see the outline around the part they are placing. The outline behind another outline will let them know that another part needs to be placed as well, but is currently occluded by another part. This is where things get tricky.
I’ve done quite a bit of googling, and haven’t been able to find something that works. These requirements are not my own, but the customers, I’ve suggested displaying transparent views of all the meshes, but that’s not what they want.
Thanks, and sorry if this is not the correct forum to post in.
For making this work on multiple objects it needs to be changed to be two separate shaders & materials. One shader & material is just the “Occluded Fill” pass with all other passes removed. The other shader & material is four “Outline” passes. All the meshes you want to render with an outline need to first be rendered with the fill material, and then all of them rendered again with the outline material. That should result in the look you’re going for and fulfill all 3 requirements.
If the base shader doesn’t work, or is too slow, then I honestly have no idea how to do what you want on that hardware. I know Hololens is insanely slow when it comes to post processing, which is why a lot of other methods that “work” are too slow.
Thanks for the reply, I will give it a try! You’ve been extremely helpful. I think the answer might simply be “it won’t work and be fast” but people here say it should be easy, and won’t accept that answer from me.
This approach was cool, but produced a view where the outline behind occlude the one in front. It’s very possible I’m doing something wrong, but I generated 2 shader/materials (Pass1/Pass2) and applied them to the mesh renderer.
I also saw your post here: Overlapping Outline Shaders which also provides the effect I’m looking for (though not as clean as your medium post with the Jump Float Algorithm), but also same story… When one or two objects are in FOV, it runs okay, but as soon as you start adding more, the FPS drops.
Is there anyway to process a 3D outline view offline, and import that into Unity for viewing at runtime? I wouldn’t even know how to go about this as the outline would change as the viewing angle changes…
Yeah, that other approach is the “other” way to do it.
And no, there’s not a way to do it offline for 3d objects. The approach in that post you found is kind of the “next” cheapest option, and if that’s still too slow, then what you want to do simply isn’t possible performantly.