AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO

GPU 3D lut transform causes banding

オープン
#1,763 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
Needs Discussion
主要言語
C++
スター
2.1k
フォーク
505
PR マージ指標
30日以内にマージされた PR はありません

説明

I'm using 3d luts that span a large dynamic range and need trilinear interpolation for correct results (I'm happy to provide details of my use case if that's helpful).

Due to the nature of the luts, they should provide sufficiently accurate results even at relatively low lut resolutions. However, much to my surprise there is *significant* banding when applied by OCIO on GPU:

![gpu posterized](https://perm.cessen.com/2023/github/ocio_3d_lut_bug/gpu_posterized.jpg)

The only way to mitigate this is to crank the lut resolution extremely high, and even then especially dark colors exhibit some subtle banding. The results by CPU, on the other hand, are correct even with the low resolution lut:

![cpu correct](https://perm.cessen.com/2023/github/ocio_3d_lut_bug/cpu_correct.jpg)

Looking into OCIO's source, this seems to be the culprit:

https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/b00877959f4497f9b8e5a08859d0ef8059fdd8e5/src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp#L221-L236

It's even noted in the comment that this can be an issue on some GPUs. For the record, I'm using an nVidia RTX 3060. So not exactly niche.

I think it would make sense to replace the `sampleTex3D()` call with hand-written trilinear interpolation code, to ensure that it executes with full floating point precision and gives correct results on all platforms. It might be a small perf hit, but for something like OCIO I suspect correctness and consistency is more important here.

Would a PR along those lines be accepted?

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp の 221-236 行から始め、既存の sampleTex3D() パスと GPU の精度に関するコメントを確認します。GPU 3D LUT 向けの完全精度の三線形補間アプローチを調査し、その後、低解像度 LUT の結果にバンディングが生じなくなり、CPU パスと一致することを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
computer-graphics
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。