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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

4.20.2 Stencils & CustomDepth not working

4.20.2 stencils and custom depth does not work if called with c++ or blueprints. Only works if directly set in the editor.

Product Version: UE 4.20
Tags:
more ▼

asked Aug 31 '18 at 09:32 AM in Rendering

avatar image

Sreeragh
86 1 6 6

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

1 answer: sort voted first

I think i have found out the problem in Engine Version 4.20.2. While Enabling RenderCustomDepth in the Editor enables the flag "bRenderCustomDepth" in the primitive component, and it works just fine. Now if we use these functions

   void UPrimitiveComponent::SetRenderCustomDepth(bool bValue)
   void UPrimitiveComponent::SetCustomDepthStencilValue(int32 Value)
   
  

The functions call a game thread function and enqueues Render thread function to set the variable "bRenderCustomDepth" in Render thread (IDK why). The functions used for this are

   void FPrimitiveSceneProxy::SetCustomDepthEnabled_GameThread(const bool bInRenderCustomDepth)
   void FPrimitiveSceneProxy::SetCustomDepthEnabled_RenderThread(const bool bInRenderCustomDepth)
   
  

This for some reason does not work. But if i set the bRenderCustomDepth Directly as in previous engine version like this

   void UPrimitiveComponent::SetRenderCustomDepth(bool bValue)
   {
       if (bRenderCustomDepth != bValue)
       {
           bRenderCustomDepth = bValue;
           MarkRenderStateDirty();
       }
   }
   
   void UPrimitiveComponent::SetCustomDepthStencilValue(int32 Value)
   {
       // Clamping to currently usable stencil range (as specified in property UI and tooltips)
       int32 ClampedValue = FMath::Clamp(Value, 0, 255);
   
       if (CustomDepthStencilValue != ClampedValue)
       {
           CustomDepthStencilValue = ClampedValue;
           MarkRenderStateDirty();
       }
   }
  

This works and stencils now work properly. The only place this flag "bRenderCustomDepth" is used is in "SceneVisibility.cpp" in line 1831 and 1994. I am not sure if these places are in a function called by the render thread. Would like to know from a UE4 staff about this. But for now setting it from the game thread works fine without crashes in the editor. (Will check built version later).

more ▼

answered Aug 31 '18 at 09:34 AM

avatar image

Sreeragh
86 1 6 6

(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