GUI nodes can be used as clipping nodes—masks that control how other nodes are rendered. This manual explains how this feature works.
Box, Text and Pie nodes can be used for clipping. To create a clipping node, add a node in your GUI, then set its properties accordingly:
Nonerenders the node without any clipping taking place.
Stencilmakes the node writing to the current stencil mask.
Then add the node(s) you want to be clipped as children to the clipping node.
Clipping works by having nodes writing to a stencil buffer. This buffer contains clipping masks: information that that tells the graphics card whether a pixel should be rendered or not.
Stencilwill write its shape (or its inverse shape) to an new clipping mask stored in the stencil buffer.
Here, three nodes are set up in a hierarchy:
Four combinations of normal and inverted clippers are possible for this hierarchy. The green area marks the part of the circle that is rendered. The rest is masked:
Layers can be used to control rendering order (and batching) of nodes. When using layers and clipping nodes the usual layering order is overridden.
A clipping node and its hierarchy will be drawn first if it has a layer assigned and in the regular order if no layer is assigned.
Here the clipper node “ocular” is set to “layer3” and the “bean” node is set to “layer1”. The ocular clipper’s texture is therefore rendered on top of the clipped bean.
The node “shield” is set to “layer2”, but it has no effect on the node’s render order in relation to “ocular” or “bean”. To change the render order of “shield”, change the node tree index order.
Did you spot an error or do you have a suggestion? Please let us know on GitHub!GITHUB