RV has a couple of nodes that can be used instead of or complimentary to the RV’s color pipeline.
You can get some info about OCIO in RV here: OpenColorIO Integration
If you check out the OCIO package info in the Package manager RV -> Preferences -> Packages -> OpenColorIO Basic Color Management
, there’s a bit of a description about how OCIO can be auto-setup via a script. You can create rv_ocio_setup.py
file in your support path under the Python directory to have your own script auto-determine color pipeline.
Attached is a minimal example that might serve well as a bootstrap for setting up your config. The ocio_config_from_media
is called when needed and helps you dynamically set up your config. You can even create the OCIO config programmatically if you so wanted to, or just set it to an appropriate config location, set the environment variable and be done.
rv_ocio_setup_sample.py (2.2 KB)
Drop the file as rv_ocio_setup.py in your PYTHONPATH (such as in your Python path in your RV_SUPPORT_PATH) and this will prove as a configuration script and entrypoint for your OCIO setup.
If you look under Open Color IO Integration docs, there’s a ocio_context
component. The OCIO context variables can work off of environment variables, but environment variables for context variables in OCIO are not required.
The way this works is, by default, OCIO context variables will incorporate any environment variable as a fallback. But in the setting up a node, you can also define additional context variables. This allows each node to have its own context apart from your environment, therefore no special environment variables are actually needed.
So while the example script defines the context based on the environment variable and uses a default value like this:
"context" : {"SHOT" : os.environ.get("SHOT","def123")}
the context could just as easily be defined by some other lookup, such as one defined by a function that looks it up from Shotgun. For example, this:
"context" : {"SHOT" : findShotgunShotByMedia(media)}
EXAMPLE PIPELINE
I know that this is a LOT of information, but let’s go through an example pipeline setup.
If you’d like to follow along, you can download the basic ACES OCIO config from the official Github page: GitHub - imageworks/OpenColorIO-Configs: Color Configurations for OpenColorIO
I don’t know what your color pipeline looks like but let’s say you have 3 different transforms: [Linear -> ACEScc] -> [File Transform] -> [Rec709 -> Linear]
before it ends up being converted to whatever Display you have. Do you have control over how the OCIO config is structured? If you do, you can avoid a lot of RV-related hassle by defining what you need in the config itself. We recommend storing look-related transforms on the look node, but I think you should be able to do a similar group transform on Colorspace nodes as well.
Given that, you would have something like this:
looks:
- !<Look>
name: role_color_my_look
process_space: scene_linear
transform: !<GroupTransform>
children:
- !<ColorSpaceTransform> {src: ACES - ACES2065-1, dst: ACES - ACEScc}
- !<FileTransform> {src: "${SHOT}.spi3d", interpolation: linear}
- !<ColorSpaceTransform> {src: ACES - ACEScc, dst: ACES - ACES2065-1}
And then in rv_ocio_setup.py all you’d need to do would be to define roles for RVLookPipelineGroup:
elif (nodeType == "RVLookPipelineGroup"):
# If our config has a Look named shot_specific_look and uses the
# environment/context variable "$SHOT" to locate any required
# files on disk, then this is what that would likely look like
result = [
{"nodeType" : "OCIOLook",
"context" : {"SHOT": "MY_010-010"},
"properties" : {
"ocio.function" : "look",
"ocio.inColorSpace" : OCIO.Constants.ROLE_SCENE_LINEAR,
"ocio_look.look" : "role_color_my_look"}}]
Please note that "${SHOT}.spi3d"
and "context" : {"SHOT": "MY_010-010"}
, is how you’d go about defining shot-specific file transforms.
Some more reference:
OCIO contexts: Contexts — OpenColorIO RB-1.1 documentation
OCIO config syntax and GroupTransform reference: Config syntax — OpenColorIO RB-1.1 documentation
Now if you don’t have access to modifying the OCIO config and you inherit it from a client for example, it’s a bit more complicated. You’ll need to code a lot more in the rv_ocio_setup.py. We don’t have a node for colorspace, but each RV OCIO node is equivalent, so you can mix and match them as you like, but you’ll need to define the OCIO*.function attribute as per Help. This means that for an example pipeline of [Linear → ACEScc] → [File Transform] → [Rec709 → Linear], you can have:
OCIOLook node that does [Linear → ACEScc] and has a OCIOLook.function = color
OCIOFile node that does [File Transform] (your LUT) that has OCIOFile.function = look
OCIONode node that does [Rec709 → Linear] that has OCIOFile.function = color
OCIODisplay node that does your [Linear → Display] transform and has OCIODisplay.function = display