Getting started with OCIO in RV

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)}
9 Likes

Hey, with the help of your guide, I am happy to report that we successfully created a subclass of the basic OCIO package, which loads our custom configs, sets spaces, etc.

We ended up baking a lookup file at “compile time” to avoid Shotgun requests, since RV is expected to be fast, apparently :slight_smile:

We haven’t got around to per-shot context variables yet, since it becomes more difficult to avoid querying Shotgun.

The next hangup we’re having is that the Channel Display options (bound to a r g b) do not work. It appears they are relying on the built-in color pipeline (in rvui.mu), or I might be interpreting it wrong.

Cheers,
Mois

6 Likes

Hi Mmoshev,

Check out the Color Channel Selection package that ships with RV, if you enable that, it’ll override the normal RGBA select mode with a mode that works similarly but is OCIO compatible.

6 Likes

Oh cool, thanks this works!

5 Likes

A post was split to a new topic: OCIO Setup Help (Steve)

@Michael.Kessler does the Color Channel Selection package have a color inspector also?
Pressing F5 with Channel Selection on throws an error invalid property name #RVLensWarp.warp.pixelAspectRatio, coming from rvui.render. I see the inspector is a separate module, so perhaps this has to be overridden to work with ocio?

2 Likes

I’d like to share our ocio package, which is built on top of the built-in one.

It selects an ocio config based on the media path, and selects color spaces depending on the media file type.
btl_ocio_source_setup.py (19.2 KB)

It can be built and installed with rvpkg, but I’ll defer these instructions to the manual for now.

Hopefully someone will find it useful as a base.

21 Likes

Mois,

Thank you so much for sharing your package with the community!

This is a known issue that we’re aware of and tracking internally. It looks like some of our UI code relies on RV’s built-in pipeline and doesn’t have all the graceful checks for the OCIO pipeline. We’ll be fixing this in the future.

However, if you would like to unblock this for yourself, you can either insert a dummy RVLensWarp node into the pipelinegroup or change the code in $RV_INSTALL_PATH/Mu/rvui.mu. There’s a function called pixelAspectFunc. If you wrap this function to skip setting the LensWarp, it should work.

1 Like

@alexaz yeah thanks, we already did the former after a round with support.
Having to do this is really not a big deal for development, as long as it is known.
Having it here on the forum might help. Perhaps should also be in the docs (not sure what the best place would be).

3 Likes