meta data for this page
  •  

This is an old revision of the document!


Vertex Packing

In export formats that support it (currently only STSDK, used with the SpeedTree SDK), vertex packing lets you have complete control over the data stored in each vertex in the exported file, which allows the file data to be loaded directly into render buffers at runtime.

An XML file describes the vertex attribute setup, while a small script written in the Lua language allows you full control over packing data into each vertex however you wish.

Description XML

You define a vertex packer by placing an XML file describing it in the <app install>/vertex_packing directory. An example for the standard packer used with the SpeedTree SDK is shown below.

<?xml version="1.0" encoding="UTF-8"?>
<SpeedTreeVertexPacker
		Program="Standard.lua"
		Force32bitIndices="false"
	>
	<Stream Name="Main">
		<Attribute Type="half" Count="4" Description="position(3) / texcoord_u(1)" />
		<Attribute Type="half" Count="4" Description="lod_position(3) / texcoord_v(1)" />
		<Attribute Type="ubyte" Count="4" Normalize="false" Description="normal(1) / binormal(1) / tangent(1) / wind_branch_dir(1)" />
		<Attribute Type="ubyte" Count="4" Normalize="true" Description="wind_weight(1) / wind_ripple(1) / wind_branch_offset(1) / ao_blend_and_2sided_packed(1)" />
	</Stream>
</SpeedTreeVertexPacker>

Packing Script