Loading a LUT file to V-Ray VFB for color transformations using MaxScript

Overview

In this article, you will learn how you can load LUT files thought 3ds MaxScript to apply color corrections in VFB.

 

Step by step instructions for adding a layer and loading the LUT file using MAXScript Listener:

1. Create a new VFB Layer Manager instance:

vfbLayers= (vfbcontrol #getlayermgr)[1]

returns: <Interface:vfbLayerMgr>

 

2. Get VFB Layer Classes

vfbLayers.getcreatableLayerClasses()

returns: #("folder", "chaos.cc.exposure", "chaos.cc.curves", "chaos.cc.lut")

3.Get existing VFB Layers IDs

vfbLayers.getallLayerIDs()

returns: #(0, 1, 2, 3, 4, 5, 6, 7, 8)

 

4. Add a Lookup Table layer to the VFB Display Correction stack.   

vfbLayers.createLayer 1 "chaos.cc.lut"

returns: <MixinInterface:Lookup Table>

5. Get Layer IDs one more time to find the newly added Lookup Table layer

vfbLayers.getAllLayerIds()

returns: #(0, 1, 2, 3, 4, 5, 6, 7, 10, 8)
Compare the return from Step 3 and 5 to find out the newly created layer. In our example the newly created ID is 10.

6. Assign the .cube file to the Lookup Table layer input channel.

(vfbLayers.getLayer 10).lut_file = "X:\CC_file.cube"

returns: "X:\CC_file.cube"

Use the newly created Layer ID (in our example the  ID=10) to assign the Lookup file.

 

Ready to use Script:

This script will add a new layer and load the specified *.cube file. It can be saved as a .ms file and executed in 3ds Max 

vfbLayers= (vfbcontrol #getlayermgr)[1]
vfbLayers.createLayer 1 "chaos.cc.lut"
for each in vfbLayers.getAllLayerIds() do
(
try
(
(vfbLayers.getLayer each).lut_file = @"X:\CC_file.cube"
)
catch()
)

 

VFB_Lookup_Table.jpg

Additional Information

All available commands and parameters for controlling the VFB programmatically are available here

Was this article helpful?
0 out of 0 found this helpful