Render a Mesh which is in front of everything.

Hi,

I found the thread which was talking about disable Disable Depth Test, Disable Depth Test - Opaques - Rendering - Epic Developer Community Forums

I am very interested in the solution which was mentioned in thread

An alternative solution is to selectively clear depth. For example you can render the meshes at the end of the depth-only prepass with depth testing disabled and tagging those pixels in the stencil buffer. Then enable stencil test in the base pass to not touch those pixels. At the end of the base pass you turn off stencil test and render your foreground meshes with depth testing enabled to get their properties in the gbuffer."

As I am not a rendering programmer but A general programmer, could anyone help me that where I should start to “render the meshes at the end of the depth-only prepass with depth testing disabled and tagging those pixels in the stencil buffer. Then enable stencil test in the base pass to not touch those pixels. At the end of the base pass you turn off stencil test and render your foreground meshes with depth testing enabled to get their properties in the gbuffer” please?

are there any virtual function or functions from staticmesh component I can override to do it? or do I need to render such mesh into render target to do some tricks?

Thanks a lot.

Just working out algorithm for our game which is FPS game for rendering weapon in front everything.

Our solution is that when rendering weapon mesh, we construct adjusted component to world matrix by move/scale weapon towards camera into collision capsule. The following pictures show the result.

Hi ,

this looks great!
would you mind to share your solution?
Or give me a starting point to do it for myself.

Best
Dennis