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.33k stars 132 forks source link

Browser-interpolated image stretching is compromising color quality #328

Open gkjohnson opened 1 year ago

gkjohnson commented 1 year ago

The browser will be linearly interpolating using sRGB data. It would be best to keep the canvas displaying at full scale and perform interpolation in shader before srgb adjust is applied.

gkjohnson commented 1 year ago

Demo:

https://jsfiddle.net/yekr50nz/5/

Notice the difference in edge brightness:

Browser Interpolation Shader Interpolation Before sRGB
image image
gkjohnson commented 1 year ago

It seems that interpolating with the HDR linear colors, though, causes particularly bright pixels to bleed further than desired? Perhaps the best approach is to clamp the colors, interpolate, then render?