It looks like you're new here. If you want to get involved, click one of these buttons!
#How to author import patterns?
This document aims to be a guide on creating new or authoring existing import patterns.
Import patterns are just normal canvas graphs which return specific data types. An Import Pattern represents a programmatic pipeline for importing / creating 3D data in supported target applications. Instead of compensating for incomplete / insufficient data pipelines with manual authoring in the target application Import Patterns provide a smart way of improving the pipeline constantly to be able to deal with the source data in a more efficient and complete way.
The relevant data types for import patterns are:
Import Patterns are also allowed to return arrays of the above data types. The data types are implemented in the GenericImporter extension, which ships with Fabric Engine since version 2.3.1.
Aside from the obvious "Import some data" Import Patterns can also be used to:
#Getting data in - the file format nodes
Most import patterns start by importing a source asset. The factory nodes for this purpose can be found under Fabric -> Compounds -> IO -> Importer -> File Formats. Third party extensions (such as the OpenNurbs extension for example) might provide the loader nodes in a different folder. In the case of OpenNurbs the loader node can be found under ThirdParty -> OpenNurbsImporter -> OpenNurbs.
#Debug drawing - displaying results in real-time
When working on an import pattern it is critical to be able to see what you are doing. For this you can use the drawing nodes which ship with the import patterns extensions. These nodes can be found under Fabric -> Compounds -> IO -> Importer -> Drawing. For most cases you will want to rely on the DrawTraversed node, which is a higher level node that wraps the DrawObjects node.
The DrawTraversed node has a series of features including
Data sets often come with clutter - construction elements or simply unwanted objects. The Filtering nodes for import patterns used Fabric Engine's Blocks feature. This allows you to focus on one element at a time. The base filter node can be found under Fabric -> Compounds -> IO -> Importer -> Filters -> Filter. Based on the default Filter node we also provide a couple pre-canned filter nodes which you can use to filter based on the most common scenarios: Filter by type or path. Using the block on the default Filter node you can implement your very own filtering logic. To make something up: Filter by the original metadata storing the vendor's product name...
Below we see a custom filter based on the name of the object:
Aside from just filtering out elements you can also use import patterns to actively modify elements. You do this by setting properties on elements - changing properties changes the content of an object. For this you can use the Fabric -> Compounds -> IO -> Importer -> Properties -> SetProperty node. Of course you can use all of the getter nodes in that same category to first retrieve a value and then modify it. With this you can for example:
Since the Set Property node is polymorphic we'll list here all of the properties you can modify for each specific element. You can also find the properties by looking at the KL source code in the GenericImporter extension. Each specialized ImporterObject adds its very own properties. Note also that you can add custom properties as well. Integrations consuming the results of an import pattern (the Fabric for Maya plugin, for example) might, however, ignore these custom properties.
All elements (ImporterObject)
Elements with transforms (ImporterTransform)
The Fabric -> Compounds -> IO -> Importer -> Blocks -> Modify can be used as a basis for any higher level node that modifies a data set.
The image below shows a modify node changing the transform of each shape by scaling it down:
The image below shows a node setting the collisionEnabled Boolean property, which will be interpreted by Unity and Unreal to drive the collision settings.
#Assigning new materials
In the Fabric -> Compounds -> IO -> Importer -> Shapes category you can find the AssignMaterials node. The block inside of the node is used to assign a new material to all of the given shapes in the provided element array. The Fabric -> Compounds -> IO -> Importer -> Importer -> getOrCreatePbsMaterial node can come in handy here. The settings for the physically based shader are used both for Unreal and Unity. This way you can quickly assign materials programmatically which are then reflected well in the target real-time environments.
The image below shows setting up a new material by picking a random color. This can be useful especially when working on geometry decimation / merging.
The Fabric -> Compounds -> IO -> Importer -> Shapes -> MergeShapes node can be used to combine multiple shapes. Currently this only supports shapes of type PolygonMesh. To use this node you need to define a key for each element inside of the node's block. The key is used to idenfity the group the shape belongs to. Then all shapes within the same group are merged / combined. So for example:
This open approach empowers you to implement the type of merge features you need for your project. See the factory OpenNurbs import pattern for an example.
The image below shows a merge setup where the first five characters of the name are used to define the group. The groups are colored.
#Getting and setting MetaData
The nodes inside of Fabric -> Compounds -> IO -> Importer -> MetaData allow you to interact with metadata which might be stored on each element. MetaData doesn't follow a schema, so it might exist or not - depending on the source file. You can however also set metadata to inform the target application or your own process about certain characteristics of an element, for example. Most of the importers will provide specific information, such as the source file's unique identifier per element as metadata.
The image below shows a modify node getting, reporting and setting a specific metadata value, in this case the original name of the material coming from OpenNurbs.
The node Fabric -> Compounds -> IO -> Importer -> Blocks -> Traverse can be used to traverse an element array. Traversing means unfolding of hierarchies and creating all of the leaf elements. There are only a few scenarios where this might be needed:
The Traverse node will create an element for all unfolded hierarchies. So, for example, if an ImporterInstance is referencing a ImporterShape master and we have 4 of these instances we might just have 5 elements (the shape + 4 instances). If you wanted to change the transform on each of 4 resulting cubes you will need to traverse the element array first. After the traverser has run you will result in 9 elements (the cube, 4 instances + 4 instanced cubes). Note that the system is smart about not duplicating heavy data such as the geometry, for example. Only the hierarchical MetaData containers are duplicated.
The DrawTraversed node mentioned in the Drawing Elements section above has the Traverse node built-in. It has a boolean toggle to enable or disable it. Feel free to experiment with the traverser that way and see its effects.
#Creating new elements
Aside from just modifying existing elements the import patterns can also create completely new content. Check the following nodes under Fabric -> Compounds -> IO -> Importer -> Importer, namely getOrCreateObject and getOrCreateObjectArray to accomplish this. There are also some convenience nodes for the specific element types, such as getOrCreateLight, getOrCreateCamera etc.
You can create new elements, and then modify their properties as you do with any other element. This can be particularly interesting to create instances of elements procedurally.
Note that the methods used for these nodes are also available in KL. Please see the documentation and the source code of the GenericImporter extension for this.
The image below shows instancing a mesh coming from an alembic source file 10 times.
Animation is represented as a specific type when building an import pattern. You can use the Fabric -> Compounds -> IO -> Importer -> Animation -> createSequence node for this. The resulting ImporterAnimationSequence can be piped to the output of the graph. Animation sequences contain all of the values for a changing property over time and are imported as native animation clips in the supported environments, such as Unity and Unreal. The most simple case to create an animation sequence is to pipe the results of an animated alembic file into a createSequence node. The transform and camera animation of the elements will become animation tracks in the target application.
The image below shows a very simple setup of driving an animation sequence with all of the content of an alembic source file.
Technical Product Manager
Fabric Software Inc.
©Copyright 2017 Fabric Software Inc. All rights reserved. | Privacy