Unity-Technologies / com.unity.perception

Perception toolkit for sim2real training and validation in Unity
Other
892 stars 172 forks source link

"Ghost" artefacts in rendered images #580

Open Tachimura opened 1 year ago

Tachimura commented 1 year ago

Hello, I've been working with the perception package for a while now with some URP simulations. For some reason (URP not using alpha for background, etc...) i'm currently trying it out with HDRP but i am stuck with a problem.

Describe the bug

I'm trying to render some images but I'm having a strange "ghost" effect. Starting from the second rendered image i have all the previous renders greyed out in the background.

Here you can see the first render which is fine: step0 camera

In the second render you can see the first render being greyed in the background: step1 camera

From this point on all the previous renders (greyed out) keep getting stacked one over the other in the background: step9 camera

In the Instance Segmentation images only the correct objects are labelled (which is good): step9 camera instance segmentation

General Information

  1. Unity version in use: 2021.3.15f1
  2. Unity-Perception version in use: 1.0.0-preview.1

Additional context

  1. I'm using the HDRP rendering pipeline, all set to its default values (only the color buffer format is set to R16G16B16A16).
  2. All the perception settings are set to their default value.
  3. All the "greyed objects" are correctly destroyed before the next render (i currently wait ~300 frames between two renders)
mkamalza commented 1 year ago

The good news here is that your segmentation image only shows the current objects, which means they are being correctly destroyed/moved out of view. The issue with the RGB images is curious. I haven't seen that before. A couple of things you could try:

Tachimura commented 1 year ago

Hi @mkamalza and thanks you for the reply!

I've tried your tips but sadly, none worked.

GBuffers

While doing some more research about HDRP I found in this thread in the unity forum a user with a similar problem to mine and they say: "By default, HDRP didn't clear GBUFFER and some other buffers to get some GPU perf. " I tried to force clear the GBuffers as they mentioned but the useable methods and pipeline code do not match with what they posted (that thread was from 2019 so probably a lot has changed)

About GBuffers I've found some settings in the HDRP global settings under the header "Frame Settings", under all "Rendering" settings you can find there is a "Clear GBuffers" which is not checked, I tried to check it but again it didn't solve the problem. image

esgnn commented 1 year ago

Could it be related to Temporal Anti-aliasing? If it is on, could you please try again without it. image

Tachimura commented 1 year ago

@esgnn I tried all types of Anti-aliasing (No Anti-aliasing, FXAA, TAA and SMAA) but i keep getting these artifacts.

Also, this same project works fine (no shenanigans in the rendered images) if i run it with URP and the previous version of the perception library (Perception 0.11.2-preview.2). That's why i think it is something about HDRP that is creating these problems.

esgnn commented 1 year ago

@Tachimura hmm, how about motion blur? (don't forget to turn it of from default postprocessing effects). If doesn't work, maybe turning off postprocessing effects might reveal the culprit.

image

Tachimura commented 1 year ago

@esgnn I tried removing the Motion Blur but I keep getting the same artifacts. I don't know how to fully disable postprocessing so i just unticked all the effects in the volume profile (I hope it is correct). image

As you can see the overall quality of the rendered image decreased but the artifacts are still here. image

esgnn commented 1 year ago

Another thing you can try is to disable post processing all together for the camera. Couple of other questions just to be sure:

Tachimura commented 1 year ago

@esgnn I tried to disable post-processing from the camera as you shown me, but I keep getting the same artifacts. About the other questions:

Segmap Image: step6 camera instance segmentation