Skip to content

Commit

Permalink
update nuke-default
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Feb 8, 2016
1 parent 35d740f commit 4b9ab54
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 32 deletions.
1 change: 0 additions & 1 deletion nuke-default/config.ocio
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ roles:
reference: linear
scene_linear: linear
texture_paint: sRGB
viewer: sRGB

displays:
default:
Expand Down
Empty file modified nuke-default/luts/alexalogc.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/cineon.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/panalog.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/ploglin.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/rec709.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/redlog.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/slog.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/srgb.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/srgbf.spi1d
100644 → 100755
Empty file.
Empty file modified nuke-default/luts/viperlog.spi1d
100644 → 100755
Empty file.
242 changes: 211 additions & 31 deletions nuke-default/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,27 @@ def fromSRGB(v):
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


NUM_SAMPLES = 2**16+25
RANGE = (-0.125, 4.875)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromSRGB(x))

# Data is srgb->linear
WriteSPI1D('luts/srgbf.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='sRGBf')
cs.setDescription("Standard RGB Display Space, but with additional range to preserve float highlights.")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('srgbf.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)
#Disabled pending matching root lut with extra range & name in Nuke.
#NUM_SAMPLES = 2**16+25
#RANGE = (-0.125, 4.875)
#data = []
#for i in xrange(NUM_SAMPLES):
# x = i/(NUM_SAMPLES-1.0)
# x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
# data.append(fromSRGB(x))
#
## Data is srgb->linear
#WriteSPI1D('luts/srgbf.spi1d', RANGE[0], RANGE[1], data)
#
#cs = OCIO.ColorSpace(name='sRGBf')
#cs.setDescription("Standard RGB Display Space, but with additional range to preserve float highlights.")
#cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
#cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
#cs.setAllocationVars([RANGE[0], RANGE[1]])
#
#t = OCIO.FileTransform('srgbf.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
#cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
#config.addColorSpace(cs)


###############################################################################
Expand Down Expand Up @@ -189,11 +189,10 @@ def fromCineon(x):
config.addColorSpace(cs)



###############################################################################

cs = OCIO.ColorSpace(name='Gamma1.8')
cs.setDescription("Emulates a idealized Gamma 1.8 display device.")
cs.setDescription("Emulates an idealized Gamma 1.8 display device.")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([0.0, 1.0])
Expand All @@ -203,7 +202,7 @@ def fromCineon(x):
config.addColorSpace(cs)

cs = OCIO.ColorSpace(name='Gamma2.2')
cs.setDescription("Emulates a idealized Gamma 2.2 display device.")
cs.setDescription("Emulates an idealized Gamma 2.2 display device.")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([0.0, 1.0])
Expand All @@ -212,10 +211,19 @@ def fromCineon(x):
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)

cs = OCIO.ColorSpace(name='Gamma2.4')
cs.setDescription("Emulates an idealized Gamma 2.4 display device.")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([0.0, 1.0])

###############################################################################
t = OCIO.ExponentTransform(value=(2.4,2.4,2.4,1.0))
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

# Log to Linear light conversions for Panalog
# WARNING: these are estimations known to be close enough.
# The actual transfer functions are not published
Expand Down Expand Up @@ -251,11 +259,8 @@ def fromPanalog(x):
config.addColorSpace(cs)



###############################################################################



redBlackOffset = 10.0 ** ((0.0 - 1023.0) / 511.0)

def fromREDLog(x):
Expand Down Expand Up @@ -288,7 +293,6 @@ def fromREDLog(x):
config.addColorSpace(cs)



###############################################################################

def fromViperLog(x):
Expand Down Expand Up @@ -321,10 +325,8 @@ def fromViperLog(x):
config.addColorSpace(cs)



###############################################################################


alexav3logc_a = 5.555556
alexav3logc_b = 0.052272
alexav3logc_c = 0.247190
Expand Down Expand Up @@ -416,6 +418,11 @@ def fromPLogLin(x):

###############################################################################

'SLog'

#Note this is an old version that doesn't take black offsets into account.
#SLog1 should be used instead, this is here for back compat.

def fromSLog(x):
return (10.0 ** (((x - 0.616596 - 0.03) / 0.432699)) - 0.037584)

Expand Down Expand Up @@ -445,6 +452,178 @@ def fromSLog(x):
config.addColorSpace(cs)


###############################################################################

'SLog1'

#The original SLog is actually incorrect (see note above), this should be used
#in its place.

def fromSLog1(x):
return (((10.0 ** (((((x*1023.0)/4.0-16.0)/219.0)-0.616596-0.03)/0.432699))-0.037584)*0.9)

# These samples and range have been chosen to write out this colorspace with
# a limited over/undershoot range, which also exactly samples the 0.0,1.0
# crossings

NUM_SAMPLES = 2**12+5
RANGE = (-0.125, 1.125)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromSLog(x))

