UPDATE: TexturePacker 3.0.6 comes with a separate Shiva 3D output format. I updated the post to reflect these changes as well as some other workflow optimizations.
My first product got published on the ShiVa Asset Store: an extension to support the awesome program TexturePacker by Andreas Löw. If you don’t know of it yet, check it out at http://www.codeandweb.com/texturepacker. Here is a screen shot of the supplied demo, showing off all the supported features:
Features
- No need to build your atlas by hand, TexturePacker does the work for you
- Texturize Models
- Texturize HUD Components
Usage
- Create your atlas with TexturePacker:
- Data Format is “Shiva3D“.
- Texture Format is TGA.
- “Allow Rotation” is only supported for texturing Models. HUDs are not supported!
- Trim Mode is “None“.
- Press the “Publish” Button. This will create 2 files: an XML and a PNG.
- Import the XML and the PNG via the Data Explorer into Shiva and add them as Resources to your game:
- Workflow Optimization: if you want to skip the importing, configure your output paths to the shiva resources folder directly! I only tested this once the resources was already created though.
- Workflow Optimization: if you want to skip the importing, configure your output paths to the shiva resources folder directly! I only tested this once the resources was already created though.
- If texturing a Model, create a Material with the same name as the texture, configure it such that it uses the texture and also add it to the Resources of your game.
You are now ready to use the atlas!
Here is some example code:
local hUser = application.getCurrentUser ( ) application.setCurrentUserScene ( "TexturePacker" ) --Load atlas data: --Use sendEventImmediate! user.sendEventImmediate ( hUser, "TexturePacker", "onLoadAtlas", "atlasTexturePacker" ) --user.sendEventImmediate ( hUser, "TexturePacker", "onLoadAtlas", "otherAtlas" ) --Texturize Model via code: user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj8" ), "tp05" ) user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj1" ), "tp01" ) user.sendEventImmediate ( hUser, "TexturePacker", "onSetObjectTexture", application.getCurrentUserSceneTaggedObject ( "obj2" ), "tp02" ) --Or use Object AI "TexturePackerAI" (done for obj3 and obj4) |
Best you take a look at the supplied TexturePackerDemo.
Set your viewport to Android Landscape (800×480) for best results.
Here’s a snapshot of a little game I’m currently working on, utilizing the TexturePacker extension (every texture is coming out of an atlas):
Feedback is welcome!
And once again, the link to the ShiVa Asset Store: http://www.shivaengine.com/store/aimodels/132-texturepacker-ai.html.


