I’m doing a VR project where I have a big model made up of several different parts, and I need to highlight specific parts by fading out every other object leaving them at around 30% opacity.
I’ve done some research but I’m afraid I’m not knowledgeable enough to make sense of it all on my own.
From what I understand using straight up Opacity is far too expensive. Dither Temporal AA, like in this thread, results in this artifact lag that they mention in that same thread. Further on they talk about some quite technical rendering solutions that I have a hard time wrapping my head around. The main one seems to be to render it twice, once Opaque and once Transparent, and use “Custom Depth” to go between them?
Is that the way to go? If so I would be incredibly grateful if someone could give me a noob explanation to how it works.
And if not, is there a different, better way to do transparency in VR?
Translucency can be fine, if the material isn’t too expensive. Translucent rendering has a lot of limitations however, and if you want it to have the same quality lighting as opaque materials then it will indeed be very expensive. You need to test your performance and try to simplify as much as you can until it runs properly.
Dithering is very efficient and recommended if you can live with or work around the ghosting. The main thing is that it doesn’t work so well if you have large surfaces with constant opacity, but thinner bits of partially opaque geometry tend to look pretty good, like if you used a fresnel to drive the opacity so the outlines were more solid.
Beyond that, you would have to get involved with some kind of custom compositing. One trick that could work for you is to have your transparent stuff draw with every other pixel masked out, so that it looks like a checkerboard. Also have it draw into Custom Depth (might have to use a second copy of the mesh that doesn’t use the masked material, otherwise the custom depth will also be checkered). Then in a post process material, look for pixels that have custom depth values, and blend together the adjacent pixels in the checkerboard pattern yourself, using whatever blend factor you want. The result will be slightly blurred, but should be stable and consistent, with full deferred lighting.