Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDRI Sky has weird visual artifacts/bright sparklies #36171

Closed
aclave1 opened this issue Feb 13, 2020 · 15 comments
Closed

HDRI Sky has weird visual artifacts/bright sparklies #36171

aclave1 opened this issue Feb 13, 2020 · 15 comments

Comments

@aclave1
Copy link

aclave1 commented Feb 13, 2020

Godot version:
Version 3.2
Works fine in 3.1.1
OS/device including version:
Windows 10, Desktop PC GTX 1070
Issue description:
In godot 3.2, when using a panorama sky with an HDRI panorama, weird artifacts appear. In the screenshot I posted, the model has albedo and roughness textures on all the meshes and also metallic on the armor. I am noticing these issues with 2 different meshes, each of which is a rigged character mesh.

I'm not an expert in lighting or graphics/hdri, but I think the problem is related to the resolution of some framebuffer in a shader? When i look at 3.1, I can clearly see very fine reflections from the hdri in things like the metal, and the clothes look very flat as expected. When I look at 3.2, the shading looks pixelated and stretched.

Steps to reproduce:

  • Open a project in godot 3.2 which uses an HDRI panorama skybox
  • Import a textured model

Minimal reproduction project:

Here's a screenshot of the same scene with Godot 3.1 on the left and 3.2 on the right.
image

@clayjohn
Copy link
Member

clayjohn commented Feb 13, 2020

3.2 is a huge improvement over 3.1. It should look as smooth as possible, but it is extremely hard to generate accurately filtered environment maps in a short amount of time. You can increase the quality of those reflections by increasing radiance_size on your Sky and by increasing the max_irradiance_size in the project settings.

BTW those sparkly effects in the 3.1 version are called "fireflies" and they are not supposed to be there. It's actually a huge problem that they are visible.

@clayjohn clayjohn added this to the 4.0 milestone Feb 13, 2020
@aclave1
Copy link
Author

aclave1 commented Feb 13, 2020

@clayjohn I didn't know the sparklys were bad I just thought I maybe had a bad material. I'm not necessarily wanting to improve the quality of the reflections, I'm more concerned with the bad streaking on the clothes and boots and his skin. I'm only noticing this effect on 3.2 with an HDRI.

@clayjohn
Copy link
Member

@aclave1 If you prefer the look from the left image you can something closer to it by turning off high_quality_ggx in the project settings.

@aclave1
Copy link
Author

aclave1 commented Feb 13, 2020

disabling high_quality_ggx made the streaking effect on the clothes and skin more pronounced
image

@clayjohn
Copy link
Member

Ah, thats too bad. You should still try my above suggestion

@aclave1
Copy link
Author

aclave1 commented Feb 13, 2020

Here it is with increased radiance size
image

They do create more of the fireflies that you've mentioned earlier, no improvement of the streakyness.

@varkatope
Copy link

Having this problem as well, unfortunately. It seems to go away if you bake a lightmap (and I imagine global illumination might fix it as well), at least for static geometry, but I feel like it should be possible to not use baked lighting or GI and still have something that looks decent. The current results aren't very usable.

@clayjohn
Copy link
Member

@varkatope the real issue lies with the HDRI you are using. The artifact is a result of having a single extremely bright point on the HDRI. The only way to solve it is to take more samples when generating the radiance map. However, that is extremely slow. Alternatively, you can use an HDRI with better luminance balance.

Godot 4.0 improves the situation dramatically by allowing users to specify how many samples they want, it also provides an alternative algorithm that handles bright spots better.

@varkatope
Copy link

@clayjohn Ah, that's good to know. That's indeed likely the issue in my current HDRI. I'll test out some other ones and see if I can get better results. Or look into generating my own. Looking forward to 4.0 as well. Thanks for the answer!

@aclave1
Copy link
Author

aclave1 commented Mar 22, 2020

@clayjohn thank you for your tip. I will look into the HDRI situation. I did notice that the issue was more/less pronounced when I changed HDRIs. I will test with some other HDRIs and close out the issue if that fixes it.

@Calinou
Copy link
Member

Calinou commented Jul 2, 2020

@aclave1 Did you manage to fix it by using another HDRI?

@Calinou Calinou changed the title HDRI Sky has weird visual artifacts HDRI Sky has weird visual artifacts/bright sparklies Jul 2, 2020
@aclave1
Copy link
Author

aclave1 commented Jul 2, 2020

@Calinou no - I was able to develop a minimal reproduction project a few days ago with a simple blender cube and a texture. I tested free HDRIs from texture haven and other websites. It notice the affect is most apparent when a model is textured using solid colors with no variation, like what you'd achieve with blender's paint bucket tool.

@aclave1
Copy link
Author

aclave1 commented Jul 3, 2020

Reproduction project: bug_hdri_repro.zip

@aclave1
Copy link
Author

aclave1 commented Jul 3, 2020

Bonus screenshot of the engine and blender for additional repro guidance.
image

Note that the left-to-right ordering of the cubes is flipped between blender and godot. In blender, the unsubdivided cube is on the left, a subdivided cube is in the middle, and a subdivided and slightly sculpted cube on the left.

In godot, the unsubdivided cube is on the left, sculpted is on the right. In this screenshot, the HDRI artifacts take a variety of shapes for cubes with different topologies.

I find that when texture painting, minor variations in the color mostly remove the effect but it pops up in large patches of uniform color.

@clayjohn
Copy link
Member

clayjohn commented Jul 3, 2020

My apologies for not updating this post earlier. A proper fix for HDRI fireflies required us to redo our system for generating radiance maps from HDRIs. Accordingly, a proper fix is out of scope for 3.2 (you can see this issue was milestoned for 4.0).

Generating radiance maps is a tradeoff between quality and time. Proper radiance maps (like in blender) involve performing a large integration over the entire unit sphere. It can take several seconds to do so. In Godot our time budget is in the range of milliseconds, not seconds, so we have to accept worse quality. The proper solution in 3.2 is to reduce the brightness of the sun area of the HDRI. The artifacts are caused by having small areas that are substantially brighter than surrounding areas.

Luckily, since we are improving rendering so much for 4.0 we were able to take the time to properly fix this issue in #36588. Note the artifacts in the images on this PR are the same as the ones you are seeing but even more exaggerated. This PR uses a different method for generating radiance maps that reduce the firefly artifacts to almost nothing. Further, you can still use the regular approach, but you have more control over the number of samples and the quality of the generation so you can find your own balance between time and quality.

Again, sorry for not updating this earlier and thanks for the taking the time to create an MRP and update this issue.

Closed by: #36588

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants