0

Viewing Mattes and Over Opacity

I have 3 sources, a Plate, a Render, and a Matte Render.

During review, we would like to overlay the Matte over the Plate at a some opacity level...say 25%.

is it possible to set the Source Opacity? 

 I see that there is a shuffling option but only on a source. Can you shuffle between sources? It would also be cool if I could Shuffle the Matte Renders A channel into the Renders A channel.

 

2 comments

  • Avatar
    Michael Kessler Official comment

    Ah ha!  So you want to do something like combining multiple sources channels.  While that composite operation isn't available by default in the stack node, it would be a fairly easy GLSL shader to create.

    Breaking this problem down into two problems, both could be achieved with shaders; and luckily since RV6, GLSL shaders no longer require RVX to author.

    I whipped up an example of a ChanSwap shader that can mix between two sources (maybe it should be called ChanMix instead); see the two files below:

    ChanSwap.glsl

    vec4 main (const in inputImage in0, const in inputImage in1, const in float r, const in float g, const in float b, const in float a)
    {
    vec4 input0Values = in0();
    vec4 input1Values = in1();
    return vec4(
    mix(input0Values[0], input1Values[0], r),
    mix(input0Values[1], input1Values[1], g),
    mix(input0Values[2], input1Values[2], b),
    mix(input0Values[3], input1Values[3], a)
    );
    }

    ChanSwap.gto

    GTOa (4)

    ChanSwap : IPNodeDefinition (1)
    {
    node
    {
    string evaluationType = "merge"
    string defaultName = "ChanSwap"
    string creator = "Autodesk"
    string documentation = "ChanSwap"
    int userVisible = 1
    }

    render
    {
    int intermediate = 0
    }

    function
    {
    string name = "main" # OPTIONAL
    string glsl = "file://${HERE}/chanSwap.glsl"

    }

    parameters
    {
    float r = [ 0.0 ]
    float g = [ 0.0 ]
    float b = [ 1.0 ]
    float a = [ 1.0 ]
    }
    }

    Just to illustrate a bit easier, note that the above sets the blue and alpha channels to the second input, and the red and blue channels to the first input, for what you ask; you would only want the alpha input to be set to 1.0.

     

    If you add these two files to your $RV_SUPPORT_PATH/Nodes/ directory ( the exact location for your OS is described here: http://www.tweaksoftware.com/static/documentation/rv/current/html/rv_manual.html#Packages_Package_Support_Path ) then you will now have access to this node inside of RV on the next launch.  In the package manager, if you add a node by type, you can type in "ChanSwap" and then you can add your two sources.



    If we expand now to your full problem, it is actually just this same node twice; but with different settings.  The properties are acessible, however, within RV via properties on the node.   So the r/g/b/a properties can be set to any floating point value and you'll get a mix between the two inputs.  You could author a package that bundles this node up, and use it twice in your image processing graph.

     

    You could continue this further and write this all into a single shader if you saw fit.  The biggest downside to these approaches is that you need to set up your graph either manually or write a package to help you switch the view.

     

    Would that work?

  • 0
    Avatar
    Nick Joseph

    Works PERFECTLY !! :D Thank you very much.

    As bonus, since you solved this so fast, can I assign a hotkey to switch between stacks? 

    You showed my how to make a hot-key in another post...but I just wanna know if this kinda execution is possible on the fly. 

    Say I have a 3 Stacks that has 2 sources each.

    Then I make a new node as described in this post. The name of the stack and the corresponding glsl new node is the same-ish. 

    can I assign a hotkey.. say ctrl+a to switch to the corresponding stacks?  (if im on ABC_v01_Stack and wanna switch to its Matte Review Layer, ABC_v01_MatteReview)

Please sign in to leave a comment.