gkjohnson / three-gpu-pathtracer

Path tracing renderer and utilities for three.js built on top of three-mesh-bvh.
https://gkjohnson.github.io/three-gpu-pathtracer/example/bundle/index.html
MIT License
1.27k stars 125 forks source link

Ensure downloaded images with transparent background looks correct #510

Closed gkjohnson closed 5 months ago

gkjohnson commented 5 months ago

I recall that the colors looked incorrect previously possibly due to premultiplied alpha settings?

gkjohnson commented 5 months ago

No combinations of alpha rendering and premultiplied alpha settings seem to result in the image being different. Will need to test exporting the images again. It may occur only in saved png files?

Test fiddle https://jsfiddle.net/cyrf21zm/

gkjohnson commented 5 months ago

Looks like everything lines up with the displayed canvas. Using premultipliedAlpha === true is what should be used for the best result when rendering and saving:

premultipliedAlpha: false premultipliedAlpha: true
image image