godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.74k stars 21.12k forks source link

Specular aliasing becomes more visible when depth of field or glow is enabled #15756

Open lukaskotik opened 6 years ago

lukaskotik commented 6 years ago

Godot version: Godot 3.0 rc1 official

OS/device including version: Ubuntu 16.04 64 bit GeForce GTX 750 Ti, NVidia driver 384.111

Issue description: Graphical artifacts are visible (for some viewing angles and zoom levels) when Dof Far Blur or Dof Near Blur in environment is enabled. These artifacts are placed in the areas of "high" reflections (see images).

Steps to reproduce: Open 3D material_testers demo, enable Dof Far Blur and Dof Near Blur, try to zoom in/out, rotate camera. Make the same in the running scene. (artifacts are visible both in editor and in running scene).

Artifacts: godot_reflection_artifacts Blur off: blur_off Blur on: blur_on

Minimal reproduction project:

reduz commented 6 years ago

This is technically not a bug, just the shape of the filter because the resulting specular lobe at this size is very strong. Maybe specular could be clamped or eventually be applied after tonemapping. Easy fix for now is changing roughness from 0.02 to 0 or 0.05 (a bit bigger)

Will mark as enhancement for 3.1

lukaskotik commented 6 years ago

It's quite irritating shape of the filter - see the first picture or the most right artifact in the last figure. Anyway I played with settings of environment and I can't get rid off these white rectangles (without affecting the blur effect). What do you exactly mean with "changing roughness"?

AndreaCatania commented 6 years ago

roughness of spatial material on the single mesh

lukaskotik commented 6 years ago

Thanks! Setting it to 0 removed the artifacts (together with the reflection). With higher values the artifacts still occur.

akien-mga commented 5 years ago

Is this still reproducible in the current master branch? What about the GLES2 backend?

Calinou commented 5 years ago

I can still reproduce it on commit https://github.com/godotengine/godot/commit/35c1694c040c4b9f8d46984241d5d37cb3380725 with the default parameters (roughness 0.02):

image

Setting the material's roughness to 0 solves the issue, since the specular blob doesn't appear anymore. Also, depth of field isn't supported in GLES2, so the issue doesn't apply there.

akien-mga commented 4 years ago

Still reproducible in 41634199: Screenshot_20191114_115745

WIth higher roughness I get artifacts in other locations (foot): Screenshot_20191114_115820

akien-mga commented 3 years ago

Still reproducible in 3.3-stable. CC current @godotengine/rendering contributors in case you want to poke at this one :)

Calinou commented 3 years ago

Note that this is most likely not reproducible in the master branch since it has a new DoF implementation with proper support for bokeh.

clayjohn commented 3 years ago

This is a form of specular aliasing resulting from the high intensity of the specular lobe.

To fix these sorts of artifacts what we need to do is convert the buffer to LDR before performing the blur operation then convert back to HDR after blurring. We should do something similar with Glow to reduce specular aliasing.

Calinou commented 2 years ago

This was fixed for glow in master by https://github.com/godotengine/godot/pull/54409. I haven't checked if this applies to depth of field in master yet.

clayjohn commented 2 years ago

Right now it was just added for glow, but the same concept applies for DoF.