3
\$\begingroup\$

I'm looking for a way to create a dynamic soft see-through hole effect for room walls. I know a few ways how to do it (for example multitexturing with second layer being the hole mask in screenspace), but all involve rendering walls with blending on which is too expensive for the mobile project I'm working on. Is there any way to do this without using blending on the whole geometry (the hole can appear in any place on any wall). Please see the attached image for a better illustration of the effect:

enter image description here

Also, I'm very open to any links to papers/tutorials that might not be solving the exact problem but doing something close that might get me on the right tracks. Thank you!

\$\endgroup\$
  • \$\begingroup\$ An alternative mechanic to consider would be to render an outline of the object when occluded, instead of making the walls appear transparent (e.g. this). \$\endgroup\$ – MooseBoys Sep 16 '15 at 20:01
1
\$\begingroup\$

You could add another camera which has only one specific layer that it can view. This layer should be the layer of your special object, so then you enable the second camera whenever you want to see the object through other objects.

\$\endgroup\$
0
\$\begingroup\$

Using two materials for walls. Solid one and trasparent one. Whe you decide to activate trasparency :

gameObject.renderer.material = transparentMaterial;

You can script some conditions, like to activate trasparancy when some interesting object is inside a particular range from camera..

\$\endgroup\$
  • 1
    \$\begingroup\$ Note that you may want to use renderer.sharedMaterial to avoid implicitly creating copies of the material that pile up in memory (they're not garbage collected in the same way as most other classes — you need to manually destroy instances you've dynamically created when you're finished with them) \$\endgroup\$ – DMGregory Oct 5 '15 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.