Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you want use a custom mesh format you can extend atoms writing with a new mesh loader. Since the version 2.0 atoms already support the Atoms supports atoms mesh and alembic mesh formats (from version 2.0). To add a new mesh format you must create a new class definition that extend the Atoms::BaseMeshLoader. Then , then you must register the new loader class inside an atoms plugin

...

Atoms calls the load function to read the new mesh format. This function must fill and return a MapMetadata with the data read from your mesh file.

This MapMetadata can contains contain multiple mesh meshes and it must have follow this formatstructure:

Code Block
languagepy
MapMetadata{
	"geo1":
	MapMetadata{
		"geo": MeshMetadata(), //This is the render/preview geo geo

		"cloth": MeshMetadata(), //If the mesh is a cloth mesh then fill this entry instead the geo

		"jointIndices": (optional)
		ArrayMetadata[ // skin joint ids per vertex, this must have the same length of the points array
			IntArrayMetadata(), // array of joint (influence) indices for the current vertex
			IntArrayMetadata(),
			...
		],

		"jointWeights": (optional)
		ArrayMetadata[ // skin joint weights per vertex, this must have the same length of the points array
			DoubleArrayMetadata(), // array of joint (influence) weight for the current vertex
			DoubleArrayMetadata(),
			...
		],

		"blendShapes": // Blend shapes data (optional)
		ArrayMetadata[
			MapMetadata{
				"id":IntMetadata(), // index of the current blend shape, this index is used at render/preview time to get the target weight from the agent metadata
				"name":StringMetadata(), // name of the target
				"P":Vector3ArrayMetadata(),
				"N":Vector3ArrayMetadata()
			},
			MapMetadata{
				"id":IntMetadata(),
				"name":StringMetadata(),
				"P":Vector3ArrayMetadata(),
				"N":Vector3ArrayMetadata()
			},
			...
		],

		"atoms":
		MapMetadata{ //Custom data. This data is written on the mesh sent to the renderer. You can use these attributes to drive shader attributes from he mesh. The mesh attribute on the arnold/rman/vray mesh will use the atoms_ prefix. (optional)
			"fooattr":DobuleMetadata(),
			"fooattr1":StringMetadata(),
			...
		},
		"arnold":
		MapMetadata{ // These attributes are converted to arnold polymesh node attributes (optional)
			"fooattr":DobuleMetadata(),
			"fooattr1":StringMetadata(),
			...
		},
		"rman":
		MapMetadata{ // These attributes are converted to rman mesh node attributes (optional)
			"fooattr":DobuleMetadata(),
			"fooattr1":StringMetadata(),
			...
		},
		"vray":
		MapMetadata{ // These attributes are converted to vray mesh node attributes (optional)
			"fooattr":DobuleMetadata(),
			"fooattr1":StringMetadata(),
			...
		}

		"xgen_Pref":Vector3ArrayMetadata(), // xgen pref point attribute (optional)
		"__Pref":Vector3ArrayMetadata(), // renderman pref point attribute (optional)
		"__WPref":Vector3ArrayMetadata(), // renderman wpref point attribute (optional)
		"__Nref":Vector3ArrayMetadata(), // renderman nref point attribute (optional)
		"__WNref":Vector3ArrayMetadata(), // renderman nwref point attribute (optional)


		"color":Vector3Metadata(), // Color used for preview without the textures by the skin mode (optional)
		"colorTexture":ImageMetadata(), // Texture used for preview by the skin mode (optional)
		"specularColor":Vector3Metadata(), // Specular color used for preview without the textures by the skin mode (optional)
		"specularColorTexture":ImageMetadata(), // Specular texture used for preview by the skin mode (optional)
	},

	"geo2":
	MapMetadata{...},
		
	"geo3":
	MapMetadata{...},

	...
}


Register To register the new loader to atoms:

Code Block
languagecpp
extern "C"
{
	ATOMSPLUGIN_EXPORT bool initializePlugin()
	{
		MeshLoaderFactory& factory = MeshLoaderFactory::instance();
		factory.registerMeshLoader(FooMeshLoader::staticTypeStr, &FooMeshLoader::creator);
	}
}

...

Add to the ATOMS_PLUGINS_PATH environment variable, the folder where the library compiles against Atoms is located. While , while add to the ATOMS_PROCEDURAL_PLUGINS_PATH env variable the path where the library compiled against AtomsProcedural is located.