Mod / Mob creation in Blender - a quick-start guide/basic cr

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Mod / Mob creation in Blender - a quick-start guide/basic cr

by dgm5555 » Post

This has been updated on the wiki at: http://wiki.minetest.net/Using_Blender

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 (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 (use "save copy" to rename it without affecting the name of the file you are editing)

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.
Attachments

[The extension py has been deactivated and can no longer be displayed.]

Last edited by dgm5555 on Tue Jan 06, 2015 10:09, edited 2 times in total.

User avatar
lightonflux
Member
Posts: 384
Joined: Mon Nov 11, 2013 07:22
In-game: lof
Location: Germany

by lightonflux » Post

Why didn't you create the howto in the wiki?

User avatar
hoodedice
Member
Posts: 1372
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

lightonflux wrote:Why didn't you create the howto in the wiki?
I'll post it in the wiki.

Also, THANKS A LOT for the above! This will go a very, VERY long way in helping me work with blender. =D
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

This is incredibly helpful! I might tinker around with entities myself.
Back from the dead!

User avatar
philipbenr
Member
Posts: 1688
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

by philipbenr » Post

We might get some nice mods going. :D
“Would it save you a lot of time if I just gave up and went mad now?”

“I'd far rather be happy than right any day.”

“What, are you, crazy?" "It's a possibility I haven't ruled out yet"

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

TL;DR

Aren't the tools we've already got providing the same functions?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

by dgm5555 » Post

Krock, which tools do you use, and is there a good post comparing them? It would be great if you could provide a tutorial for using them, as I found virtually nothing for a minetest newbie. I chose Blender because I'm familiar with it and it's extremely versatile rather than because it's the perfect match for minetest. I originally used it creating models for 3D printing.
I know of VoxelShop, which seems a bit like a basic version of windows 'paint' in 3D (and I can't be bothered filling in all the blocks to create an object, so quickly dropped it for blender).
Gimp or Inkscape should be fine for creating a simple 6 face node texture, but not for 3d meshes.
Irrlicht provides the engine, but no tools for creation (that I found)
There were a few other tools mentioned in various posts which can apparently create 3D meshes, but I found were quite buggy on my Linux system, so I deleted them (sorry can't remember names).
Blender was the only one I found which is quick (once you figure out the workflow) and stable, and also provides good animation down the line.
I also just checked now and can't find any other tools listed on the Wiki where hoodedice copied this post (http://wiki.minetest.net/Tutorials#Beginners) (BTW Thanks hoodedice)

User avatar
hoodedice
Member
Posts: 1372
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

I did not modify anything yet =P

So no thanks to me. I will do it as soon as I finish other pressing stuff first.
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

Jordach
Member
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Just used b3d to replace the borked player model that is provided from Taoki's latest MTG pull...

Image
viewtopic.php?f=10&t=19056 Solar Plains Dev Server

User avatar
twoelk
Member
Posts: 1365
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

by twoelk » Post

Maybe a nice archive with a library of all relevant model files in a format that Blender can edit would be usefull instead of having to search for the modells and experimenting with what Blender can load and what not.

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

by dgm5555 » Post

twoelk wrote:Maybe a nice archive with a library of all relevant model files in a format that Blender can edit would be usefull instead of having to search for the modells and experimenting with what Blender can load and what not.
Is is frustrating that many of the current mods can't be edited with Blender. I have to admit if I knew anything about mesh formats and animation, I would definitely have picked one which blender can import and not just export. The various posts I read implied that .b3d and .x were 'best', so I ran with .b3d as the only one which worked reasonably for me. I was planning on uploading my files with a .blend.zip included (which shrinks a 5mb file to a 160kb archive) to enable editing.

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

by dgm5555 » Post

I was going to edit this tutorial in the wiki, but it seems to have been deleted (in both the .net and .com sites). No explanation why though - the replacement on the .com is not a tutorial at all, but a few reminders about animation so I've put them on the end of the post. The .net wiki just serves a blank page. As a result I'll make any updates to my original post rather than the wiki.

User avatar
hoodedice
Member
Posts: 1372
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

by hoodedice » Post

Go ahead - If I don't add it, someone else will.
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
twoelk
Member
Posts: 1365
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

by twoelk » Post

I just copied your forum post to the Minetest Wiki (net version).

I don't see any activity by you or to any Blender subject in the logs. Maybe you did something wrong?

edit: I made some major formating please check if this is true to your idea. I also unpersonalized the text somewhat. The initial unedited import is now on the discussion page. So sign in and happy tweaking. Maybe the deeply indented lists should be somewhat simplified.
Last edited by twoelk on Fri Apr 18, 2014 14:54, edited 1 time in total.

User avatar
Glünggi
Member
Posts: 126
Joined: Wed Apr 16, 2014 08:13
Location: Switzerland

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by Glünggi » Post

My Blender have no Exportoption for B3d.. reloadet yesterday and nothing..
Need it an addon?
I try it with a Max Tool vor x-files... but Minetest scale my Desertchicken to a Chigger.
Every Try to rescale, disort my model to a flat Paperbird. Anyway i scale at the Luaskrip and also with max... dont know wath i do wrong.
Anybody?

(edit: Download the Blender export script B3DExport.py) -.- i try it

User avatar
HeroOfTheWinds
Member
Posts: 470
Joined: Wed Apr 23, 2014 23:16
GitHub: HeroOfTheWinds
IRC: WindHero
Location: Hawaii

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by HeroOfTheWinds » Post

I know this is rather simple and you probably tried this already, but you mentioned that directx format sometimes causes faces to be drawn improperly... Did you make sure to recalculate and preview the normals on the mesh before exporting it? Additionally, sometimes you need to manually change the normals and then disable automatic normal calculation.
Nam ex spatio, omnes res venire possunt.
Why let the ground limit you when you can reach for the sky?
Back to college now, yay for sophomore year schedules. :P

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by dgm5555 » Post

HeroOfTheWinds wrote:Did you make sure to recalculate and preview the normals on the mesh
Good thought. I didn't at the time but I've just checked and normals on the model I originally tried directx with are all correct, and don't move when recalculated. I haven't done any experimenting with getting directx working as b3d worked flawlessly, so I felt no need to expend more time on it.

User avatar
Niveocrystal
New member
Posts: 8
Joined: Sun Nov 16, 2014 14:42
In-game: Niveocrystal
Location: On the moon fighting away the dark.

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by Niveocrystal » Post

What's the LowMenubar:New mean?

EDIT: Nevermind, found it.
My m- oh... :c

Dilkarishta
New member
Posts: 4
Joined: Sun Jan 25, 2015 10:32

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by Dilkarishta » Post

Hi there,
I've created a cow-model with animation in blender 2.72b with these tutorials:
https://www.youtube.com/watch?v=gR2OV9r76_w
https://www.youtube.com/watch?v=BYGaDMdQhSk
and
http://wiki.minetest.net/Using_Blender#Animation

It worked very well, but it ends when I tried to export the animation of my cow to .x
My Problem is, that the cow doesn't walk in minetest. It moves forward(I know that momentarily it moves sideways) but it doesn't move its legs.
I've clicked the armature and the mesh in object mode. Here is my blender-work:
cow.7z
(108.4 KiB) Downloaded 62 times
then file->export->directx

I've choosen the following boxes:
Export.png
(149.27 KiB) Not downloaded yet
Then I changed in minetest-mobs-redo only the model (and later the texture).


And as a second question:
How can I define special animation in one blender-file, like walking, eating and sleeping, so that I can program in minetest sleeping at night etc.? Or must I make different .x and merge them?

Can please somebody help me?

User avatar
Sokomine
Member
Posts: 4017
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by Sokomine » Post

Dilkarishta wrote: How can I define special animation in one blender-file, like walking, eating and sleeping, so that I can program in minetest sleeping at night etc.? Or must I make different .x and merge them?
I can't help you with Blender specific questions, but on the Minetest side, all the animations are part of the .x file. Each action starts at a diffrent frame, so i.e. standing are frames 1 to 3, while walking may be frames 4 to 20, and sleeping 21 to 22 (just as an example). If played in full, your mob would go through a loop of first standing, then walking, then sleeping, and then again from the beginning.
I'd love to see your cow! Large animals are very difficult to do. It looks strange if a huge beast turns on the spot and suddenly faces the opposite direction.
A list of my mods can be found here.

User avatar
TenPlus1
Member
Posts: 2727
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by TenPlus1 » Post

As far as I'm aware, Minetest can also import and use .b3d models as I'm using the newer 3d-armor mod where the player model is in such a format...

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by ExeterDad » Post

I'll check out your supplied blend when I get home from work and see what I can do to help.
@tenplus1 its cool you mentioned the 3d_armor model, I haven't really heard if anyone was actually using it yet since I did the recent work on it. And I forked your mobs redo, hoping my future PR ideas will interest you.

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by ExeterDad » Post

Dilkarishta wrote:Hi there,
I've created a cow-model with animation in blender 2.72b with these tutorials:
https://www.youtube.com/watch?v=gR2OV9r76_w
https://www.youtube.com/watch?v=BYGaDMdQhSk
and
http://wiki.minetest.net/Using_Blender#Animation

It worked very well, but it ends when I tried to export the animation of my cow to .x
My Problem is, that the cow doesn't walk in minetest. It moves forward(I know that momentarily it moves sideways) but it doesn't move its legs.
I've clicked the armature and the mesh in object mode. Here is my blender-work:
cow.7z
then file->export->directx

I've choosen the following boxes:
Export.png
Then I changed in minetest-mobs-redo only the model (and later the texture).


And as a second question:
How can I define special animation in one blender-file, like walking, eating and sleeping, so that I can program in minetest sleeping at night etc.? Or must I make different .x and merge them?

Can please somebody help me?
I had all kinds of problems LOL
For some reason it took a act of God to get that darn 7z file extracted on my Debian Wheezy. Might be a issue on my end as I rarely deal with them.
I haven't dealt with .x exports in a while so I exported in .b3d.
I did end up with a animated (took steps) cow in mobs redo, but it wasn't pretty. I had no mapped texture to apply and couldn't see that the material in your blend was mapped? So the cow was grey and goofy looking as I just used the texture for the mobs redo cow so there would be "something" showing. The cow was taking steps, but he was on his side and scaled way small. But that is easily resolved with some scaling and such from blender before export. It usually takes a few tries bringing into Minetest until I'm happy with it anyway.
To answer your question. Your model must contain the animation. It must not be separate like a collada model. Each animation you make is lined up end to end in your timeline. So it was be one animation. Then in minetest you define the start and end keyframes of each desired animation. In your case, you have 20 frames that seem to be one complete walk cycle. So in your mobs redo "cow2.lua" your animation needs to be defined like this:

Code: Select all

	animation = {
		speed_normal = 15,		speed_run = 15,
		stand_start = 0,		stand_end = 0,
		walk_start = 1,		walk_end = 20,
		--run_start = 105,		run_end = 135,
		--punch_start = 70,		punch_end = 100,
	},
I have the last two lines commented out since you don't have a animation built for them. You don't seem to have a standing animation so I just set stand_start and stand_end at frame 0 because your cow was in a complete stand at that frame. If you build a standing animation just add those frame numbers in its place. Unless you modify the api.lua a bunch, you are limited to using stand, walk, run and punch for animations.

For future critters... You may want to consider naming your bones. And a simple cubic model only requires a fraction of the bones you made. :)

Dilkarishta
New member
Posts: 4
Joined: Sun Jan 25, 2015 10:32

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by Dilkarishta » Post

Thank you for all your help!
.x Doesn't work yet, but I exported the cow in .b3d and it works! Also the help of changing .lua to my timeline in blender.
I didn't create a texture because I doesn't want all the work for nothing. Now I can start to specify the animation and create a texture for it.
(And @ ExeterDad: It was easier for me to made more bones like in the youtube tutorial, so I could exclude faults of a wrong armature)
Thanks a lot!

User avatar
dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: Mod / Mob creation in Blender - a quick-start guide/basi

by dgm5555 » Post

Dilkarishta wrote:.x Doesn't work yet
I never had much success with .x - b3d seems to be much more stable and reliable.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests