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

Vulkan: Clustering artifacts when using spotlights together with volumetric fog #55527

Closed
Geometror opened this issue Dec 1, 2021 · 6 comments

Comments

@Geometror
Copy link
Member

Godot version

4.0.dev (5efe80f)

System information

Windows 10, NVIDIA RTX 3060Ti, driver 497.09, Vulkan

Issue description

When trying to use spotlights together with volumetric fog of any kind, weird clustering artifacts appear in the area which should be illuminated by scattered light. I opened this issue because I could not reproduce #41357 anymore with Omnilights, so this issue could be used to track all bugs related to spotlights + volumetric fog.
Screenshot 2021-12-01 202734

It seems like there are two artifact types:
The stretched quads in the middle of the light cone(which are closer together the higher the value "Volume Depth" is set ) and then the "staircase" one, which seems to be caused by wrong transformations in the cluster builder (maybe). I modified the spotlight code in the volumetric_fog_process shader (basically disabled all attenuation code), which makes the light clusters clearly visible:
grafik
reverse_button_pressed_color

Steps to reproduce

  1. Create new project
  2. Add spotlight and Environment node
  3. Enable "Volumetric Fog"
  4. Set background to a dark color and adjust the light energy until the scattered light is clearly visible.
    Optional, but recommended:
  5. Adjust volume depth, volume size to higher values in the project settings and set "Use Filter" to "No" to see it even clearer.

Minimal reproduction project

volumetric-spotlight-artifacts.zip

@clayjohn clayjohn added this to the 4.0 milestone Dec 1, 2021
@Calinou Calinou changed the title Clustering artifacts when using spotlights together with volumetric fog Vulkan: Clustering artifacts when using spotlights together with volumetric fog Dec 1, 2021
@Geometror
Copy link
Member Author

Strangely, when running the project, no clusters are drawn for the spotlight:

grafik

@Calinou
Copy link
Member

Calinou commented Dec 2, 2021

Strangely, when running the project, no clusters are drawn for the spotlight:

Can you see clusters if you resize the window while the project running? Try making the window wider/narrower to change its aspect ratio.

@Geometror
Copy link
Member Author

Geometror commented Dec 2, 2021

Sometimes(totally random) the clusters are drawn indeed(but same wrong transform). This also happens when resizing the editor.
grafik
grafik

@Geometror
Copy link
Member Author

Could someone test this on an Apple device since it looks like in the screenshot provided with PR #55281 there are no artifacts. (which could be related to the changes in the volume_fog_process shader)
Maybe @bruvzg can confirm/test?

@bruvzg
Copy link
Member

bruvzg commented Dec 3, 2021

I can reproduce this kind of clustering, seems like it's only happening when the camera is far from the spotlight cone, only at some angles and depends on size of the viewport/window.

Screenshot 2021-12-03 at 12 26 29

@Geometror
Copy link
Member Author

Fixed with #55714.

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