![]() ![]() In this image, you can see the errors can would occur if you have multiple meshes overlapping. It’s important to know that if multiple materials use this technique that only the object closest to the camera is culled correctly. This removes the need for a second mesh component which is a huge workflow improvement.įor our game Switch, we used this culling technique on a stealth effect giving it a more consistent ‘shell’ and highlight on a mesh that has a lot of overlapping pixels. Note: As of 4.20+ you can render translucent materials for Custom Depth by enabling the option in the material: “Allow Custom Depth Writes”. I rendered each character TWICE to work around a limitation where transparent materials do not render into custom depth at all (this is normal behavior for SceneDepth, but undesirable when explicitly enabling Custom Depth on a mesh with transparency applied) You can download the project source to see exactly how this was done. The character on the right displays all occluded pixels in red. I made a comparison of depth culling enabled and disabled in the setup below. ![]() Material Nodes – Copy this URL content and you can directly paste the above nodes into your own material. The material setup for this is quite simple: A slight depth offset should be added when comparing the depth of Scene and Custom to prevent too many pixels to be culled including the outer shell. We can solve this issue using Custom Depth.īy rendering our character into the Custom Depth buffer we can cull any pixels that are behind the outer shell of the mesh. When using transparency on models like characters that have inner triangles (eyes, mouth, arm, or bit of armor sticking through) you will see a noticeable highlight in your material that attracts attention and simply doesn’t look right. ![]() ![]() This enables us to create multi-colored outlines among many other cool new tricks! Click here to read about this new effect and how to use it. (Check the new paragraph for a much more detailed and advanced version of this effect!) NEW: Multi-Color Outline EffectĪ few engine versions ago Stencil Index buffer was added alongside Custom Depth. I skipped over most of the implementation details – if you have any questions feel free to ask them in the comment section below! I’ve made this effect available for download, feel free to modify and use this in your game. If CustomDepth is larger than SceneDepth we blend in a white tint with SceneColor.Ĭombining both techniques results in the post effect below: We can use another technique for drawing a translucent overlay for all occluded geometry by comparing custom depth against SceneDepth. If a neighbor has depth info but the pixel itself does not – we color it to our outline color. With the buffer filled with our object depth info, we can perform a simple depth comparison by sampling the neighboring pixels in our post-process. To render outlines around specific meshes (like a fallen ally, usable loot container, etc.) we need a buffer to get their silhouettes. To view the render output for this particular buffer go to Buffer Visualization in the viewport options of the Editor Viewport. Note that objects close to the camera are near-black and may be difficult to see! Custom Depth Visualizer in the Unreal Editor Rendering Object Outlines For those who have never used this feature before, you can enable Custom Depth for both Static and Skeletal meshes under the Rendering category named “Render Custom Depth” in the Details Panel. ![]()
0 Comments
Leave a Reply. |