A combination of scripts for Blender and Meta Spark AR to play back arbitrarily deformed geometry in Spark without using bones. It is super performant and flexible.
Blender 4.x Version here
download and unzip (or git clone
) the repo.
Edit > Preferences... > Add-Ons > Install...
Select vertex_animation.py
enable Spark AR VAT: Vertex Animation
Select the animated Object
Open the Spark AR VAT Tab
select frame range and output directory
click 'Process Anim Meshes'
observe the changed 'Scale Factor' in the UI...
observe the changed 'Chunks' in the UI...
Enable Vertex Texture Fetch in Project > Edirt Properties... > Capabilities > + > Vertex Texture Fetch
Drag and drop SparkVAT.sca into your project
Drag and drop everything from the output directory above into your project
set compression to 'none' for all imported textures
set Sampling/Filtering to 'none' for all imported textures
make a new material with the shader and populate the outputs
assign it to the exported mesh from the output directory
enter the Scale Factor from the Blender UI in the appropriate field
enter the Chunks from the Blender UI in the appropriate field
Because of Texture Size limits in Spark, the maximum framerange of the animation depends on the mesh resolution. Many animations don't need many frames, while most models have a few thousand vertices. An average walk cycle for a character is only about 30 frames.
Vertices | Max Frames | Seconds @25fps |
---|---|---|
<1024 | 1024 | 40 |
<2048 | 512 | 20 |
<3072 | 340 | 13 |
<4096 | 256 | 10 |
<5120 | 204 | 8 |
<6144 | 170 | 6 |
<7168 | 146 | 5 |
<8192 | 128 | 4 |
... | ... | ... |
<16384 | 64 | 2,56 |
<32768 | 32 | 1,28 |
Vertex Order can't change between frames, which means that the mesh has to stay consistent between frames
Using ImageOptim you can further compress the generated textures about 27,5 % per file on average (up to 49,8 %). (Important to keep Quality at 100%)
You can play with manually setting texture compression in Spark AR to uncompressed GPU format such as PVRTC (iOS) / ETC2 (android) - observe if it saves data and doesn't degrade quality.
- Mate Steinforth
- Adapted for Spark from the Blender scripts created by Joshua Bogart
- Adapted for Blender from 3ds Max scripts created by Jonathan Lindquist at Epic Games.
- Triceratops model licenced under CC0 Public Domain by The Smithsonian Institute
If you're interested in the internals of the workflow, check Texture Animation: Applying Morphing and Vertex Animation Techniques