How to render a mesh behind another mesh, like a mask?
I've tried googling this, but I've been having trouble phrasing this
problem because I don't know the terms involved in the process.
To be blunt: I would like it so that when mesh A (the character), is
behind mesh B (a wall), it is still rendered but with a solid gray color.
I'm beginning opengles 2.0 and I'm still unsure as to go about this. From
what I understand the depth buffer allows meshes to fight out who will be
seen in the fragments they encompass, also there are various blend
functions that could possibly involved in this, finally the stencil buffer
looks like it would also have this desirable functionality.
So is there a way to output different colors through the shader based on a
failed depth test? Is there a way to do this through blending? Or must I
use the stencil buffer some how?
And what is this technique called for future reference? I've seen it used
in a lot of video games.
Thanks
No comments:
Post a Comment