KhronosGroup / ANARI-Docs

ANARI Documentation
Other
31 stars 8 forks source link

Sampler Transform Offset #93

Closed progschj closed 1 year ago

progschj commented 1 year ago

Samplers inTransform/outTransform parameters allow linear transforms and swizzling of components but can not express addition or setting to specific components unless it is known that one other component is 1.

This comes up for example when splitting a RGBA image into an "opaque" color (R,G,B, 1) and a separate opacity (A, 0, 0, 0). The latter can be achieved by using a outTransform with a fitting swizzling matrix

0 0 0 0
0 0 0 0
0 0 0 0
1 0 0 0

However the best we can do for the RGB part is

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 0

which results in (R, G, B, 0)

For completness the transforms should have FLOAT32_VEC4 parameters inOffset/outOffset with the combined transform becoming: transform*x + offset