x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Is there a way to make debug shapes exempt from postprocessing?

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:

DrawDebugSphere(world, position, 25.0f, 6, FColor::Blue);

Here is a screenshot of how the debug shapes are turning black: alt text

Any ideas?

Thanks!

Product Version: UE 4.20
Tags:
more ▼

asked Aug 13 '18 at 04:57 AM in Rendering

avatar image

mpxc
91 8 12 16

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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:

https://www.raywenderlich.com/146-unreal-engine-4-cel-shading-tutorial ("Isolating the Cel Shader" section)

more ▼

answered Aug 13 '18 at 08:17 AM

avatar image

zoomcns
46 1 2

avatar image mpxc Aug 13 '18 at 08:24 AM

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?

avatar image zoomcns Aug 13 '18 at 09:06 AM

Oh yeah... if they can't have a material applied then this might be harder to achieve. Sorry, I don't have much experience with debug shapes :)

avatar image mpxc Aug 14 '18 at 04:45 AM

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.

Any ideas?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question