Latest Posts

Changes in BlenderPerspective

Revision Differences of Revision 11

Currently under revision ¶

## Introduction ¶

The purpose of this page is to collaborate on making a single camera and lighting setup to use with Blender for generating 2D images of buildings and bobs with common perspective and shading. ¶

### Media repository ¶

Our models and animations for widelands can be found in our media repository, which has a separate project on launchpad, at ¶

<https://code.launchpad.net/widelands-media> ¶

See BzrPrimer to learn how to download and collaborate. ¶

You can use these files as an example, and/or style guide. ¶

Also, for rendering all directions and creating the playercolor masks we have a python script (should be up to date for blender 2.7), for consistency's sake we recommend using our templates which can be found at "`graphics\stock_sources\blender_set_templates\empty_building_template.blend`" and "`empty_worker_template.blend`". If you want to work them into a model created previously, the scripts from "`graphics\tools`": "`innerBuilding.py`" or "`innerWorker.py`" are the files to actually include. (There might be some bug in the already inserted script in the blender files. In which case you should copy/paste the working script
infrom the previously mentionned locations.) ¶

## HOWTO make a graphic with blender ¶

### Working these scripts ¶

For these scripts to work, there are two things you need in the model: ¶

* All lighting and the camera should be a child of an object named "!MainLightControl", so the script can rotate them around (this should already be taken care of if you use one of the templates). ¶
* The parts of your model you want to be player colored in the game should either be in a mesh group "!PlayerColor", or have a material named "!PlayerColor" (Take care to only have one material of this name and use it in all the necessary places). ¶

After this open up a text display in blender with the relevant "inner" script, move the mouse over it, and press Alt-P. The rendering menu should appear: ¶

* the upper part of it is for rendering a series of pngs to be used in the game (take care to save your model before rendering with the !PlayerColors option, as that changes your mesh). ¶
* the lower part is for testing purposes, moving the camera to the cardinal directions that will be used at rendering. ¶

### Modeling ¶

Start with the above file or any attached blender file you find on the page. But make sure that the lighting (dropped shadow) matches approximately with Widelands. You can also import pre-made models into the base.blend file. Simply go to File->Append, browse to your file, append the scene you want. Switch to this new scene, select all the objects you want, press ctrl-L and select To Scene. Then remove the imported scene and you have your new objects in the first scene. ¶

Design your object around the center (0,0,0), after this, select camera, camera-target and move them along the z axis till your object is in the center of the camera. Render a big picture without shadow (disable the ground plate on layer 11), AO enabled and high sampling rate, and on KEY render type (not SKY). Make this pic around 640x480 pixels big and save it. If your object drops a shadow, enable (shadow only) on all your materials and turn off AO, render again with your ground plate enabled. Save this pic as "shadow" or something. It only contains your background color and black spots, where shadow is. ¶

When you resize, make sure you always turn interpolation off! ¶
In the Gimp (or any other Photoshop like tool), resize your picture to 24x24 for menu pictures (if it is a ware, you can get the queue_empty picture by overlaying a black layer with darken_only enabled). ¶
For the on-map pictures, resize to appropriate size, also resize the shadow pic, then copy the pic over the shadowpic - eh voila, you're done. ¶
Do this for every frame of your animations. ¶

This is just my idea, but I say using " [MIR dot net](http://www.multipleimageresizer.net/download.aspx) "(multiple image resizer) would seriously speed things up with animations. ¶