Hello,
I’m not a fulltime pipeline developer but I’m trying to improve my python skills in vfx and shotgun/rv. My latest nemesis is setting up an automated RV pipeline with a custom ACES Ocio config.
I already worked myself through the OCIO source setuop sample package and so far everything is working fine. I’m able to load the right ocio.config dependant on the file I’m loading. I can also setup the file transform/look and display so that everything works fine.
What didn’t perfectly work for me was that RV automaticly set’s these groups depending on the file I put in.
I already checked this post:
but I still have problems. I usually end up with a correct load of the OCIO but not a working file transform / display activation.
So I tried the “btl_ocio_source_setup.py” that “mmoshev” posted 2 years ago… (lots of love, helped me a lot already!!) …
With this I managed that RV set’s everything automaticly and in the right way. Unfortunatly if I use this way I’m running into 2 new problems.
First of all I’m not able to disable the file transform or display transform once I’ve loaded a file. It’s not locked or anything but trying to turn it of nothing happends.
The second problem is that it seems that the “output” doesn’t seem to update when I loaded multiple files. I start by opening a “sRGB” jpg and RV works correct by setting the file transform to “output srgb” (so that the file get’s linearized, right?) and the display to “sRGB”. All good so far. If I now load in an exr the file transform is set right but it seems like the viewer is not updating so the exr looks wrong.
Sorry I know this is very basic stuff but I can’t find a very detailed explanation of the source setup and how exactly it works.
I tried out btl_ocio_source_setup.py which was shared by @mmoshev . It seems the display transform is only set once when the first item is loaded by RV. This is why the initial sRGB jpg looks fine but the following exr doesn’t. You can see this in the top level OCIO->Displays. The value doesn’t change per item item in the RV timeline. The original source_setup.py which comes with RV also has the same behavior.
I’m not sure why this route was never taken. Perhaps an RV limitation? Or perhaps it is assumed that review sessions will contain media which all require the same display transform.
My crew desires to see mov files, exr images, jpg images (each which require different display transforms) within the same RV session.
I would guess this is possible, but don’t know RV well enough. After all, each file/sequence is a separate “source”, so you must be able to define transforms per source, no?
I needed to automatically set OCIO file and display colourspaces according to file extension - which is the simplest approach for the type of work I supervise.
Mine is based on rv_ocio_setup.py which support helped me with.
It works great and updates properly even if you add new files to RV.
I barely dabble in python and am a supervisor rather than developer so this whole scenario seemed bewilderingly confusing to start with, and the docs and examples just got me more and more confused. I would never have got there without supports help so hats off to them, but the script is actually very simple and easy to follow.
You also need a working OCIO config file to reference for the file and display colourspaces of course.
I have a love-hate with RV, it works for most of my use cases and is very powerful but is staggeringly unfriendly for non programmers and many features are seemingly needing some sort of script - even hotkeys as it turns out!! But when it works, and links to shotgrid playing QTs and even 4K EXRs realtime on my laptop I’m happy. Not many other options out there for that
I would reach out to support, and if I have time I’ll send some snippets to try and help.
Here’s a sample that support guided me through and I modified further as required.
A few notes:
I’m on Mac, the file lives in:
/Users/-user-/Library/Application Support/RV/Python/rv_ocio_setup.py
I symbolically link the file to elsewhere for convenience.
You need an OCIO config file with matching names for file and display colourspaces used here.
Mine is set via env variable OCIO=path_to_OCIO_config_file.ocio
Obviously your colourspace needs will be different and can adjust accordingly. I can hard wire as am only working on one show currently, so is all I need. I actually added some more file types though…
Hope that’s helpful, I tried many times and wasted countless weeks trying to solve this previously!
# sample rv_ocio_setup.py guided by autodesk support
import os
from rv import commands
import PyOpenColorIO as OCIO
import pathlib
def ocio_config_from_media(media, attributes):
#
# This can be either from an environment, or based on whatever
# setup you choose to set.
#
config = OCIO.Config()
return config.CreateFromEnv()
def ocio_node_from_media(config, node, default, media=None, attributes={}):
#
# Based on the incoming node assemble the corresponding pipeline
#
result = [{"nodeType" : d, "context" : {}, "properties" : {}} for d in default]
context = {}
EXR_LINEAR_FILE_COLOURSPACE = "ACES - ACES2065-1"
QT_COLOURSPACE = "Output - Rec.709"
DISPLAY = "ACES"
VIEW = "sRGB"
if media:
file_extension=pathlib.Path(media).suffix
print("ext: %s" % file_extension)
# if extension is .exr
if file_extension == ".exr":
sourceColorSpace = EXR_LINEAR_FILE_COLOURSPACE
display = DISPLAY
view = VIEW
# if extension is .mov
elif file_extension == ".mov":
sourceColorSpace = QT_COLOURSPACE
display = DISPLAY
view = VIEW
# if extension isn't .exr or .mov,
# set a default value for sourceColorSpace, display and view
else:
sourceColorSpace = EXR_LINEAR_FILE_COLOURSPACE
display = DISPLAY
view = VIEW
print("scolor: %s" % sourceColorSpace)
print("display: %s" % display)
print("view: %s" % view)
else:
display = DISPLAY
view = VIEW
nodeType = commands.nodeType(node)
if (nodeType == "RVLinearizePipelineGroup"):
result = [
{"nodeType": "OCIOFile",
"context" : context,
"properties" : {
"ocio.function" : "color",
"ocio.inColorSpace" : sourceColorSpace,
"ocio_color.outColorSpace" : OCIO.Constants.ROLE_SCENE_LINEAR}},
{"nodeType" : "RVLensWarp", "context" : {}, "properties" : {}}]
elif (nodeType == "RVDisplayPipelineGroup"):
result = [
{
"nodeType": "OCIODisplay",
"context": context,
"properties": {
"ocio.function" : "display",
"ocio.inColorSpace" : OCIO.Constants.ROLE_SCENE_LINEAR,
"ocio_display.view" : view,
"ocio_display.display" : display }}]
return result