Using the Tag Filter

Tag Filter collects 3D nodes that have a specific tag assigned.

For example, with tag filters you can:

To use the Tag Filter:

  1. In the Library press Alt and right-click Rendering > Object Sources and select Tag Filter.

    ../../_images/create-tag-filter3.png
  2. In the Properties set:

    • Source to the source from where you want to collect nodes for filtering. For example, to apply your filter to all nodes in your project, select Root Object Source. You can select the output of another filter as the source from where you collect nodes for filtering.

    • Included Tags to tags of the nodes you want to include in the filter results. If you include more than one tag, the filter returns nodes that contain at least one of the listed tags. See Using tags.

    • Excluded Tags to tags of the nodes you do not want to include in the filter results. If a node contains only one of the tags listed in the Excluded Tags, the filter does not return that node. This is so even when the same node contains tags you added to the Included Tags.

    ../../_images/tag-filter-properties.png

    Note

    Kanzi filters lights in the same way it filters other nodes. When you create a filter that only includes a specific tag, the lights that light the tagged nodes are included in the filter only when you add the tag to those light nodes. It is often more convenient to either:

    • Exclude the nodes you do not want to render.

    • Tag all light nodes with a separate tag and include that tag in all your filters.

  3. To take the Tag Filter into use, either:

    • In the Draw Objects Render Pass or Draw Objects With Material Render Pass that you use to render the 3D nodes to which you want to apply the filter, set the Object Source property to the filter or to an object source that collects the filter.

    • In the Node List Render Pass that you use to hold the nodes that you want to render using other render passes, set the Filter property to the filter or to an object source that collects the filter.

      Use a Node List Render Pass when you want to filter anything but the 3D nodes that you want to render, such as Light nodes. Draw Objects Render Pass, Draw Objects With Material Render Pass, and Gather Lights Render Pass render passes can use the result node list of the same Node List Render Pass.

    For example:

    1. In the Library > Rendering > Render Pass Prefabs create a Group Render Pass and inside it create:

      • Clear Render Pass

      • Gather Lights Render Pass and inside it a Draw Objects Render Pass

      ../../_images/render-passes-for-filters1.png
    2. In the Library select the Draw Objects Render Pass that you created and in the Properties set the Object Source property to the filter that you created or to an object source which collects the filter.

      See Using object sources.

    3. In the Node Tree select the Viewport 2D node to which you want to apply the filter and in the Properties set the Render Pass Prefab property to the Group Render Pass whose descendant Draw Objects Render Pass uses as its object source the filter that you created.

      ../../_images/render-pass-prefab-set-to-group-render-pass1.png

      Kanzi Studio renders the nodes collected by the filter.

Using Tag Filter filters in the API

For details, see the TagFilter class in the Kanzi Engine API reference.