From BlenderWiki

Jump to: navigation, search

Main Section for Scripts

There are two main sets of documentation of the Blender scripts:

Search the Catalog to find and download the script you need.


Some Modeling Script Samples:

Poly Reducer

Mode: Edit mode (meshes only)

Menu: Mesh » Scripts » Poly Reducer

Description

This tool can be used instead of Blenders Decimate modifier as a way to remove polygons from a mesh while keeping the original shape as much as possible.

Reasons you may want to use a polygon reducer are:

  • To make 3D Scanned data usable when rendering and editing.
  • Generate Level Of Detail models (LOD’s), for games or simulation models.
  • To speed up render times.


Options

Poly Reducer is accessed from Edit mode and will operate on the entire mesh.

On activation a popup will appear with the following options:

Poly Reduce
Scale the mesh’s poly count by this value.
Boundary Weight
Weight boundary vertices by this scale. Zero disables boundary weighting. A boundary vertex is a vertex that is not completely surrounded by faces. Some meshes have no boundary vertices. For example, a cube has no boundary vertices whereas a plane has only boundary vertices.
Area Weight
Collapse edges affecting lower area faces first. Zero disables area weighting.
Triangulate
Convert quads to tris before reduction, for more choices of edges to collapse.
The advantage of triangulating is you have a larger set of edges to choose from when collapsing giving a higher quality result.
UV Coords
Interpolate UV coordinates (if any UV map).
Vert Colors
Interpolate vertex colors (if any color map).
Vert Weights
Interpolate vertex weights (if any vertex group).


Hints

Poly Reducer has some advantages and disadvantages compared to Blender’s Decimate modifier, here are some pros and cons. Pros

  • Higher quality resulting mesh.
  • Can operate on any mesh, will not throw errors if the mesh has odd face/edge/vertex topology.
  • Options to control where polygons are removed.
  • Keeps materials assigned to faces.
  • Maintains UV texture coordinates, vertex colors, and vertex group weights (used for bone weight painting) – this makes it very useful for game/realtime models.

Cons

  • Fairly Slow.
  • Uses a lot of memory.


Examples

Famous cow.
Human with UV textures and bone weights from www.x-trusion.com.
Heavily reduced workman www.x-trusion.com.
Example of an 80% Reduction using a weight map for influencing the result. Original, Weight Map, Result of the reduction.


Auto Image Layout

Mode: All modes (meshes only)

Menu: UV/Image Editor » UVs » Auto Image Layout

Description

This script makes a new image from the used areas of all the images mapped to the selected mesh objects.

Images are packed into 1 new image that is assigned to the original faces.

This is useful for game models where 1 image is faster than many, and saves the labor of manual texture layout in an image editor.

Options

This script is accessed from UV/Face mode and packs images from the active mesh.

On activation a pop-up will appear with the following options:

Image path
No ext!
A new PNG image file will be created at this path. Use // as a prefix for the current blend file location. Otherwise you may specify the full path. Do not append any file extension.
Pixel Size
The size of the image, this value is used for width and height to make a square image.
Pixel Margin
When cropping the image to the bounds of the used areas add this pixel margin, this stops lower resolution textures (mipmaps) from bleeding the edge color into the faces that use this texture.
Keep Image Aspect
If this is turned off, the tiles will stretch to the bounds of the image, making the images look stretched in an image viewer. However it will give better results when viewed in 3d because there is more pixel information in the image.
Texture Source, All Sel Objects
When enabled all selected objects will have their textures packed into the texture.


Examples

Here is a test case where I took 5 unedited photos, mapped them to a low poly mesh, and pack them into 1 texture.

Projection mapped uv mesh.
Model in details.
Texture view.
Back wall with generic texture.
Finished Details with roof and side walls.
All images used for this mesh.
Result of running the Auto Texture Layout Script.


Weight Painting

Bone Weight Copy

Mode: Object mode (meshes only)

Menu: Object » Scripts » Bone Weight Copy

Description

This copies weights from one mesh to another based on vertex locations. It can also be used to update a mesh that’s already weighted, by selecting the vertices on the target mesh, and then using the Copy To Selected option.

Mirror Vertex Locations & Weight

Mode: Edit mode (meshes only)

Menu: Mesh » Scripts » Mirror Vertex Locations & Weight

Description

This script is used to mirror vertex locations and weights. It is useful if you have a model that was made symmetrical but has vertices that have moved from their mirrored locations slightly, causing Blender’s X-Mirror options not to work.

Weights can be mirrored too, this is useful if you want to model one side of a mesh, copy the mesh and flip it. You can then use this script to mirror to the copy, even creating new flipped vertex groups, renaming group name .left to .right or .L to .R.

Vertex positions are mirrored by doing a locational lookup, finding matching vertices on both sides of a mesh and moving to the left/right or mid location.

The vertex weights work differently, they are mirrored by location also, but they don’t mirror in pairs, rather it works by finding the closest vertex on the flip side and using its weight.

When a location mirror is finished, vertices that have not been mirrored will remain selected. A good way to check both sides are mirrored is to select the mirrored parts, run this script with default options and then see if there are any selected remaining vertices.

For details on each option read the tooltips (!).

Weight Paint Gradient

Mode: Weight Paint mode (meshes only)

Menu: Paint » Weight Gradient

Description

Mix weight paint and face select mode so as to select the faces to gradient. Then run Weight Gradient from the Paint menu, and click on the two locations to blend between. The existing weight under the mouse is used for to/from weights.

Vertex Color Gradient

Mode: Vertex Paint mode (meshes only)

Menu: Paint » VCol Gradient

Description

See Weight Paint Gradient above…

Examples

Example of gradient usage.


Self Shadow

Mode: Vertex Paint mode (meshes only)

Menu: Paint » Self Shadow VCols (AO)

Description

Uses the mesh geometry to shade the mesh, similar to ambient occlusion.

Examples

Elephant Shaded.