Modelling/Blender

From UFO:AI
< Modelling
Revision as of 09:14, 12 December 2010 by Bayo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Blender is a free open source 3D content creation suite, available for all major operating systems under the GNU General Public License. You can download it for free with no limitations.

General

MD2 Scripts

Blender comes with (mostly) working ex- and importers for MD2. But if you have troubles (especially exporting) you should have a look at the blender-tools in our repository:

The only working ex- and importers that currently exist are the ones included in the Blender release (2.43-RC1) - I also commited them to our repository, see above. --Hoehrer 15:38, 8 January 2007 (CET)

Note: md2_export.py coming with blender 2.44 or 2.45 (file version 243) seems to work provided that you change stip to strip on line 957 Wrwrwr 01:07, 11 December 2007 (CET)

MD2-TAG Script

I (Hoehrer) created an ex- and import script for tag files as used by our MD2 models. It's located next to the look at the blender-tools in our repository:

The script is not tested in real-action yet, so every feedback how good it works is useful.

Export MD2 from Blender

There are some things you need to consider when exporting a model to MD2 from blender:

In Blender to export the model you need to

  • Apply the texture:
    • Enter UV-mode (in 3D View).
    • Select all faces A
    • Go to the UV/Image Editor view (not the Material buttons)
    • Load the texture image (Image -> Open). It doesn't really matter with file you choose, but if you want to check the uv-layout it's good to use the correct file. It is only needed so the export script doesn't give an whatwasit? error.
  • You can test if this worked by switching to Draw type = textured in 3D View. Now the model should be displayed with the texture.
  • If you have scaled (see below) or rotated the object you want to export you need to apply these changes: Ctrl A -> Apply scale and rotation
  • If the center of your object (small violet circle) isn't located exactly in the absolute center (coord-grid center) you need to re-place it by first placing the 3D-cursor into the absolute center (Recenter view and cursor with Shift C) and then hit the Centre Cursor button in the F9 Mesh panel.
  • Then you should be able to export it with the md2-export menu entry. You can ignore the message about missing texture path (the second path in the export dialog), this needs to be fixed with md2.pl anyway.


Scaling

If you use one a scale where one blender unit equals one unit in the battlescape you need to scale up the model x16 before export. Don't forget to apply the transformation (Ctrl A).

See the bloodspider (1x1) and the hovernet (2x2) models for reference. They also include blender-scaled reference boxes (1x1x2.45 blender units) that equals the cursor in geoscape.

You should configure Blender to use a grid setting of 6.4 (or multiples of this) - this will ensure, that the model will be aligned to the UFORadiant grid settings.

Huge File size

As default the Blender MD2 export script exports 198 frames (defined in the 'default' frame-list on export). So the .md2 files are quite big. This models work the same as correct exports though.

However, to export only one frame, you can use a frame list file as export_1_md2_frame.cfg in src/tools/blender/ (see readme.txt in the same directory). Just enter the name of this file in the 'Frame List file to load' field in blender when exporting.

Create Animations

TODO: WRITEME

Rough basics: No matter how you animate the model. As long as you export is as a MD2 file you are limited by the specification of the model-type. Mainly the so-called key-framed animations of the MD2 format are of interest to us. Basically the format stores a list of vertices (with UV-data) and a list of animation frames. Each frame can have other positions of the vertices.

If you create a bone-based (or shape-key) animation of your model, export it to MD2 and import that in Blender again you'll loose all original information about bones and similar stuff .. they are transformed to key-frames on export. There still are animations there, but they are not as easily modified. This is also true for other modelling programs.

So never ever loose your original file if you don't want to re-create a lot of animation-work.

Placement of weapons, floor, heads, etc. ... for MD2 files (which do not have this integrated into the format) is handled via the tag files.

Note: Some already animated MD2 files (nearly every file created by Herby of the original dev-team) do not have existing source files (max files) any more ... it would be great if s/b would re-animate them in Blender so we can modify them more easily.

Create screenshots of models with UFOAI frame

To make creation of screenshots from 3d models with the green UFO:AI background&frame easier (see the Screenshots section) I've created a template for Blender with this background pre-set.

Just open up the presentation.blend file located in models/presentation.blend and import/load [1] the wanted file. Make sure the model(s) is (are) nicely rotated and that the texture shows up in blender [2], press F12 to render and F3 to save the file.


[1] Either File->Import an MD2 or File->Append from a .blend file.
[2] There is a readme text inside the .blend file.

General Blender Tutorials

Links