Saturday, 7 February 2015

Sprite Slicer

Sprite Slicer is a tool that significantly speeds up the creation of image planes or sprites in Maya. It automatically generates the planes in the correct aspect ratio with perfectly aligned UVs. The smart algorithm in Bounds mode recognizes all separate shapes and creates sprites for them. Additional settings allow you to fine tweak the shape recognition.

The tool is also great for importing of reference images or any textured planes that will be used for modeling, for example hair strands, grass, leaves...

 To download the tool visit this link: Sprite Slicer
Feel free to donate to support further development of the tool. The next steps are to optimize the shape recognition speed and convex hull creation.

After you download it copy this code to your script editor or shelf to get the UI started:

import ah_spriteSlicer
slicer = ah_spriteSlicer.slicer() 

Watch the video to see how the tool works and to see different import modes in action:

The dragon character is from Bubble Rumble, download it for IOS and Andorid.

If the video is not enough here is a reference for all of the tools options:

 Name: Specify the name that all the sprites will be named to. They will automatically be numbered. If no name is specified, "sprite" will be added as the default name.

Sprite Sheet: URL for the image to be loaded. It can be entered by hand or if you click the folder icon a dialog will open that will allow you to specify an image on your system.

Pivot Location: Specify the region of the sprites that their pivot will be snapped to. The pivot can later be edited by Maya's standard tools or by going into the top menu of Sprite Slicer and selecting an option from Geo/Set Pivot.

Pixels Per Unit: This value specifies how many pixels are going to be created per one Maya unit. In other words it specifies the scale of the image planes. The larger the value the smaller the planes will be, and vice versa.

Subdivisions: The created planes will be subdivided in width and height by the amount specified in these two boxes.

Bounds: In this mode the sprites will be created for all separate shapes in the image. These shapes can later be combined with Maya's modeling tools or by selecting them and clicking on Geo/Combine option in Sprite Slicer's top menu.

Min Pixels: Minimum number of pixels that every separate shapes need to have in order to be considered a separate sprite. Tweak this amount if your sheet contains stray pixels or very small shapes that are part of a larger shape.

Min Opacity: Specify a value between 0.0 and 1.0 and the pixels that have an alpha value lower than the specified value will be ignored when searching for separate shapes.

Diagonal Check: When importing very small sprites, like pixel art, this option allows you to specify if you want to consider pixels that are connected only by their corners as part of the same shape. Keep this option unchecked if importing larger images since it will unnecessarily slow things down.

Grid: In this mode the sprites will be created based on the sprite size that is specified in the fields bellow.

Sprite Size: The size of the sprites by which the sheet will be divided. These values are in pixels. The tool will start to fit as many sprites as it can, starting from the top left corner.

Offset: Starting from the top left corner of the image the amount specified here will offset the sprites. These values are in pixels.

Padding: These values separate the sprites from each other by the amounts specified. These values are in pixels.

Ratio: In this mode the image is cut into a grid based on the ratio specified in the fields below.

Divisions: The ratio that the image will be cut in. The X amount is the number of sprites columns in the grid and the Y amount is the number of rows in the grid.

Offset: Similar to the offset in Grid mode, only in this mode you have the option to offset from all four sides of the image.These values are in pixels.

Padding: These values separate the sprites from each other by the amounts specified. These values are in pixels.

Load: Import the selected image with the specified options.

Cancel: Discard the specified options and close the Sprite Slicer window.

Edit: The Reset Settings option is in this menu. It resets all the values to their defaults

    Combine: Combine the selected planes. You need to have at least two meshes selected.
    Set Pivot: Sets the pivot of the selected objects to the specified corner.

Help: A link that opens in your browser and it brings you to this page.

1 comment :