meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
vertexpacker [2021/03/15 12:47] – croft | vertexpacker [2023/04/03 18:40] (current) – steph.jorgensen | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Vertex | + | ====== Vertex |
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. | 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. | ||
Line 23: | Line 23: | ||
> | > | ||
< | < | ||
- | Type=[type of variable used for this attribute: byte, byte, short, | + | Type=[type of variable used for this attribute: byte, ubyte, short, |
Count=[integer for how many elements in this attribute, 1-4] | Count=[integer for how many elements in this attribute, 1-4] | ||
Normalize=[doesn' | Normalize=[doesn' | ||
Line 42: | Line 42: | ||
<?xml version=" | <?xml version=" | ||
< | < | ||
- | Program=" | + | |
- | Force32bitIndices=" | + | Force32bitIndices=" |
- | > | + | > |
- | <Stream Name=" | + | <Stream Name=" |
- | < | + | < |
- | < | + | |
- | < | + | < |
- | < | + | |
- | </ | + | < |
+ | | ||
+ | < | ||
+ | | ||
+ | </ | ||
</ | </ | ||
</ | </ | ||
- | + | ===== Packing | |
- | ===== Packing | + | |
During vertex packing, the packing script specified in the description XML file is run for each vertex. This script is written in Lua. While this documentation cannot cover every aspect of the Lua language, you can find additional info at [[http:// | During vertex packing, the packing script specified in the description XML file is run for each vertex. This script is written in Lua. While this documentation cannot cover every aspect of the Lua language, you can find additional info at [[http:// | ||
Line 93: | Line 96: | ||
| print|< | | print|< | ||
- | === Saving | + | === Saving |
To place any of the input vertex data into the final vertex attributes in the export file, you use the set_attribute function or the set_attribute_integer function (when strict adherence to integers is wanted). | To place any of the input vertex data into the final vertex attributes in the export file, you use the set_attribute function or the set_attribute_integer function (when strict adherence to integers is wanted). | ||
Line 100: | Line 103: | ||
- | === Batching | + | === Batching |
The geometry in the tree is as batched as much as possible, just like in other file formats. Without any further input, the tree will be batched into as few draw calls as it can, depending on the number of separate materials occur after atlassing. | The geometry in the tree is as batched as much as possible, just like in other file formats. Without any further input, the tree will be batched into as few draw calls as it can, depending on the number of separate materials occur after atlassing. | ||
Line 111: | Line 114: | ||
< | < | ||
+ | -- LUA BATCHING EXAMPLES | ||
+ | |||
-- batch by geometry type | -- batch by geometry type | ||
set_batch_type(in_geometry_type) | set_batch_type(in_geometry_type) | ||
-- batch by two-sided or not | -- batch by two-sided or not | ||
- | set_batch_type(in_two_sided and 1 or 0) | + | if in_two_sided then |
+ | | ||
+ | else | ||
+ | set_batch_type(0) | ||
+ | end | ||
-- batch by needing blending | -- batch by needing blending | ||
Line 125: | Line 134: | ||
set_batch_priority(0.0) | set_batch_priority(0.0) | ||
end | end | ||
+ | |||
+ | -- batch by geometry type AND two-sided | ||
+ | if in_two_sided then | ||
+ | set_batch_type(in_geometry_type + 5) | ||
+ | else | ||
+ | set_batch_type(in_geometry_type) | ||
+ | end | ||
+ | |||
</ | </ | ||