chunky-dev / chunky

A path tracer to create realistic images of your Minecraft worlds.
https://chunky-dev.github.io/docs
GNU General Public License v3.0
644 stars 76 forks source link

NaN Pixels, buffer corruption #1664

Open ConsueTerra opened 11 months ago

ConsueTerra commented 11 months ago

Under certain scenes, pixels that appear corrupted arise. There are pure white pixels in the viewport as well as pure black pixels. At some point those pixels got corrupted while rendering, the can either be NaN pixels, or +- infinity pixels Im not sure (since white and black pixels seem to be co present). Now this introduces small visual artifacts, but the bigger issue is that when exporting the raw floating point data like in TIFF32 or PFM modes, the NaN pixels are also written. As such programs downstream that cannot deal with NaN values properly will fail to load the image (like in Adobe Camera RAW) or would fail to save the image properly (as in Photoshop). This could be considered a critical bug as there is no way to get around this issue atm and unclear how to stop a scene buffer from corrupting.

Bug observed: 2.4.5 (reproduced here) 2.5.0-SNAPSHOT.214.g94622f8a (commit 94622f8a)

1660

Example

default_2022-12-04_17-28-33-2 4 5-2956 Here you see the white pixels in the context of the render (exposure has been tuned down) default_2022-12-04_17-28-33-2 4 5-2960 Here I turned off post and set exposure to -300, the white pixels remain default_2022-12-04_17-28-33-2 4 5-3064 I set exposure to 1000, to my surprise there where also black pixels.

Here is a screenshot from the photos app, showcasing the apparent corruption image

In Lightroom, showing 2(3) renders under different export options and different samples. Some of the images are corrupted and unloadable image

Reproduction turned out easier than I expected, I have included the 2.4.5 version. The original scene was made in a snapshot build but I have lost the JSON for it so I will have to see in I can remake that scene. Note for this scene under #1660 no corruption was observed but WAS for a different scene (That motivated this issue) but it took considerably longer for problems to occur so decided to use this scene as a benchmark. Link to 2.4.5 scene with NaN pixels

ThatRedox commented 9 months ago

Reproduction discussion in discord: https://discord.com/channels/541221265512464394/545374333883777037/1169905313529479259