scallyw4g / bonsai

A voxel engine in a pot
Do What The F*ck You Want To Public License
170 stars 10 forks source link

Black boxes on nvidia/linux #51

Open scallyw4g opened 4 months ago

scallyw4g commented 4 months ago

Shawnecy reported some sparkling black boxes on linux. We investigated for an hour or two but didn't get to the bottom of them. What we found out:

Shawnecy commented 4 months ago

The artifacts in question:

image

These artifacts are positioned consistently across multiple executions of the application. I took a screenshot of the program immediately after startup multiple times, and the images are all the same as above.

If I resize the application window, the artifacts change aspect ratio to match:

image

If I run the turn_based example project and load a fireball or if I load the transparency project, then the artifacts blink briefly before going away. The artifacts do not return if I load other projects, but they do return if I shut down game_loader and start it back up.

Removing this line from api.cpp eliminates the artifacts:

if (Graphics->Settings.UseLightingBloom) { GaussianBlurTexture(&Graphics->Gaussian, &Graphics->Lighting.BloomTex, &Graphics->Lighting.BloomTextureFBO); }

I tinkered with this line in Lighting.fragmentshader, removing one term at a time and testing, and each time the artifacts remained:

    TotalLight = (Diffuse*KeyLightContrib*ShadowVisibility) +
                 (Diffuse*AmbientLightContrib*BlurredAO) +
                 (Diffuse*BackLightContrib*BlurredAO) +
                 (PointLightsContrib*BlurredAO) +
                 Fog;

My machine: OS: Linux Mint 21.2 Victoria (Cinnamon) (x86_64) Kernel: 5.15.0-94-generic Screen resolution: 2560x1440 CPU: Intel i9-10900K (20) @ 5.300GHz GPU: RTX 4090, 24gb GPU Drivers: nvidia-driver-545 (545.29.06-0ubuntu0.22.04.2)

Those are the latest drivers for my OS, but the previous version (535.161.07-0ubuntu0.22.04.1) are the recommended drivers.