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"

TextureRenderTarget2D ClearColor does not working


want to clear the texture render target with specific color, when capture the scene.


am using SceneCaptureComponent2D with TextureRenderTarget2D.

I added only one PrimitiveComponent into the ShowOnlyComponents array in SceneCaptureComponent2D.

After then, I set the 'ClearColor' property of the TextureTarget as FLinearColor::Black. But it doesn't seem to be clear properly. Instead, it seams that SceneCapture clears the render target using gradation colors (like sky sphere)

alt text

I expected that the ClearColor defines the color of clear function(like glClear), am I wrong?

I decided to explore the engine sources.

When I call the CaptureScene() of the SceneCaptureComponent2D manually, the brief call chain is something like below.


=> FScene::UpdateSceneCaptureContents(..)

=> ENQUEUE_UNIQUE_RENDER_COMMAND_THREEPARAMETER (UpdateSceneCaptureContents at SceneCaptureRendering.cpp:526)

=> UpdateSceneCaptureContentDeferred_RenderThread

=> UpdateSceneCaptureContentDeferred_RenderThread

=> RHICmdList.ClearColorTexture(Target->GetRenderTargetTexture(), FLinearColor::Black, ViewRect) (at SceneCaptureRendering.cpp:218)

Yes, when I call CaptureScene, ClearColorTexture command is followed. Even though it does not clear the texture using ClearColor property, the texture render target should be cleared.

I don't want to add another dummy actors to represent background. It is not the absolute solution.

I am appreciate your help.


Product Version: UE 4.14
more ▼

asked Dec 15 '16 at 05:57 AM in Rendering

avatar image

13 1 4 5

avatar image alleysark Dec 20 '16 at 02:04 PM

I finally found that the AtmosphericFog makes the gradation background.

But I cannot find how could I disable this bloody AtmosphericFog at c++ code. I think the ShowFlags in USceneCaptureComponent is the way to go to the solution.

Am I right?

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

1 answer: sort voted first

Yeah, using something like CameraComponent->ShowFlags.SetAtmosphericFog(false); will disable rendering the fog in the background.

As an added bonus, you can use the ShowFlags.Set... commands to selectively turn off entire render passes, which I've used before to make the SceneCapture2D cameras less prohibitively expensive to use.

more ▼

answered Jan 31 '18 at 03:56 AM

avatar image

21 1

avatar image alleysark Jan 31 '18 at 10:00 AM

Ooh.. Thanks! Actually, I've already solved my problem like what you advice! Now I can have confidence in this way with your comment :D

(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