I have a mesh representing my character. I want to give it a partially transparent greyish silhouette when other objects are blocking it from view of the camera.

I'm using Ogre3D, and GLSL as a shading language, but this is a pretty technology/language agnostic question.


1 Answer 1


Draw everything apart from your character. Switch to front face culling, turn depth testing off, and render your character in a transparent grey colour. Then return to back face culling, turn depth testing back on, and render your character normally.

The grey outline always gets drawn, but if the character is visible/not blocked, it'll get drawn on top of the grey outline, hiding it.

  • \$\begingroup\$ I think this approach will not actually render an outline. It will render the occluded part of the character in the transparent grey colour. \$\endgroup\$ Feb 6, 2014 at 14:52
  • \$\begingroup\$ @dsilva.vinicius I actually wanted to do that. I probably didn't explain it well enough. Still trying to figure out how to do that with my Rendering engine. \$\endgroup\$
    – Pacha
    Feb 6, 2014 at 14:55
  • \$\begingroup\$ Before rendering the grey bit, render the model to a stencil buffer, but scaled down a little. That should cut a hole in the grey image so it's more of an outline. \$\endgroup\$ Feb 6, 2014 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .