TriLib  1.9.0
TriLib Unity Package
TriLib Namespace Reference

Classes

class  AssetAdvancedConfig
 Represents an asset advanced config. More...
 
class  AssetAdvancedPropertyMetadata
 Represents all asset advanced configuration-metadata. More...
 
class  AssetDownloader
 Represents an asset downloader. Add this MonoBehaviour to any GameObject and set AssetURI and AssetExtension to automatically download the referenced model. More...
 
class  AssetLoader
 Represents a synchronous asset loader. More...
 
class  AssetLoaderAsync
 Represents an asynchronous asset loader. More...
 
class  AssetLoaderBase
 Base asset loader. More...
 
class  AssetLoaderOptions
 Represents a series of asset loading options. More...
 
class  AssetLoaderZip
 Represents an Asset Loader which handles ZIP files (extracting them locally) and has synchronous and asynchronous methods. If you wish to simply load files from ZIP files without extracting them, use AssetLoader or AssetLoaderAsync instead. More...
 
class  AssetUnloader
 Represents an asset unloader. This class is added to your loaded GameObject if your AssetLoaderOptions.AddAssetUnloader flag is set to true. This class destroy every asset (textures, materials, meshes) used by your GameObjects if they are not being used anymore. More...
 
class  AssimpMetadataCollection
 Represents a series of AssimpMetadata related to the given UnityEngine.GameObject. More...
 
class  AssimpProcessPreset
 Represents the importing post process pressets. More...
 
class  BrowserFilesLoadedEvent
 Represents a browser file loading event. This event passes the number of files that was loaded by the browser, which could be used when calling the GetBrowserFileName and GetBrowerFileData methods. More...
 
class  CameraExtensions
 Represents a series of UnityEngine.Camera extension methods. More...
 
class  Dispatcher
 Represents a system for dispatching code to execute on the main thread. More...
 
class  FileUtils
 Contains file helper functions. More...
 
class  JSHelper
 Represents a series of Javascript helper functions. More...
 
class  MatrixExtensions
 Represents a series of UnityEngine.Matrix4x4 extension methods. More...
 
class  StreamUtils
 Contains stream helper functions. More...
 
class  StringUtils
 Represents a series of string functions. More...
 
class  ThreadUtils
 Contains Thread helper functions. More...
 
class  TransformExtensions
 Represents a series of UnityEngine.Transform extension methods. More...
 
class  TriLibProjectUtils
 

Enumerations

enum  AssetAdvancedConfigType {
  AssetAdvancedConfigType.None, AssetAdvancedConfigType.Bool, AssetAdvancedConfigType.Integer, AssetAdvancedConfigType.Float,
  AssetAdvancedConfigType.String, AssetAdvancedConfigType.AiComponent, AssetAdvancedConfigType.AiPrimitiveType, AssetAdvancedConfigType.AiUVTransform,
  AssetAdvancedConfigType.AiMatrix
}
 Represents an asset advanced config type. More...
 
enum  AiPrimitiveType { AiPrimitiveType.Point = 0x1, AiPrimitiveType.Line = 0x2, AiPrimitiveType.Triangle = 0x4, AiPrimitiveType.Polygon = 0x8 }
 Represents a primitive type flags. More...
 
enum  AiComponent {
  AiComponent.Normals = 0x2, AiComponent.TangentsAndBitangents = 0x4, AiComponent.Colors = 0x8, AiComponent.TexCoords = 0x10,
  AiComponent.BoneWeights = 0x20, AiComponent.Animations = 0x40, AiComponent.Textures = 0x80, AiComponent.Lights = 0x100,
  AiComponent.Cameras = 0x200, AiComponent.Meshes = 0x400, AiComponent.Materials = 0x800
}
 Represents a component flags. More...
 
enum  AiUVTransform { AiUVTransform.Rotation = 0x2, AiUVTransform.Scaling = 0x1, AiUVTransform.Translation = 0x4 }
 Represents an UV transform flags. More...
 
enum  AssetAdvancedPropertyClassNames {
  AssetAdvancedPropertyClassNames.ACImportEvalSubdivision, AssetAdvancedPropertyClassNames.ACImportSeparateBackfaceCull, AssetAdvancedPropertyClassNames.ASEImportReconstructNormals, AssetAdvancedPropertyClassNames.CalculateNormalsMaxSmoothingAngle,
  AssetAdvancedPropertyClassNames.CalculateTangentsMaxSmoothingAngle, AssetAdvancedPropertyClassNames.CalculateTangentsTextureChannelIndex, AssetAdvancedPropertyClassNames.ColladaImportIgnoreUpDirection, AssetAdvancedPropertyClassNames.ColladaImportUseColladaNames,
  AssetAdvancedPropertyClassNames.DeboneThreshold, AssetAdvancedPropertyClassNames.DeboneAllOrNone, AssetAdvancedPropertyClassNames.FBXImportReadAllMaterials, AssetAdvancedPropertyClassNames.FBXImportOptimizeEmptyAnimationCurves,
  AssetAdvancedPropertyClassNames.FBXImportEmbeddedTextureLegacyNaming, AssetAdvancedPropertyClassNames.FBXImportDisableDiffuseFactor, AssetAdvancedPropertyClassNames.FBXImportStrictMode, AssetAdvancedPropertyClassNames.FBXImportReadLights,
  AssetAdvancedPropertyClassNames.FBXImportReadMaterials, AssetAdvancedPropertyClassNames.FBXImportPreservePivots, AssetAdvancedPropertyClassNames.FBXImportReadAllGeometryLayers, AssetAdvancedPropertyClassNames.FBXImportReadTextures,
  AssetAdvancedPropertyClassNames.FBXImportReadCameras, AssetAdvancedPropertyClassNames.FBXImportReadAnimations, AssetAdvancedPropertyClassNames.FindDegeneratesRemove, AssetAdvancedPropertyClassNames.FindInvalidDataAnimAccuracy,
  AssetAdvancedPropertyClassNames.IFCImportSkipSpaceRepresentations, AssetAdvancedPropertyClassNames.IFCImportCylindricalTesselation, AssetAdvancedPropertyClassNames.IFCImportSmoothingAngle, AssetAdvancedPropertyClassNames.IFCImportCustomTriangulation,
  AssetAdvancedPropertyClassNames.ImportNoSkeletonMeshes, AssetAdvancedPropertyClassNames.ImportFavourSpeed, AssetAdvancedPropertyClassNames.ImportGlobalKeyframe, AssetAdvancedPropertyClassNames.GlobalScaleFactor,
  AssetAdvancedPropertyClassNames.ImproveCacheLocalityPostTransformCacheSize, AssetAdvancedPropertyClassNames.IRRImportAnimFPS, AssetAdvancedPropertyClassNames.LimitBoneWeightsMaxWeights, AssetAdvancedPropertyClassNames.LWOImportOneLayerOnly,
  AssetAdvancedPropertyClassNames.LWSImportAnimStart, AssetAdvancedPropertyClassNames.LWSImportAnimEnd, AssetAdvancedPropertyClassNames.MD2ImportKeyframe, AssetAdvancedPropertyClassNames.MD3ImportShaderSource,
  AssetAdvancedPropertyClassNames.MD3ImportKeyframe, AssetAdvancedPropertyClassNames.MD3ImportSkinName, AssetAdvancedPropertyClassNames.MD3ImportHandleMultiPart, AssetAdvancedPropertyClassNames.MD5ImportNoAnimAutoLoad,
  AssetAdvancedPropertyClassNames.MDCImportKeyframe, AssetAdvancedPropertyClassNames.MDLmportKeyframe, AssetAdvancedPropertyClassNames.MDLImportColormap, AssetAdvancedPropertyClassNames.OgreImportMaterialFile,
  AssetAdvancedPropertyClassNames.OgreImportTextureTypeFromFilename, AssetAdvancedPropertyClassNames.OptimizeGraphExcludeList, AssetAdvancedPropertyClassNames.PreTransformVerticesNormalize, AssetAdvancedPropertyClassNames.PreTransformVerticesKeepHierarchy,
  AssetAdvancedPropertyClassNames.PreTransformVerticesRootTransformation, AssetAdvancedPropertyClassNames.PreTransformVerticesAddRootTransformation, AssetAdvancedPropertyClassNames.RemoveComponentFlags, AssetAdvancedPropertyClassNames.RemoveRedundantMaterialsExcludeList,
  AssetAdvancedPropertyClassNames.SMDImportKeyframe, AssetAdvancedPropertyClassNames.SmdLoadAnimationList, AssetAdvancedPropertyClassNames.SortByPrimitiveTypeRemove, AssetAdvancedPropertyClassNames.SplitByBoneCountMaxBones,
  AssetAdvancedPropertyClassNames.SplitLargeMeshesTriangleLimit, AssetAdvancedPropertyClassNames.SplitLargeMeshesVertexLimit, AssetAdvancedPropertyClassNames.TerImportMakeUVs, AssetAdvancedPropertyClassNames.TransformUVCoordsEvaluate,
  AssetAdvancedPropertyClassNames.UnrealImportKeyframe, AssetAdvancedPropertyClassNames.UnrealHandleFlags
}
 Represents the asset advanced configs class names. More...
 
enum  AssimpPostProcessSteps {
  AssimpPostProcessSteps.CalcTangentSpace = 0x1, AssimpPostProcessSteps.JoinIdenticalVertices = 0x2, AssimpPostProcessSteps.MakeLeftHanded = 0x4, AssimpPostProcessSteps.Triangulate = 0x8,
  AssimpPostProcessSteps.RemoveComponent = 0x10, AssimpPostProcessSteps.GenNormals = 0x20, AssimpPostProcessSteps.GenSmoothNormals = 0x40, AssimpPostProcessSteps.SplitLargeMeshes = 0x80,
  AssimpPostProcessSteps.PreTransformVertices = 0x100, AssimpPostProcessSteps.LimitBoneWeights = 0x200, AssimpPostProcessSteps.ValidateDataStructure = 0x400, AssimpPostProcessSteps.ImproveCacheLocality = 0x800,
  AssimpPostProcessSteps.RemoveRedundantMaterials = 0x1000, AssimpPostProcessSteps.FixInfacingNormals = 0x2000, AssimpPostProcessSteps.SortByPType = 0x8000, AssimpPostProcessSteps.FindDegenerates = 0x10000,
  AssimpPostProcessSteps.FindInvalidData = 0x20000, AssimpPostProcessSteps.GenUvCoords = 0x40000, AssimpPostProcessSteps.TransformUvCoords = 0x80000, AssimpPostProcessSteps.FindInstances = 0x100000,
  AssimpPostProcessSteps.OptimizeMeshes = 0x200000, AssimpPostProcessSteps.OptimizeGraph = 0x400000, AssimpPostProcessSteps.FlipUVs = 0x800000, AssimpPostProcessSteps.FlipWindingOrder = 0x1000000,
  AssimpPostProcessSteps.SplitByBoneCount = 0x2000000, AssimpPostProcessSteps.Debone = 0x4000000, AssimpPostProcessSteps.DropNormals = 0x40000000
}
 Represents the importing post process steps. This documentation is based on the latest Assimp branch. Based on: Assimp documentation. More...
 
enum  MaterialShadingMode { MaterialShadingMode.Standard, MaterialShadingMode.Roughness, MaterialShadingMode.Specular }
 Represents the material shading mode to be used when selecting Unity materials. More...
 
enum  MaterialTransparencyMode { MaterialTransparencyMode.Alpha, MaterialTransparencyMode.Cutout, MaterialTransparencyMode.Fade }
 Represents the material transparency mode used when selecting Unity materials. More...
 

Functions

delegate void ObjectLoadedHandle (GameObject loadedGameObject)
 Represents an AssetLoader asset loaded event handler. More...
 
delegate void MeshCreatedHandle (uint meshIndex, Mesh mesh)
 Represents an AssetLoader mesh creation event handler. More...
 
delegate void MaterialCreatedHandle (uint materialIndex, bool isOverriden, Material material)
 Represents an AssetLoader material created event handler. More...
 
delegate void AvatarCreatedHandle (Avatar avatar, Animator animator)
 Represents an AssetLoader avatar created event handler. More...
 
delegate void AnimationClipCreatedHandle (uint animationClipIndex, AnimationClip animationClip)
 Represents an AssetLoader animation created event handler. More...
 
delegate void MetadataProcessedHandle (AssimpMetadataType metadataType, uint metadataIndex, string metadataKey, object metadataValue)
 Represents an AssetLoader metadata processed event handler. More...
 
delegate void BlendShapeKeyCreatedHandle (Mesh mesh, string name, Vector3[] vertices, Vector3[] normals, Vector4[] tangents, Vector4[] biTangents)
 Represents a blend-shape key created event handler. More...
 
delegate EmbeddedTextureData LoadTextureDataCallback (string path, string basePath)
 Callback used to retrieve custom embedded texture data. More...
 
delegate EmbeddedTextureData EmbeddedTextureLoadCallback (string path)
 Event used to pass a custom texture data when processing a texture entry. More...
 

Enumeration Type Documentation

◆ AiComponent

enum TriLib.AiComponent
strong

Represents a component flags.

Enumerator
Normals 

Normal components.

TangentsAndBitangents 

Tangents and Bitangents components.

Colors 

Colors components.

TexCoords 

Texture coordinates components.

BoneWeights 

Bone weights components.

Animations 

Animations components.

Textures 

Texture components.

Lights 

Light components.

Cameras 

Camera components.

Meshes 

Mesh components.

Materials 

Material components.

◆ AiPrimitiveType

Represents a primitive type flags.

Enumerator
Point 

Point primitive type.

Line 

Line primitive type.

Triangle 

Triangle primitive type.

Polygon 

Polygon primitive type.

◆ AiUVTransform

enum TriLib.AiUVTransform
strong

Represents an UV transform flags.

Enumerator
Rotation 

Apply rotation.

Scaling 

Apply scaling.

Translation 

Apply translation.

◆ AssetAdvancedConfigType

Represents an asset advanced config type.

Enumerator
None 

Not a valid config type.

Bool 

Boolean config type.

Integer 

Integer config type.

Float 

Float config type.

String 

String config type.

AiComponent 

AiComponent config type.

AiPrimitiveType 

AiPrimitiveType config type.

AiUVTransform 

AiUVTransform config type.

AiMatrix 

AiMatrix config type.

◆ AssetAdvancedPropertyClassNames

Represents the asset advanced configs class names.

Enumerator
ACImportEvalSubdivision 

Configures whether the AC loader evaluates subdivision surfaces (indicated by the presence of the 'subdiv' attribute in the file). By default, TriLib performs the subdivision using the standard Catmull-Clark algorithm.

ACImportSeparateBackfaceCull 

Configures the AC loader to collect all surfaces which have the "Backface cull" flag set in separate meshes.

ASEImportReconstructNormals 

Configures the ASE loader to always reconstruct normal vectors basing on the smoothing groups loaded from the file. Some ASE files carry invalid normals, others don't.

CalculateNormalsMaxSmoothingAngle 

Specifies the maximum angle that may be between two face normals at the same vertex position that their normals will be smoothed together during the calculate smooth normals step. This is commonly called the "crease angle". The angle is specified in degrees.

CalculateTangentsMaxSmoothingAngle 

Specifies the maximum angle that may be between two vertex tangents that their tangents and bitangents are smoothed during the step to calculate the tangent basis. The angle specified is in degrees.

CalculateTangentsTextureChannelIndex 

Source UV channel for tangent space computation. The specified channel must exist or an error will be raised.

ColladaImportIgnoreUpDirection 

Specifies whether the collada loader will ignore the up direction.

ColladaImportUseColladaNames 

If this property is set to true, the Collada names will be used as the

  • node name. The default is to use the id tag (resp. sid tag, if no id tag is present)
  • instead.
DeboneThreshold 

Threshold used to determine if a bone is kept or removed during the TriLib.AssimpPostProcessSteps.Debone step.

DeboneAllOrNone 

Require all bones to qualify for de-boning before any are removed.

FBXImportReadAllMaterials 

Specifies whether the FBX importer will read all materials present in the source file or take only the referenced materials, if the importer will read materials, otherwise this has no effect.

FBXImportOptimizeEmptyAnimationCurves 

Specifies whether the importer will drop empty animation curves or animation curves which match the bind pose

FBXImportEmbeddedTextureLegacyNaming 

Specifies whether the FBX importer will use legacy embedded texture naming

FBXImportDisableDiffuseFactor 

Specifies whether the FBX importer will disable materials color factor

FBXImportStrictMode 

Specifies whether the FBX importer will act in strict mode in which only the FBX 2013
format is supported and any other sub formats are rejected. FBX 2013 is the primary target for the importer, so this
format is best supported and well-tested.

FBXImportReadLights 

Specifies whether the FBX importer will read light sources.

FBXImportReadMaterials 

Specifies whether the FBX importer will read materials.

FBXImportPreservePivots 

Specifies whether the FBX importer will preserve pivot points for transformations (as extra nodes). If set to false, pivots and offsets will be evaluated whenever possible.

FBXImportReadAllGeometryLayers 

Specifies whether the FBX importer will merge all geometry layers present in the source file or take only the first.

FBXImportReadTextures 

Specifies whether the FBX importer will read embedded textures.

FBXImportReadCameras 

Specifies whether the FBX importer will read cameras.

FBXImportReadAnimations 

Specifies whether the FBX importer will read animations.

FindDegeneratesRemove 

Configures the TriLib.AssimpPostProcessSteps.FindDegenerates step to remove degenerated primitives from the import immediately.

The default behavior converts degenerated triangles to lines and degenerated lines to points.

FindInvalidDataAnimAccuracy 

Input parameter to the TriLib.AssimpPostProcessSteps.FindInvalidData step. It specifies the floating point accuracy for animation values, specifically the epsilon during the comparison. The step checks for animation tracks where all frame values are absolutely equal and removes them. Two floats are considered equal if the invariant abs(n0-n1) > epislon holds true for all vector/quaternion components.

IFCImportSkipSpaceRepresentations 

Specifies whether the IFC loader skips over shape representations of type 'Curve2D'. A lot of files contain both a faceted mesh representation and a outline with a presentation type of 'Curve2D'. Currently TriLib does not convert those, so turning this option off just clutters the log with errors.

IFCImportCylindricalTesselation 

This is used by the IFC importer to determine the tessellation parameter for cylindrical shapes, i.e. the number of segments used to approximate a circle.

IFCImportSmoothingAngle 

This is used by the IFC importer to determine the tessellation parameter for smoothing curves.

IFCImportCustomTriangulation 

Specifies whether the IFC loader will use its own, custom triangulation algorithm to triangulate wall and floor meshes. If this is set to false, walls will be either triangulated by the post process triangulation or will be passed through as huge polygons with faked holes (e.g. holes that are connected with the outer boundary using a dummy edge). It is highly recommended to leave this property set to true as the default post process has some known issues with these kind of polygons.

ImportNoSkeletonMeshes 

Global setting to disable generation of skeleton dummy meshes. These are generated as a visualization aid in cases which the input data contains no geometry, but only animation data. So the geometry are visualizing the bones.

ImportFavourSpeed 

A hint to TriLib to favour speed against import quality. Enabling this option may result in faster loading, or it may not. It is just a hint to loaders and post-processing steps to use faster code paths if possible. A value not equal to zero stands for true.

ImportGlobalKeyframe 

Sets the vertex animation keyframe to be imported. TriLib does not support vertex animation.

summary> Specifies a global key factor for scale, float value

GlobalScaleFactor 
ImproveCacheLocalityPostTransformCacheSize 

Sets the size of the post-transform vertex cache to optimize vertices for. This is for the TriLib.AssimpPostProcessSteps.ImproveCacheLocality step. The size is given in vertices. Of course you can't know how the vertex format will exactly look like after the import returns, but you can still guess what your meshes will probably have. The default value has resulted in slight performance improvements for most Nvidia/AMD cards since 2002.

IRRImportAnimFPS 

Defines the output frame rate of the IRR loader.

IRR animations are difficult to convert for TriLib and there will always be a loss of quality. This setting defines how many keys per second are returned by the converter.

LimitBoneWeightsMaxWeights 

Sets the maximum number of bones that can affect a single vertex. This is used by the TriLib.AssimpPostProcessSteps.LimitBoneWeights step.

LWOImportOneLayerOnly 

Configures the LWO loader to load just one layer from the model.

LWO files consist of layers and in some cases it could be useful to load only one of them. This property can be either a string - which specifies the name of the layer - or an integer - the index of the layer. If the property is not set then the whole LWO model is loaded. Loading fails if the requested layer is not available. The layer index is zero-based and the layer name may not be empty

LWSImportAnimStart 

Defines the beginning of the time range for which the LWS loader evaluates animations and computes AiNodeAnim's.

TriLib provides full conversion of Lightwave's envelope system, including pre and post conditions. The loader computes linearly subsampled animation channels with the frame rate given in the LWS file. This property defines the start time.

Animation channels are only generated if a node has at least one envelope with more than one key assigned. This property is given in frames where '0' is the first. By default, if this property is not set, the importer takes the animation start from the input LWS file ('FirstFrame' line)

LWSImportAnimEnd 

Defines the ending of the time range for which the LWS loader evaluates animations and computes AiNodeAnim's.

TriLib provides full conversion of Lightwave's envelope system, including pre and post conditions. The loader computes linearly subsampled animation channels with the frame rate given in the LWS file. This property defines the end time.

Animation channels are only generated if a node has at least one envelope with more than one key assigned. This property is given in frames where '0' is the first. By default, if this property is not set, the importer takes the animation end from the input LWS file.

MD2ImportKeyframe 

Sets the vertex animation keyframe to be imported. TriLib does not support vertex animation.

MD3ImportShaderSource 

Specifies the Quake 3 shader file to be used for a particular MD3 file. This can be a full path or relative to where all MD3 shaders reside.

MD3ImportKeyframe 

Sets the vertex animation keyframe to be imported. TriLib does not support vertex animation.

MD3ImportSkinName 

Tells the MD3 loader which skin files to load. When loading MD3 files, TriLib checks whether a file named "md3_file_name"_"skin_name".skin exists. These files are used by Quake III to be able to assign different skins (e.g. red and blue team) to models. 'default', 'red', 'blue' are typical skin names.

MD3ImportHandleMultiPart 

Configures the MD3 loader to detect and process multi-part Quake player models. These models usually consit of three files, lower.md3, upper.md3 and head.md3. If this propery is set to true, TriLib will try to load and combine all three files if one of them is loaded.

MD5ImportNoAnimAutoLoad 

Configures the MD5 loader to not load the MD5ANIM file for a MD5MESH file automatically.

The default strategy is to look for a file with the same name but with the MD5ANIm extension in the same directory. If it is found it is loaded and combined with the MD5MESH file. This configuration option can be used to disable this behavior.

MDCImportKeyframe 

Sets the vertex animation key-frame to be imported. TriLib does not support vertex animation.

MDLmportKeyframe 

Sets the vertex animation key-frame to be imported. TriLib does not support vertex animation.

MDLImportColormap 

Sets the color-map (= palette) to be used to decode embedded textures in MDL (Quake or 3DG5) files. This must be a valid path to a file. The file is 768 (256 * 3) bytes large and contains RGB triplets for each of the 256 palette entries. If the file is not found, a default palette (from Quake 1) is used.

OgreImportMaterialFile 

The Ogre importer will try to load this MaterialFile. Ogre meshes reference with material names, this does not tell TriLib where the file is located. TriLib will try to find the source file in the following order: [material-name].material, [mesh-filename-base].material, and lastly the material name defined by this config property.

summary> The Ogre importer will detect the texture usage from the filename. Normally a texture is loaded as a color map, if no target is specified in the material file. If this is enabled, then TriLib will try to detect the type from the texture filename postfix:

  • Normal Maps: n, _nrm, _nrml, _normal, _normals, _normalmap
  • Specular Maps: _s, _spec, _specular, _specularmap
  • Light Maps: _l, _light, _lightmap, _occ, _occlusion
  • Displacement Maps: _dis, _displacement

The matching is case insensitive. Postfix is taken between the last "</em>" and last ".". The default behavior is to detect type from lower cased texture unit name by matching against: normalmap, specular-map, lightmap, and displacement-map. For both cases if no match is found then, diffuse texture type is used. /summary>

OgreImportTextureTypeFromFilename 
OptimizeGraphExcludeList 

Configures the TriLib.AssimpPostProcessSteps.OptimizeGraph step to preserve nodes matching a name in a given list. This is a list of 1 to n strings, whitespace ' ' serves as a delimter character. Identifiers containing whitespaces must be enclosed in single quotation marks. Carriage returns and tabs are treated as white space.

If a node matches one of these names, it will not be modified or removed by the post-processing step.

PreTransformVerticesNormalize 

Configures the TriLib.PostProcessSteps.PreTransformVertices step to normalize all vertex components into the -1...1 range.

PreTransformVerticesKeepHierarchy 

Configures the TriLib.AssimpPostProcessSteps.PreTransformVertices step to keep the scene hierarchy. Meshes are moved to world-space, but no optimization is performed where meshes with the same materials are not joined.

This option could be of used if you have a scene hierarchy that contains important additional information which you intend to parse.

PreTransformVerticesRootTransformation 

Configures the TriLib.AssimpPostProcessSteps.PreTransformVertices step to use a user defined matrix as the scene root node transformation before transforming vertices.

PreTransformVerticesAddRootTransformation 

Configures the TriLib.AssimpPostProcessSteps.PreTransformVertices step to use a user defined matrix as the scene root node transformation before transforming vertices.

RemoveComponentFlags 

Input parameter to the TriLib.AssimpPostProcessSteps.RemoveComponent step. It specifies the parts of the data structure to be removed.

This is a bitwise combination of the TriLib.AiComponent flag. If no valid mesh is remaining after the step is executed, the import FAILS.

RemoveRedundantMaterialsExcludeList 

Configures the TriLib.AssimpPostProcessSteps.RemoveRedundantMaterials step to keep materials matching a name in a given list. This is a list of 1 to n strings where whitespace ' ' serves as a delimiter character. Identifiers containing whitespaces must be enclosed in single quotation marks. Tabs or carriage returns are treated as whitespace.

If a material matches one of these names, it will not be modified or removed by the post processing step nor will other materials be replaced by a reference to it.

SMDImportKeyframe 

Sets the vertex animation key-frame to be imported. TriLib does not support vertex animation.

SmdLoadAnimationList 

Smd load multiple animations

SortByPrimitiveTypeRemove 

Input parameter to the TriLib.AssimpPostProcessSteps.SortByPrimitiveType step. It specifies which primitive types are to be removed by the step.

This is a bitwise combination of the TriLib.AiPrimitiveType flag. Specifying ALL types is illegal.

SplitByBoneCountMaxBones 

Maximum bone cone per mesh for the TriLib.AssimpPostProcessSteps.SplitByBoneCount step.

SplitLargeMeshesTriangleLimit 

Sets the maximum number of triangles a mesh can contain. This is used by the TriLib.AssimpPostProcessSteps.SplitLargeMeshes step to determine whether a mesh must be split or not.

SplitLargeMeshesVertexLimit 

Sets the maximum number of vertices in a mesh. This is used by the TriLib.AssimpPostProcessSteps.SplitLargeMeshes step to determine whether a mesh must be split or not.

TerImportMakeUVs 

Configures the terragen import plugin to compute UV's for terrains, if they are not given. Furthermore, a default texture is assigned.

UV coordinates for terrains are so simple to compute that you'll usually want to compute them on your own, if you need them. This option is intended for model viewers which want to offer an easy way to apply textures to terrains.

TransformUVCoordsEvaluate 

Input parameter to the TriLib.AssimpPostProcessSteps.TransformUVCoords step. It specifies which UV transformations are to be evaluated.

This is bitwise combination of the TriLib.AiUVTransform flag.

UnrealImportKeyframe 

Sets the vertex animation keyframe to be imported. TriLib does not support vertex animation.

UnrealHandleFlags 

Configures the UNREAL 3D loader to separate faces with different surface flags (e.g. two-sided vs single-sided).

◆ AssimpPostProcessSteps

Represents the importing post process steps. This documentation is based on the latest Assimp branch. Based on: Assimp documentation.

Enumerator
CalcTangentSpace 

Calculates the tangents and bitangents for the imported meshes.

Does nothing if a mesh does not have normals. You might want this post processing step to be executed if you plan to use tangent space calculations such as normal mapping applied to the meshes. There's an importer property, TriLib.AssetAdvancedPropertyClassNames.CalculateTangentsMaxSmoothingAngle, which allows you to specify a maximum smoothing angle for the algorithm. However, usually you'll want to leave it at the default value.

JoinIdenticalVertices 

Identifies and joins identical vertex data sets within all imported meshes.

After this step is run, each mesh contains unique vertices, so a vertex may be used by multiple faces. You usually want to use this post processing step. If your application deals with indexed geometry, this step is compulsory or you'll just waste rendering time. If this flag is not specified, no vertices are referenced by more than one face and no index buffer is required for rendering.

MakeLeftHanded 

Converts all the imported data to a left-handed coordinate space.

Triangulate 

Triangulates all faces of all meshes.

By default the imported mesh data might contain faces with more than 3 indices. For rendering you'll usually want all faces to be triangles. This post processing step splits up faces with more than 3 indices into triangles. Line and point primitives are ///not/// modified! If you want 'triangles only' with no other kinds of primitives, try the following solution:

RemoveComponent 

Removes some parts of the data structure (animations, materials, light sources, cameras, textures, vertex components).

The components to be removed are specified in a separate importer property, TriLib.AssetAdvancedPropertyClassNames.RemoveComponentFlags. This is quite useful if you don't need all parts of the output structure. Vertex colors are rarely used today for example... Calling this step to remove unneeded data from the pipeline as early as possible results in increased performance and a more optimized output data structure. This step is also useful if you want to force TriLib to recompute normals or tangents. The corresponding steps don't recompute them if they're already there (loaded from the source asset). By using this step you can make sure they are NOT there.

This flag is a poor one, mainly because its purpose is usually misunderstood. Consider the following case: a 3D model has been exported from a CAD app, and it has per-face vertex colors. Vertex positions can't be shared, thus the TriLib.AssimpPostProcessSteps.JoinIdenticalVertices step fails to optimize the data because of these nasty little vertex colors. Most apps don't even process them, so it's all for nothing. By using this step, unneeded components are excluded as early as possible thus opening more room for internal optimizations.

GenNormals 

Generates normals for all faces of all meshes.

This is ignored if normals are already there at the time this flag is evaluated. Model importers try to load them from the source file, so they're usually already there. Face normals are shared between all points of a single face, so a single point can have multiple normals, which forces the library to duplicate vertices in some cases. TriLib.AssimpProcessPreset.JoinIdenticalVertices is ///senseless/// then.

This flag may not be specified together with TriLib.PostProcessSteps.GenSmoothNormals.

GenSmoothNormals 

Generates smooth normals for all vertices in the mesh.

This is ignored if normals are already there at the time this flag is evaluated. Model importers try to load them from the source file, so they're usually already there.

This flag may not be specified together with TriLib.AssimpProcessPreset.GenNormals. There's a importer property, TriLib.AssetAdvancedPropertyClassNames.CalculateNormalsMaxSmoothingAngle which allows you to specify an angle maximum for the normal smoothing algorithm. Normals exceeding this limit are not smoothed, resulting in a 'hard' seam between two faces. Using a decent angle here (e.g. 80 degrees) results in very good visual appearance.

SplitLargeMeshes 

Splits large meshes into smaller sub-meshes.

This is quite useful for real-time rendering, where the number of triangles which can be maximally processed in a single draw-call is limited by the video driver/hardware. The maximum vertex buffer is usually limited too. Both requirements can be met with this step: you may specify both a triangle and vertex limit for a single mesh.

The split limits can (and should!) be set through the TriLib.AssetAdvancedPropertyClassNames.SplitLargeMeshesVertexLimit and TriLib.AssetAdvancedPropertyClassNames.SplitLargeMeshesTriangleLimit importer properties.

Note that splitting is generally a time-consuming task, but only if there's something to split. The use of this step is recommended for most users.

PreTransformVertices 

Removes the node graph and pre-transforms all vertices with the local transformation matrices of their nodes.

The output scene still contains nodes, however there is only a root node with children, each one referencing only one mesh, and each mesh referencing one material. For rendering, you can simply render all meshes in order - you don't need to pay attention to local transformations and the node hierarchy. Animations are removed during this step. This step is intended for applications without a scenegraph. The step CAN cause some problems: if e.g. a mesh of the asset contains normals and another, using the same material index, does not, they will be brought together, but the first meshes's part of the normal list is zeroed. However, these artifacts are rare.

Note
The TriLib.AssetAdvancedPropertyClassNames.PreTransformVerticesNormalize configuration property can be set to normalize the scene's spatial dimension to the -1...1 range.
LimitBoneWeights 

Limits the number of bones simultaneously affecting a single vertex to a maximum value.

If any vertex is affected by more than the maximum number of bones, the least important vertex weights are removed and the remaining vertex weights are renormalized so that the weights still sum up to 1. The default bone weight limit is 4, but you can use the TriLib.AssetAdvancedPropertyClassNames.LimitBoneWeightsMaxWeights importer property to supply your own limit to the post processing step.

If you intend to perform the skinning in hardware, this post processing step might be of interest to you.

ValidateDataStructure 

Validates the imported scene data structure. This makes sure that all indices are valid, all animations and bones are linked correctly, all material references are correct .. etc.

It is recommended that you capture TriLib's log output if you use this flag, so you can easily find out what's wrong if a file fails the validation. The validator is quite strict and will find ///all/// inconsistencies in the data structure... It is recommended that plugin developers use it to debug their loaders. There are two types of validation failures:

  • Error: There's something wrong with the imported data. Further postprocessing is not possible and the data is not usable at all. The import fails. #TriLib.AssimpInterop.aiGetErrorString carry the error message around.

This post-processing step is not time-consuming. Its use is not compulsory, but recommended.

ImproveCacheLocality 

Reorders triangles for better vertex cache locality.

The step tries to improve the ACMR (average post-transform vertex cache miss ratio) for all meshes. The implementation runs in O(n) and is roughly based on the 'tipsify' algorithm (see this paper).

If you intend to render huge models in hardware, this step might be of interest to you. The TriLib.AssetAdvancedPropertyClassNames.ImproveCacheLocalityPostTransformCacheSize importer property can be used to fine-tune the cache optimization.

RemoveRedundantMaterials 

Searches for redundant/unreferenced materials and removes them.

This is especially useful in combination with the TriLib.PostProcessSteps.PreTransformVertices and TriLib.PostProcessSteps.OptimizeMeshes flags. Both join small meshes with equal characteristics, but they can't do their work if two meshes have different materials. Because several material settings are lost during TriLib's import filters, (and because many exporters don't check for redundant materials), huge models often have materials which are are defined several times with exactly the same settings.

Several material settings not contributing to the final appearance of a surface are ignored in all comparisons (e.g. the material name). So, if you're passing additional information through the content pipeline (probably using ///magic/// material names), don't specify this flag. Alternatively take a look at the TriLib.AssetAdvancedPropertyClassNames.OptimizeGraphExcludeList importer property.

FixInfacingNormals 

This step tries to determine which meshes have normal vectors that are facing inwards and inverts them.

The algorithm is simple but effective: the bounding box of all vertices + their normals is compared against the volume of the bounding box of all vertices without their normals. This works well for most objects, problems might occur with planar surfaces. However, the step tries to filter such cases. The step inverts all in-facing normals. Generally it is recommended to enable this step, although the result is not always correct.

SortByPType 

This step splits meshes with more than one primitive type in homogeneous sub-meshes.

The step is executed after the triangulation step. After the step returns, just one bit is set in aiMesh::mPrimitiveTypes. This is especially useful for real-time rendering where point and line primitives are often ignored or rendered separately. You can use the TriLib.AssetAdvancedPropertyClassNames.SortByPrimitiveTypeRemove importer property to specify which primitive types you need. This can be used to easily exclude lines and points, which are rarely used, from the import.

FindDegenerates 

This step searches all meshes for degenerate primitives and converts them to proper lines or points.

A face is 'degenerate' if one or more of its points are identical. To have the degenerate stuff not only detected and collapsed but removed, try one of the following procedures:
1. (if you support lines and points for rendering but don't want the degenerates)


2.(if you don't support lines and points at all)

Note
Degenerate polygons are not necessarily evil and that's why they're not removed by default. There are several file formats which don't support lines or points, and some exporters bypass the format specification and write them as degenerate triangles instead.
FindInvalidData 

This step searches all meshes for invalid data, such as zeroed normal vectors or invalid UV coords and removes/fixes them. This is intended to get rid of some common exporter errors.

This is especially useful for normals. If they are invalid, and the step recognizes this, they will be removed and can later be recomputed, i.e. by the TriLib.AssimpPostProcessSteps.GenSmoothNormals flag.
The step will also remove meshes that are infinitely small and reduce animation tracks consisting of hundreds if redundant keys to a single key. The TriLib.AssetAdvancedPropertyClassNames.FindInvalidDataAnimAccuracy config property decides the accuracy of the check for duplicate animation tracks.

GenUvCoords 

This step converts non-UV mappings (such as spherical or cylindrical mapping) to proper texture coordinate channels.

Most applications will support UV mapping only, so you will probably want to specify this step in every case. Note that TriLib is not always able to match the original mapping implementation of the 3D app which produced a model perfectly. It's always better to let the modelling app compute the UV channels - 3ds max, Maya, Blender, LightWave, and Modo do this for example.

TransformUvCoords 

This step applies per-texture UV transformations and bakes them into stand-alone vtexture coordinate channels.

UV transformations are specified per-texture - see the TriLib.AssetAdvancedPropertyClassNames.TransformUVCoordsEvaluate material key for more information. This step processes all textures with transformed input UV coordinates and generates a new (pre-transformed) UV channel which replaces the old channel. Most applications won't support UV transformations, so you will probably want to specify this step.

Note
UV transformations are usually implemented in real-time apps by transforming texture coordinates at vertex shader stage with a 3x3 (homogenous) transformation matrix.
FindInstances 

This step searches for duplicate meshes and replaces them with references to the first mesh.

This step takes a while, so don't use it if speed is a concern. Its main purpose is to workaround the fact that many export file formats don't support instanced meshes, so exporters need to duplicate meshes. This step removes the duplicates again. Please note that TriLib does not currently support per-node material assignment to meshes, which means that identical meshes with different materials are currently ///not/// joined, although this is planned for future versions.

OptimizeMeshes 

A postprocessing step to reduce the number of meshes.

This will, in fact, reduce the number of draw calls.

This is a very effective optimization and is recommended to be used together with TriLib.PostProcessSteps.OptimizeGraph, if possible. The flag is fully compatible with both TriLib.PostProcessSteps.SplitLargeMeshes and TriLib.PostProcessSteps.SortByPType.

OptimizeGraph 

A postprocessing step to optimize the scene hierarchy.

Nodes without animations, bones, lights or cameras assigned are collapsed and joined.

Node names can be lost during this step. If you use special 'tag nodes' to pass additional information through your content pipeline, use the TriLib.AssetAdvancedPropertyClassNames.OptimizeGraphExcludeList importer property to specify a list of node names you want to be kept. Nodes matching one of the names in this list won't be touched or modified.

Use this flag with caution. Most simple files will be collapsed to a single node, so complex hierarchies are usually completely lost. This is not useful for editor environments, but probably a very effective optimization if you just want to get the model data, convert it to your own format, and render it as fast as possible.

This flag is designed to be used with TriLib.PostProcessSteps.OptimizeMeshes for best results.

Note
'Crappy' scenes with thousands of extremely small meshes packed in deeply nested nodes exist for almost all file formats. TriLib.PostProcessSteps.OptimizeMeshes in combination with TriLib.PostProcessSteps.OptimizeGraph usually fixes them all and makes them renderable.
FlipUVs 

This step flips all UV coordinates along the y-axis and adjusts material settings and bitangents accordingly.

Output UV coordinate system:

0y|0y ---------- 1x|0y
| |
| |
| |
0x|1y ---------- 1x|1y

The TriLib.AssimpProcessPreset.ConvertToLeftHanded flag supersedes this setting.

FlipWindingOrder 

This step adjusts the output face winding order to be CW.

The default face winding order is counter clockwise (CCW).

Output face order:

x2
x0
x1
SplitByBoneCount 

This step splits meshes with many bones into sub-meshes so that each su-bmesh has fewer or as many bones as a given limit.

Debone 

This step removes bones losslessly or according to some threshold.

In some cases (i.e. formats that require it) exporters are forced to assign dummy bone weights to otherwise static meshes assigned to animated meshes. Full, weight-based skinning is expensive while animating nodes is extremely cheap, so this step is offered to clean up the data in that regard.

Use TriLib.AssetAdvancedPropertyClassNames.DeboneThreshold to control this. Use TriLib.AssetAdvancedPropertyClassNames.DeboneAllOrNone if you want bones removed if and only if all bones within the scene qualify for removal.

DropNormals 

Drops normals for all faces of all meshes.

This is ignored if no normals are present. Face normals are shared between all points of a single face, so a single point can have multiple normals, which forces the library to duplicate vertices in some cases. TriLib.AssetAdvancedPropertyClassNames.JoinIdenticalVertices is senseless then. This process gives sense back to TriLib.AssetAdvancedPropertyClassNames.JoinIdenticalVertices

◆ MaterialShadingMode

Represents the material shading mode to be used when selecting Unity materials.

Enumerator
Standard 
Roughness 
Specular 

◆ MaterialTransparencyMode

Represents the material transparency mode used when selecting Unity materials.

Enumerator
Alpha 
Cutout 
Fade 

Function Documentation

◆ AnimationClipCreatedHandle()

delegate void TriLib.AnimationClipCreatedHandle ( uint  animationClipIndex,
AnimationClip  animationClip 
)

Represents an AssetLoader animation created event handler.

◆ AvatarCreatedHandle()

delegate void TriLib.AvatarCreatedHandle ( Avatar  avatar,
Animator  animator 
)

Represents an AssetLoader avatar created event handler.

◆ BlendShapeKeyCreatedHandle()

delegate void TriLib.BlendShapeKeyCreatedHandle ( Mesh  mesh,
string  name,
Vector3 []  vertices,
Vector3 []  normals,
Vector4 []  tangents,
Vector4 []  biTangents 
)

Represents a blend-shape key created event handler.

Parameters
meshUnityEngine.Mesh where the blend-shape key has been created.
nameBlend-shape name
verticesBlend-shape key vertices.
normalsBlend-shape key normals.
tangentsBlend-shape key tangents.
biTangentsBlend-shape key bi-tangents.

◆ EmbeddedTextureLoadCallback()

delegate EmbeddedTextureData TriLib.EmbeddedTextureLoadCallback ( string  path)

Event used to pass a custom texture data when processing a texture entry.

◆ LoadTextureDataCallback()

delegate EmbeddedTextureData TriLib.LoadTextureDataCallback ( string  path,
string  basePath 
)

Callback used to retrieve custom embedded texture data.

Parameters
pathTexture path.
basePathTexture base path.
Returns
A new EmbeddedTextureData

◆ MaterialCreatedHandle()

delegate void TriLib.MaterialCreatedHandle ( uint  materialIndex,
bool  isOverriden,
Material  material 
)

Represents an AssetLoader material created event handler.

◆ MeshCreatedHandle()

delegate void TriLib.MeshCreatedHandle ( uint  meshIndex,
Mesh  mesh 
)

Represents an AssetLoader mesh creation event handler.

◆ MetadataProcessedHandle()

delegate void TriLib.MetadataProcessedHandle ( AssimpMetadataType  metadataType,
uint  metadataIndex,
string  metadataKey,
object  metadataValue 
)

Represents an AssetLoader metadata processed event handler.

Parameters
metadataTypeThe AssimpMetadataType of the metadata.
metadataIndexThe index of the metadata
metadataKeyThe key of the metadata
metadataValueThe value of the metadata

◆ ObjectLoadedHandle()

delegate void TriLib.ObjectLoadedHandle ( GameObject  loadedGameObject)

Represents an AssetLoader asset loaded event handler.