Forum Lobby

How to create a Mod plant from a FBX file

We try to dissect a Mod creating a new plant from a FBX file containig the Mesh information needed.

Group:
{
	Name:"Asset"

The first Group, named Asset in this case, define the mesh nodes and his adiditonal render node.

Mesh:
{
	Name:"LOD0"
	ModeRGBA:"WindAO"
	Index:""
	Position:""
	Normal:""
	UV:""
	ColorOpacity:""

	FBX/Mesh:
	{
		Name:"LOD0"
		File:"Mesh.fbx"
	}
}

This is the first LOD named LOD0, of the two existent in this case, used for close views of the plant.
The ModelRGBA property it’s set to ‘WindAO’ that means the ColorOpacity channel it’s used for the Wind (x,y,z) and for the ambient oclusion (w)
Other options here are ColorNone, ColorMask, ColorAO, ColorVSplit, WindNone, WindMask or WindVSplit

The FBX/Mesh node defines the name of the mesh extracted from the FBX file, in this case LOD0

Mesh:
{
	Name:"LOD1"
	ModeRGBA:"WindAO"
	Index:""
	Position:""
	UV:""
	ColorOpacity:""

	FBX/Mesh:
	{
		Name:"LOD1"
		File:"Mesh.fbx"
	}
}

In this example there is another mesh LOD1 used to show the plant from further distances.

Render/Full:
{
	Name:"Material"
	MaskLimit:"0.5,0"
	Color:"1,1,1"
	Gloss:"1,0"
	NormalScale:"1"
	NormalGlossTexture:"./N"
	Scattering:"0.5,1,0.5,1"
	ScatteringColor:"1,1,0.5"

	Texture2/File:
	{
		Name:"C"
		PixelFormat:"SRGBA8"
		Filter:"BilinearMipmap"
		Usage:"Color"
		File:"C.tga"
	}

	Texture2/File:
	{
		Name:"N"
		PixelFormat:"RGBA8"
		Filter:"BilinearMipmap"
		Usage:"Normal"
		File:"N.tga"
	}

	Texture2/File:
	{
		Name:"T"
		PixelFormat:"R8"
		Filter:"BilinearMipmap"
		Usage:"Normal"
		File:"T.tga"
	}
}

This render node has the information settings for the view.

The MaskLimit it’s the minimun mask value, from which the object it’s fully transparent
The Color multiplies the object color to modify his apareance.
To affect the glossines of the object (How polished is it) we use the Gloss property taht determines the concentration of especular highlights.
NormalScale it’s the scale factor of the object.
Scattering How much ligth gets inside the object (x), How much light reach the back face (y), Tangent biasd (z) and scatterdisk (w).

Texture C used for the colors, N for the normals and T for translucency.

Texture2/File:
{
	Name:"Distribution"
	PixelFormat:"R8"
	Usage:"Color"
	File:"Distribution.tga"
}

This texture determines the distribution of the plant around our world map, where you choose to start the game.
Determines zones where the seeds are planted and zones where not.

Entity/Vegetal/Plant:
{
	Name:"Entity"
	State:"Enabled"
	CountLimit:"16384"
	LocationMedium: "Land"
	LocationDeep:"0,0.1"
	LocationSlope:"0"
	RotationRandom:"0,0"
	ScaleMode:"Elevation"
	Height:"1.106"
	SeedMonth:"March"
	AgeStage:"0,2,5"
	AgeMultiplier:"1"
	Age:"5"
	SeedProbability:"0.95"
	SeedRadius:"1,20"
	HistoryRangeYear:"-10000,2000"
	Density:"8000"
	HeightRange:"9996.5,10000,12000,14000"
	StorageElevation:"0"
	Storage:"1"
	StorageCount:"0"
	ProductionDuration:"0"
	Gather:"1"
	ConstitutionResource:"'~/Entity/Local/Resource/List/Reed/Entity'"
	ConstitutionCount:"0.5"
	Constitution:"2"
	Crop:"1"
}

In the entity structure we define a lot of things that models the existence of our plant.

CountLimit defines the maximum amount of seeds scattered around the world.
LocationMedium defines where this plant can survive Land, Amphibious, Water, WaterSurface, WaterFloor, Air.
LocationDeep it’s the allowed deep range from minimum (x), to maximum (y).
The LocationSlope it’s the max allowed slope or height difference.
The base height for this entity it’s defined in the Height property.
SeedMonth determines the germination month of the plant.
AgeStage defines the age stages beginning in absolute values: young (x), adult (y), Old (z).
We declare how many logic years for game year in AgeMultiplier.
The life expectancy in years it’s defined in Age.
SeedProbability accounts for the seed germination probability.
The minimum (x) and maximum (y) distance from parent goes to SeedRadius.
SeedLight defines the light requirements for seeds: Any, Light, Shadow.
HystoryRangeYear defines the starting (x) and ending year (y) of this kind of plant.
The maximum absolute density for km2 it’s stored in Density.
The Storage, Gather and Crop properties enables the object as a task target.

Instancer/Entity:
{
	Name:"Instancer"
	LODData:"20,7"
	LODTransition:"0.25"
	LODSize:"4"

The instancer node has the information to display the object in the game scene.

The LODData defines when to use the LODs, the value it’s a percentage of the screen filled by the object.
The dithering transition value in percentage of screen projection goes to LODTransition
While the LODSize it’s the measure used to calculate the screen projection size.

Tx/Render:
{
	Name:"LOD0"
	ZLayer:"2000"
	Mesh:"../../Asset/LOD0"
	Render:"../../Asset/Material"
	Shadow:"true,true,false"
	Color:"1,1,1"
	ColorMaskTexture:"../../Asset/Material/C"
	ThicknessTexture:"../../Asset/Material/T"
	Heightmap:"~/Entity/Local/Entity/Terrain/Heightmap"
	HeightmapBlend:"0.01"
	Wind:"~/Entity/Local/Weather/Wind/Wind/Wind"
	WindFactor:"0.5,0.5,0.25,3"
	Modifier:"'~/Entity/Local/Environment/Foliage'"
	Instancer:"../"
	InstancerTypeCount:"1"
}

Here we have the render node(s) with his particular info.

Zlayer it’s the layer rendering order, lower values rendered first.
If this object can act as light occluder, casting shadows (x), this object receive shadows from shadows occluders (y) or forces back faces when rendering shadows (z) we update Shadow accordingly.
We can reference the Z Heightmap only, mapped in world coordinates for mesh terrain adaption
The InstancerLOD can be used to filter which LOD use this data.

Group:
{
	Name:"Localization"

	String/Localization:
	{
		Name:"Description"
	}

	String/Localization/Vector:
	{
		Name:"Noun"
	}
}

Finally we have the localization part of the entity for multilingual support.

This isn’t an exhaustive property depiction, but the generally used for vegetables.

Nettle.zip (496.4 KB)

2 Likes