Difference between revisions of "Modelling/Blender"

From UFO:AI
(MD2 Scripts)
Line 1: Line 1:
[http://www.blender.org/ 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.
+
{{http|www.blender.org/|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==
 
==General==
 
=== MD2 Scripts ===
 
=== 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 [[Getting the source|repository]]:
+
An updated import/export script is available at the blender-tools in our [[Getting the source|repository]]:
  
 
* {{repositorydir|src/tools/blender|src/tools/blender}}
 
* {{repositorydir|src/tools/blender|src/tools/blender}}
** {{path|md2_export.py}}
+
** {{path|io_mesh_md2.py}}
** {{path|md2_import.py}}
 
 
 
'''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.''' --[[User:Hoehrer|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 [[User:Wrwrwr|Wrwrwr]] 01:07, 11 December 2007 (CET)
 
  
 
=== MD2-TAG Script ===
 
=== MD2-TAG Script ===
I ([[User:Hoehrer|Hoehrer]]) created an ex- and import script for [[Modelling/Tags|tag]] files as used by our [[MD2]] models. It's located next to the  look at the blender-tools in our [[Getting the source|repository]]:
+
An updated import/export script for [[Modelling/Tags|tag]] files as used by our [[MD2]] models is available at the blender-tools in our [[Getting the source|repository]]:
  
 
* {{repositorydir|src/tools/blender|src/tools/blender}}
 
* {{repositorydir|src/tools/blender|src/tools/blender}}
** {{path|md2tag_export.py}}
+
** {{path|io_scene_tag.py}}
 
 
The script is '''not tested''' in real-action yet, so every feedback how good it works is useful.
 
  
 
== Export MD2 from Blender ==
 
== Export MD2 from Blender ==
Line 25: Line 18:
  
 
In Blender to export the model you need to
 
In Blender to export the model you need to
* Apply the texture:
+
* The model must be unwrapped.
** Enter UV-mode (in ''3D View'').
+
* 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 into the absolute center (unless you know what you are doing)
** Select all faces {{K|A}}
+
* Then you should be able to export it with the md2-export menu entry.
** 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 [[#Scaling|below]]) or rotated the object you want to export you need to apply these changes: {{CK|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 {{SK|C}}) and then hit the ''Centre Cursor'' button in the {{K|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 {{path|md2.pl}} anyway.
 
  
  
Line 39: Line 26:
 
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 ({{CK|A}}).
 
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 ({{CK|A}}).
  
See the {{svn|trunk/base/models/aliens/bloodspider/bloodspider.blend|bloodspider}} (1x1) and the {{svn|trunk/base/models/aliens/hovernet/hovernet.blend|hovernet}} (2x2) models for reference. They also include blender-scaled reference boxes (1x1x2.45 blender units) that equals the cursor in geoscape.
+
See the {{http|ufoai.org/datasource/models/aliens/bloodspider.blend|bloodspider}} (1x1) and the {{http|ufoai.org/datasource/models/aliens/hovernet.blend|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 [[Mapping|UFORadiant]] grid settings.
 
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 [[Mapping|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 ===
 
=== Create Animations ===
Line 62: Line 45:
  
 
== Create screenshots of models with UFOAI frame ==
 
== 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.
+
To make creation of screenshots from 3d models with the green UFO:AI background&frame easier (see the [[Screenshots]] section) a template for [[Blender]] with this background pre-set is available.
  
Just open up the {{path|presentation.blend}} file located in {{svn|trunk/base/models/presentation.blend|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 {{K|F12}} to render and {{K|F3}} to save the file.
+
Just open up the {{path|presentation.blend}} file located in {{http|ufoai.org/datasource/models/aliens/presentation.blend|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 {{K|F12}} to render and {{K|F3}} to save the file.
  
  
 
: [1] Either ''File''->''Import'' an [[MD2]] or ''File''->''Append'' from a {{path|.blend}} file.
 
: [1] Either ''File''->''Import'' an [[MD2]] or ''File''->''Append'' from a {{path|.blend}} file.
 
: [2] There is a readme text inside the .blend file.
 
: [2] There is a readme text inside the .blend file.
 
== General Blender Tutorials ==
 
* [http://walkercreations.org/blender.html Video tutorials]
 
  
 
==Links==
 
==Links==
* [http://www.blender.org Blender Homepage]
+
* {{http|www.blender.org|Blender Homepage}}
* [http://wiki.blender.org/index.php/BSoD/Introduction_to_Character_Animation Introduction to Character Animation]
+
* {{http|wiki.blender.org/index.php/BSoD/Introduction_to_Character_Animation|Introduction to Character Animation}}
* [http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Advanced_Tutorials/Advanced_Animation/Guided_tour/NLA/intro Advanced Animation]
+
* {{http|en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Advanced_Tutorials/Advanced_Animation/Guided_tour/NLA/intro|Advanced Animation}}
* [http://mediawiki.blender.org Blender wiki]
+
* {{http|blenderartists.org|BlenderArtists}} + {{http|blenderartists.org/forum|forum}}
* [http://blenderartists.org BlenderArtists] + [http://blenderartists.org/forum forum]
+
* {{http|www.blendernation.com/|BlenderNation (Blender news)}}
* [http://www.blendernation.com/ BlenderNation (Blender news)]
+
* {{http|de.wikibooks.org/wiki/Blender_Dokumentation|German Blender Documentation}}
* [http://undone.clanlib.org/~grumbel/mediarepo/show.cgi?search=blend GameMedia Repository]
+
* {{http|en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro|Blender Online Book - Noob to Pro}}
* [http://de.wikibooks.org/wiki/Blender_Dokumentation German Blender Documentation]
+
* {{http|www.katsbits.com/htm/tutorials.htm|Tutorials (not only blender)}}
* [http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro Blender Online Book - Noob to Pro]
+
* {{http|www.katsbits.com/htm/tutorials/blender_export_model_to_map.htm|Mapping with Blender}}
* [http://www.katsbits.com/htm/tutorials.htm Tutorials (not only blender)]
 
* [http://www.katsbits.com/htm/tutorials/blender_export_model_to_map.htm Mapping with Blender]
 
  
 
[[Category:Contribute]]
 
[[Category:Contribute]]
 
[[Category:Modelling]]
 
[[Category:Modelling]]

Revision as of 20:22, 1 June 2013

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

An updated import/export script is available at the blender-tools in our repository:

MD2-TAG Script

An updated import/export script for tag files as used by our MD2 models is available at the blender-tools in our repository:

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

  • The model must be unwrapped.
  • 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 into the absolute center (unless you know what you are doing)
  • Then you should be able to export it with the md2-export menu entry.


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.


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) a template for Blender with this background pre-set is available.

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.

Links