Sprite Source Region and Render Geometry

Choose your OS:

Each sprite is roughly defined as a rectangle from a texture, which can be edited interactively using the Edit Source Region mode in the sprite editor, or typed in manually in the details panel (Source Dimension and Source UV, both in pixels). The actual rendered geometry can be further adjusted in the Edit RenderGeom mode, and the collision shape can be adjusted in the Edit Collision mode.

Edit RenderGeom can also be useful to optimize transparent or masked sprites, trading off some extra triangles in exchange for reduced overdraw in transparent regions of the texture. The settings and tools are exactly the same as editing custom collision geometry. Be sure to use the Snap to Pixel Grid tool after editing custom geometry (this will happen automatically in a future release, but is a manual process for now).

Defining the Source Region

The Source Region of a Sprite defines the area of the source Texture that is used to render the Sprite. It can be edited interactively using the Edit Source Region mode in the Sprite Editor or set manually in the Details panel using the Source Dimension and Source UV properties.

The Edit Source Region mode displays the current bounding rectangle of the Sprite's source region with handles at each corner and at the center of each side. Each handle can be selected and dragged using the transform gizmo.

New sprites can be created in this mode by Ctrl+Dragging around a region of the source texture, or by double-clicking on a region of the texture (which will find all connected pixels and create a new sprite from the bounds).

Other sprites that share the same source texture will be drawn with a subdued border, and clicking on one of them will change the current sprite being edited.

edit_source_region.png

Modifying Render Geometry

The actual rendered geometry that the image from the Source Region is mapped to defaults to a quad matching the bounds of the Source Region; however, it can be adjusted using the Edit RenderGeom mode in the Sprite Editor.

The Edit RenderGeom mode displays the current render geometry of the Sprite with handles at each corner. Each handle can be selected and dragged using the transform gizmo to modify the render geometry, enabling you to more closely match the shape of the opaque pixels of the Sprite.

edit_render_geom.png

The more closely the render geometry matches the opaque pixels of the Sprite, the less potential there is for overdraw of transparent pixels which can be a serious performance drain.