Hi, in our game we’re using a post-process material to draw dark outlines around all the objects in the environment via a scene depth comparison with the neighboring pixels. This effect looks good on the environment, but as an unfortunate side-effect all the debug shapes (spheres, lines, cones, etc) are also getting outlines, and as a result they are often turning black and it becomes hard to tell their color or differentiate them.
Besides completely disabling the post-process material when debugging, is there a way to exclude debug shapes from being affected by the post-process material? A couple sub-optimal methods I was considering was to a) somehow change the blend mode of all debug shapes to Translucent so that they will not be affected or b) somehow give all debug shapes a specific stencil value that is explicitly ignored in our post-process material. Although I’m not sure how I would implement either of these solutions.
Also, I typically create debug shapes from C++ like this:
Using a Custom Depth pass might be a solution. Here is a cel shader tutorial that uses Custom Depth to make specific objects be exempt from post processing:
Yes, this would work if I could set the Engine built-in debug shapes to use a specific custom depth stencil value. Any idea as to how one would accomplish this?
I found the scene proxies used for drawing the built-in debug shapes, so I almost found a way to do it:
#include "PrimitiveSceneProxy.h"
#include "Components/LineBatchComponent.h"
#include "Engine/World.h"
// call the below once somewhere
GetWorld()->LineBatcher->SceneProxy->SetCustomDepthStencilValue_GameThread(stencilValue);
// also call on world->PersistentLineBatcher and world->ForegroundLineBatcher if necessary
Unfortunately, this causes an external link error because the SetCustomDepthStencilValue_GameThread function is missing the “ENGINE_API” specifier and thus can’t be accessed externally.