Talk:Using Blender

From Luanti Wiki
Revision as of 13:39, 18 April 2014 by Twoelk (talk | contribs) (saved for reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Original Import

This is my basic crib sheet for creating a mob in blender. could be used to relatively easily create any other mod. Feel free to update or correct any errors I've made I've done this with Blender 2.70 and Ubuntu 12.04, but instructions should also work for Blender 2.5 or 2.6 as menu structure was pretty similar (but possibly not 2.4 or prior) PS If anyone wants to create a sticky/tutorial out of this feel free. It was on the wiki, but got deleted, so I'll make any updates to this original post (https://forum.minetest.net/viewtopic.php?id=9068) Cheers David

Notes: I'm not sure what is the best 3D format, Directx and B3D allow animation (but my crib sheet doesn't cover that) On my system (Linux 12.04) Directx (.x) seems to be buggy in minetest and faces aren't always drawn properly. B3D seems to work better and was used in animals_modpack-2.3.6, so I copy that. I've attached the addon which seemed to be the best currently, but feel free to search out your own. To create a basic mob, copy an animal from animals_modpack-2.3.6. Then in the init.lua you only have to do a search and replace of the name of the animal, and delete any irrelevant code. You can edit speed, acceleration, etc as you wish.

If you want to be able to export in B3D (Blitz 3D) format (but you still can't import with it)

 Download the blender export script B3DExport.py
 In Linux: Copy to /home/user/.config/blender/2.70/scripts/addons
 In Windows: Copy to
 Open Blender
 Blender File/User Preferences/Addons/Import Export/B3D (Blitz 3D) Model Exporter - Select box on R
 If you want .x (directX) then find this and enable it too.
 While you're in preferences on the file tab you may want to enable Save&Load/Compress File (for much smaller saved files), and Autosave/Keep Session (to save on exit)
 Save User Settings
 Close Preferences Window


CREATE 3D OBJECT/MODEL

Don't bother with 'materials' - minetest doesn't seem to display them properly - you need a texture to define any colours. If you want your model to walk forwards, you must create it with 'forward' pointing in the +ve x direction (ie right when you select view point '7' on the numeric keypad, or facing in the direction of the red 'x' arrow when an object is selected)

CREATE OBJECT In 3D Viewport If not already switch to object mode (dropdown in 3D viewport) Add objects (eg 3D Menu/Add/Mesh/cube) Move around by right-clicking to select and dragging arrows. 'b' box/border select. 'g' grab to move. Resize or rotate using the properties viewport (has a row of camera, cube, spanner, etc at top)

 Select the cube
 Use rotation and scale to transform objects

[See the hundreds of blender tutorials for more advanced editing techniques.]

SAVE primary blender model

 Save as a blender file (Ctrl-S or File/Save)
 Save with the name: yourname.blend (or similar)
 You might also want to save a separate 'unjoined' copy before the following join operation, as you won't be able to access the base components afterward

TEXTURING: When basic model is completed you'll need to create a texture

Switch to Object mode

 press 'a' (perhaps twice) to select all objects
 Ctrl-J Join all objects in model together

Switch to Edit Mode

 Mesh/UV Unwrap/Smart UV Project [see one of the many UV Mapping tutorials if you want seams to match, etc]
   [optional] Set island margin to 0.004 (this leaves a gap between faces, so there will be less risk of bleeding of colour across sharp edges. 0.002 is approx 1 pixel for a 512 pixel image)

Move mouse to the top of the 3D window to get and up/down arrow. Right click/split window and size to 50:50. On the R hand new window select the litle cube (3D viewport) icon and switch to UV Map viewport LowMenubar:New

 Set Name - eg 'yourname UV Map'
 Click UV Test Grid (optional)
 OK (=Save)
 [if you want to resize the image use a power of 2 (512/1024/etc) for x and y dimensions as it significantly speeds processing]

LowMenubar:Image/Pack as PNG/Accept warning (this ensures you will save a copy of the image within the .blend file (I think in 2.4 this may have to be updated manually, but the tickbox in 2.7 implies is should be saved with the rest of the file)

Check UV map fits on image - adjust with: g - move, r - rotate, s - scale (menu:UV/transform/) The UV vertices won't always align to pixel boundaries, which means if you don't use 'island margin' above, then painting on one face may also unavoidable paint onto another face. There is reference in the manual to a UV snap-to-pixel option (to align UV vertices to pixel edges) but I haven't figured how to access it yet (and it would only perfectly stop bleed for horizontal or vertically aligned vertices).

In 3D View Window Switch to Texture Paint (from Edit Mode) in the Toolbar set:- Brush

 Select white (should be selected by default)
 Strength 1.0 (ie 100% replacement of the underlying colour)
 Radi 500 (or whatever brush radius you want)

Curve

 select the square profile if you want a solid colour brush
 select the 'normal distribution curve' if you want a fading brush
 (or any other profile you like)

UV Map Window Switch to Paint (from View) Paint entire object white (or some other basecoat). This is easiest to do in UV Map window

In 3D View Window To paint only particular faces, click the face Menu/faceselect (the cube with grid pattern on the face), you will then be able to select an entire face/s with R click (or shift R-click for multiple faces).

Change colour,strength,radius,curve, etc and paint the different parts as you wish - painting in either 3D or UV Mesh Windows. NB the colour picker has an eyedropper to copy the colour from within the 3D or UV Map windows - just click on the currently displayed colour (under the colour wheel) to bring it up.

SAVE YOUR WORK AND EXPORT FILES Save the mesh

 Export as a .b3d file (File/Export/B3D)
 Save with the name: models/animal_yourname.b3d
 Don't forget to look for and OK the overwrite message if needed or it will disappear and you won't have saved your file.

Save the texture

 UV Window/Image/Save As Image
 Save with the name: textures/animal_yourname_yourname_mesh.png

CREATE/COPY THE INVENTORY GRAPHIC Find/create a nice graphic to be the image in the inventory A flat texture can be created with a 6 sided cube model (eg animal_yourname_yourname.png) The inventory image is animal_yourname_yourname_item.png (remember to respect copyright - use screenshots of your model if you want a simple free graphic. To turn off the 3d viewport grid floor open the propertles menu (+ at top R of window), and untick display/grid floor)

RENDERING MODEL If you want to be able to render the model (F12 key) you'll first need to do the following steps to enable the texture: In 3D edit view. Add/Lamp/Hemi. You might need to move this around to adjust lighting direction, but probably not. In properties viewpane:- Select checkered box tab,

 change tex type to image/movie
 click on image dropdown below this and select your UV texture image
 under mapping dropdown change coord to UV

Now Render should work...

ANIMATION From the wiki:

   Make sure your mesh is child of Armature.
   Make sure there's only one bone parenting all others (having a child bone being parent of another one is no problem).
   All faces need to be members of a vertex group.
   Make sure all of your vertex groups have same name as at least one bone.
   Don't forget to export animation when exporting to .x file.