AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
GPU 3D lut transform causes banding
- Lenguaje dominante
- C++
- Estrellas
- 2.1k
- Forks
- 503
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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:

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:

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?
Guía de contribución
Línea de trabajo
Comienza en src/OpenColorIO/ops/lut3d/Lut3DOpGPU.cpp en las líneas 221-236 y revisa la ruta existente de sampleTex3D() y su comentario sobre la precisión de la GPU. Investiga un enfoque de interpolación trilineal de precisión completa para LUTs 3D de GPU y, después, verifica que los resultados de LUTs de baja resolución ya no muestren banding y coincidan con la ruta de CPU.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp
- Área
- computer-graphics
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100