# Data is srgb->linear
WriteSPI1D('luts/slog1.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='SLog1')
cs.setDescription("Sony SLog1")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('slog1.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

'SLog2'

def fromSLog2(x):
if x >= 0.030001222851889303:
return ((219.0*((10.0 ** ((x-0.616596-0.04)/0.432699))-0.037584)/155.0)*0.9)
return ((x-0.030001222851889303)*0.28258064516129*0.9)

# These samples and range have been chosen to write out this colorspace with
# a limited over/undershoot range, which also exactly samples the 0.0,1.0
# crossings

NUM_SAMPLES = 2**12+5
RANGE = (-0.125, 1.125)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromSLog2(x))

# Data is srgb->linear
WriteSPI1D('luts/slog2.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='SLog2')
cs.setDescription("Sony SLog2")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('slog2.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

'SLog3'

def fromSLog3(x):
if x >= 171.2102946929/1023.0:
return (((10.0 ** ((x*1023.0-420.0)/261.5))*(0.18+0.01))-0.01)
return ((x*1023.0-95.0)*0.01125/(171.2102946929-95.0))

# These samples and range have been chosen to write out this colorspace with
# a limited over/undershoot range, which also exactly samples the 0.0,1.0
# crossings

NUM_SAMPLES = 2**12+5
RANGE = (-0.125, 1.125)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromSLog3(x))

# Data is srgb->linear
WriteSPI1D('luts/slog3.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='SLog3')
cs.setDescription("Sony SLog3")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('slog3.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

'CLog'

def fromCLog(x):
return (((10.0 ** (x - 0.0730597)/0.529136) - 1.0)/10.1596)

# These samples and range have been chosen to write out this colorspace with
# a limited over/undershoot range, which also exactly samples the 0.0,1.0
# crossings

NUM_SAMPLES = 2**12+5
RANGE = (-0.0684932, 1.08676)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromCLog(x))

# Data is srgb->linear
WriteSPI1D('luts/clog.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='CLog')
cs.setDescription("Canon CLog")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('clog.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

'Protune'

def fromProtune(x):
return (((113.0 ** x) - 1.0)/(112.0))

# These samples and range have been chosen to write out this colorspace with
# a limited over/undershoot range, which also exactly samples the 0.0,1.0
# crossings

NUM_SAMPLES = 2**12+5
RANGE = (-0.125, 1.125)
data = []
for i in xrange(NUM_SAMPLES):
x = i/(NUM_SAMPLES-1.0)
x = Fit(x, 0.0, 1.0, RANGE[0], RANGE[1])
data.append(fromProtune(x))

# Data is srgb->linear
WriteSPI1D('luts/protune.spi1d', RANGE[0], RANGE[1], data)

cs = OCIO.ColorSpace(name='Protune')
cs.setDescription("GoPro Protune")
cs.setBitDepth(OCIO.Constants.BIT_DEPTH_F32)
cs.setAllocation(OCIO.Constants.ALLOCATION_UNIFORM)
cs.setAllocationVars([RANGE[0], RANGE[1]])

t = OCIO.FileTransform('protune.spi1d', interpolation=OCIO.Constants.INTERP_LINEAR)
cs.setTransform(t, OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
config.addColorSpace(cs)


###############################################################################

'REDSpace'
Expand All @@ -466,6 +645,7 @@ def fromSLog(x):
config.addDisplay(display, 'None', 'raw')
config.addDisplay(display, 'sRGB', 'sRGB')
config.addDisplay(display, 'rec709', 'rec709')
config.addDisplay(display, 'rec1886', 'Gamma2.4')

config.setActiveDisplays('default')
config.setActiveViews('sRGB')
Expand Down

0 comments on commit 4b9ab54

Please sign in to comment.