Houdini Development Toolkit - Version 9.0

Side Effects Software Inc. 2007

Compositing Operators

Mask Operators


Maskable operations are those operations that can take a matte and restrict their effect to the matte. Most COPs are derived directly or indirectly from COP2_MaskOp. Generators are derived from COP2_MaskOp but have no inputs (other than the mask). Other nodes derived from COP2_MaskOp generally have 1 input plus the mask input.

The cook method in COP2_MaskOp to override is:
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles);
COP2_MaskOp allows you to include all the masking and scoping parameters, and it provides the code to support these parameters. Unless you have a filter operation that cannot be masked (ie, it changes the resolution of the image), you should always derive from COP2_MaskOp. The big exception is if your algorithm happens to be a pixel operation, in which case you should derive from COP2_PixelOp (which also derives from COP2_MaskOp).

Some other useful methods to override:
This method returns the index of the main input (usually 0 for the main input).
This method returns the index of the mask input. If you have more than one main input, you will need to override this method to set it to the last main input + 1.
Masking can be handled in two ways - by blending the input with the output, and by modifying the effect of the operation per-pixel. The 'Normal' way to do masking is by blending. If your operation needs to do a per-pixel mask operation (such as varying the size of a kernel matrix), return false from this method.
Similar to the doNormalMask() method, this method returns whether the frame effect has been incorporated into the parameters of the operation (true), or whether it needs to be incorporated as part of the masking operation (false). The 'frame effect' is a combination of the Effect parameter and the Non-Scoped Effect parameter (on the Frame Scope page). The frame effect can be accessed via the method float getFrameScopeEffect(int image_index).
There are also a couple of useful utility methods in this class:
This is a simpler interface to getMaskRegion(). It returns you a single floating point array of the data in the mask plane for a given component in the area x1,y1 to x2,y2. You are responsible for delete[]'ing the data.
If you need to override COP2_MaskOp's getInputDependenciesForOutputArea() but don't want to call COP2_Mask's version, you can use this method to set up the mask dependency.
See COP2_SampleFilter.C in the COP HDK samples for an example of a mask operation.

Table of Contents
Operators | Surface Operations | Particle Operations | Composite Operators | Channel Operators
Material & Texture | Objects | Command and Expression | Render Output |
Mantra Shaders | Utility Classes | Geometry Library | Image Library | Clip Library
Customizing UI | Questions & Answers

Copyright © 2007 Side Effects Software Inc.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7