Re: how to write .cube luts?


Jim Houston <jim.h...@...>
 

It is useful to think separately about

LUT color values { say 0 to 1023 }  output from the LUT interpolation

LUT array index positions { 0 to 63 for a 64 cube LUT in each color )

and either

LUT input color value (  0 to 1023 )
or 
Normalized LUT input color value ( 0 to 1.0 from #/1023 )

The LUT access calculation normalizes the input color value, scales it by the number of entries to
get LUT array index positions (6.3, 12.6, 18.9 in the first example), and then uses all three Color values
to perform the interpolation (several types) to get an output value from the LUT.

A 1D LUT can be used to change the input value in a set way as long as the 3DLUT was generated with the same calculation, which 
is why it is called a shaper LUT.  It changes the result of the LUT access calculation.  As a result, you can have greater or less sample points
at different positions in the LUT. 

There, I think I have said the same things as in the e-mails below.


Though it is not about the .cube format, and runs the risk of confusion because it was written for programmers, there
is the ASC/Academy LUT format document which does explain some of the concepts for a fully general LUT and color matrix manipulation
system using integer or floating point HDR color.  https://www.dropbox.com/s/dl/jv6qavit4bpbu32/S-2014-006.pdf

If you want more particulars about the Resolve form of a .cube file, you can look at




Good Luck.


Jim Houston








On Jul 13, 2018, at 9:21 PM, Dithermaster <dither...@...> wrote:

Yes. The RGB input value range to an OCIO 3D LUT is always 0.0--1.0. Those values get mapped to the LUT indexes (0 to 64 for a 65x65x65, or 0 to 32 for 33x33x33, or 0 to 63 for 64x64x64, etc.). The fractional (in-between) parts are used to interpolate the output values.



On Fri, Jul 13, 2018 at 10:22 PM <michael...@...> wrote:
Thank you. I hope I understand correctly, that rgb(0.1, 0.2, 0.3) in your example is not drawn from the range rgb(0-255, 0-255, 0-255) [because then, say rgb(255, 255, 255) would be mapped to the impossible (255*63, 255*63, 255*63)] but instead rgb(0.1, 0.2, 0.3) is drawn from the range rgb(0.0-1.0, 0.0-1.0, 0.0-1.0), such that 0.0 means 0/63 and 1.0 means 63/63. What else could it be? I'm surprised it's been so difficult to find info on how to write .cube lut files. Is there a reference book or article you can recommend? I'd like to know everything about luts. My searches have been frustrating, as I mentioned, so you've really been a big help. Thanks again!

On Wednesday, June 27, 2018 at 1:58:18 PM UTC-4, Dennis Adams wrote:
How does a 3D LUT work? Each numeric row has three entries, which represent R, G, and B output values, often 0.0 to 1.0 (but could be higher or negative for some cases).
Each row represents a position in the 64x64x64 input cube. The input R,G,B value (sometimes after running through a lg2 "shaper" if it is linear) gets multiplied by 63 (in the case of a 64x64x64 cube) and rounded to the nearest integer. Then the row number of r*64*64 + g*64 + b. For example, input of rgb={0.1, 0.2, 0.3} becomes rgb_index={6.3, 12.6, 18.9} which become rgb_index_int={6, 13, 19} which is row index 6*64*64 + 13*64 + 19 = 25427, if you are looking for the nearest element. It's actually more complex than that since tri-linear or tetrahedral interpolation is used, which means 8 or 4 elements surrounding the 3D position are looked up and interpolated to create the output RGB value.

///d@




On Wed, Jun 27, 2018 at 12:03 PM mc <micha...@...> wrote:
I've been searching for weeks and can't find a clear explanation of how
.cube files are written. Please help me understand them.

I have a .cube file that was generated with 3D Lut Creator, with an
image source of a HALD color image (64x64x64). No adjustments were
applied to the image, so the .cube file should show input=output. But
the decimal values in the lookup table mystify me. How were they
generated? The decimal values, when multiplied by 64, do round to a
number close to list position in the (64 64 64) list, but surely there's
a precise algorithm to output those decimal values.

I've tried reading the OCIO C++ code to get the answer, but I don't
really know the language. I want to write luts in Java. Can someone
there help me?

Thanks.

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-d...@....
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "OpenColorIO Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ocio-dev+u...@....
For more options, visit https://groups.google.com/d/optout.

Join ocio-dev@lists.aswf.io to automatically receive all group messages.