1
\$\begingroup\$

In Diablo and similar games, when the player is behind an object from the point of view of the camera, the object will (partially) become transparent or disappears.

For example, in the picture below (image screenshot at 2:52 in this video), there are several wood beams on top right:

enter image description here

But when the player moves behind them, they disappeared.

enter image description here

How can I achieve a similar effect?

I could split every object into sub-objects. Then cast rays to find intersections, and tune down the opacity of the intersected sub-object to achieve this effect. But this would require a tremendous amount of work for the gazillion objects in the game, is there some more advanced technique?

(question edited according to comments)

\$\endgroup\$
2
  • \$\begingroup\$ We generally can't answer "how did game X achieve Y", and the way game X did it might not always be the best way for you anyway. So you usually get more useful, applicable answers by framing your question az "How can I achieve Y in my game?" To answer that, it helps to have some details about your game, like what tech stack you're running on (engine/libraries/target hardware). Information about how your environment is built so far helps too. \$\endgroup\$
    – DMGregory
    Apr 1 at 11:24
  • \$\begingroup\$ Something like this? gamedev.stackexchange.com/questions/152824/… The effect itself has a slight different look, but the same technic could be applied \$\endgroup\$
    – Zibelas
    Apr 1 at 13:51

0

You must log in to answer this question.

Browse other questions tagged .