Page 1 of 3

Basic node_box model examples

PostPosted: Wed Jul 11, 2012 13:36
by tkerwel
well i hope this thread is helpfull.

Whats the goal?
it should help moders to see basic node_box model codes so they can use that in there projects.

How to put in here?
nice would be a picture and a basic discreption what the model looks like and the of course the fixed {x,y,z, x,y,z) values.

so here is a example:

Picture :
Image

Description:
this is a left side panel of any material (in example its default:wood) with the thickness of 0.10

Code:
node_box = {
type = "fixed",
fixed = { {-0.50, - 0.50, -0.50, -0.40, 0.50, 0.50}, }


Would be nice if you guys would add some more examples so we can have a kind of database which allows us to develop more komplex node_boxes in future.

thanks in advance

PostPosted: Wed Jul 11, 2012 13:51
by tkerwel
simple chair

Picture:
Image

Discription:
three side's with basic panel and one middle panel form a chari

Code:
node_box = {
type = "fixed",
fixed = {

{-0.50, -0.50, -0.50, -0.40, 0.50, 0.50},
{-0.50, 0.00 ,-0.50, 0.50, 0.10, 0.50},
{-0.50, -0.50 ,-0.50, 0.50, 0.50, -0.40},
{ 0.40, 0.50 , 0.50, 0.50, -0.50, -0.50},
}
},

i guess this shows my attention, so a few basic node's and everybody is able to create more komplex things for adding to minetest.

PostPosted: Thu Jul 12, 2012 07:17
by cactuz_pl
Pyramid 1 x 1 x 0.5
Image

Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {-0.5,-0.5,-0.5, 0.5,-0.4,0.5},  --lower level
            {-0.4,-0.4,-0.4, 0.4,-0.3,0.4},  --2nd level
            {-0.3,-0.3,-0.3, 0.3,-0.2,0.3},  --3rd level
            {-0.2,-0.2,-0.2, 0.2,-0.1,0.2},  --4th level
            {-0.1,-0.1,-0.1, 0.1,0,0.1}       -- top level
           
        }
    }

PostPosted: Thu Jul 12, 2012 07:33
by Stef
can you make with this also a litle blocks mod???

PostPosted: Sun Jul 15, 2012 14:43
by cactuz_pl
Stef wrote:can you make with this also a litle blocks mod???


Sorry that I put it so late.
This is test mod which contains pyramid block.
Craft: dirt
DOWNLOAD

PostPosted: Mon Jul 16, 2012 10:21
by lesliev
Thanks for this tutorial. I have tried duplicating it a bit with Wings3d and have some tips.

Here's the first slab: http://www.lesismore.co.za/img/wings-1.png

If you set a bounding box at 1, 1, 1, you can practice drawing cubes inside of it. That's the green cube in the image. If you export the cubes in bzw format you get the text to the right in that image. Since you can only draw cubes, only the vertices on lines 2 and 4 are needed, I marked them with ###.

Then I added another slab: http://www.lesismore.co.za/img/wings-2.png

This produced The following images inside Minetest:
http://www.lesismore.co.za/img/wings_in_mt1.png
http://www.lesismore.co.za/img/wings-in-mt2.png

...you can see the model messed up in the last image because I got the vertex order wrong. It seems you need to specify the smaller X, Y and Z before the larger, so this is correct:

-- x1 y1 z1 x2 y2 z2
{-0.5, -0.5, -0.5, -0.4, 0.5, 0.5}, -- slab 1
{0.4, -0.5, -0.5, 0.5, 0.5, 0.5} -- slab 2


This means that if you want to export cubes from Wings3d in bzw format, you need to rearrange things a bit. This is the second slab, the one that looks like this in Minetest:
{0.4, -0.5, -0.5, 0.5, 0.5, 0.5} -- slab 2

The mesh in the bzw file:

mesh
name cube2_copy3
#8 vertices, 6 faces
vertex 0.4000 -0.5000 0.5000
vertex 0.4000 0.5000 0.5000
vertex 0.5000 0.5000 0.5000 #line 2, second 3 co-ords
vertex 0.5000 -0.5000 0.5000
vertex 0.4000 -0.5000 -0.5000 #line 4, first 3 co-ords
vertex 0.4000 0.5000 -0.5000
vertex 0.5000 0.5000 -0.5000
vertex 0.5000 -0.5000 -0.5000


Is there a better format to use when exporting from Wings3d?

PostPosted: Mon Jul 16, 2012 11:33
by lesliev
To answer my own question, yes, there is a better format. Here's a very rudimentary Wavefront .obj to Minetest block converter: http://pastebin.com/NbGDZe8d

So as long as you only make cubes and those cubes are inside the 1,1,1 bounding box, you should be able to export as .obj and then convert with this Ruby program.

Don't bother reporting problems with this script if it doesn't work for you though - I have only tested it on two scenes so far!

PostPosted: Mon Jul 16, 2012 11:50
by tkerwel
@lesliev

looks like wings3d is a good program to test and dsign some nodebox models, guess i have to try this too.

my problem always is, that my mind is not working good in 3d, so i have to use a lot of try and error to see a good result with the nodebox.

so thank you for this good tip.

PostPosted: Mon Jul 16, 2012 13:29
by tkerwel
simple chair

Image

Discription:
top panel and simple "stick" for a simple table

Code:

node_box = {
type = "fixed",
fixed = {
{-0.1,-0.5, -0.1, 0.1, 0.5 ,0.1},
{-0.5, 0.5, -0.5, 0.5, 0.4, 0.5},
}
},

PostPosted: Mon Jul 16, 2012 13:38
by tkerwel
Stef wrote:can you make with this also a litle blocks mod???


i dont get what you want to ask or what your intention is...

you want something like the little block mode in minecraft?

... thats posible, but will be a lot of work.
for example you can define little blocks inside the node as cube's with o,1 as side length. a node box is a box from -0.5 to 0.5 each axis, with this you can create 10 little cubs/blocks for each axis.....quite a lot to discribe and will be tricky not to lose the overview which little box you need.

maybe you like to start a data-base for this ;-) i would be glad, so i dont have to torture my brain, if i need a special box/cube in the nodebox ....

PostPosted: Tue Jul 17, 2012 12:14
by tkerwel
simple shelf

Image

Discription:l
left and right half panel plus two half layer to get a simple shelf
Code:

node_box = {
type = "fixed",
-- fixed = slopebox,
fixed = {
{-0.50, - 0.50, 0.00, -0.40, 0.50, 0.50}, -- left side
{-0.50, -0.35 , 0.00, 0.50, -0.25, 0.50},-- middle layer1
{-0.50, 0.250 , 0.00, 0.50, 0.35, 0.50},-- middle layer2
{ 0.50, 0.50 , 0.00, 0.40, -0.50, 0.50},--right sid
}

PostPosted: Tue Jul 17, 2012 20:51
by tonyka
I created a tutorial for nodeboxes, using 3D programs.

Albert Einstein once said:

only really know something, if you can explain it so that your own grandmother will understand.

I created a step by step with everything needed for anyone ever to use 3D software.

only has a downside, is in Spanish,my language; I hope someone wants to translate it because google .... (google can help but not perfect ...)

download:

tutorial Nodebox con Wings 3D.pdf ESPAÑOL

PostPosted: Tue Jul 17, 2012 21:30
by cosarara97
tonyka wrote:I created a tutorial for nodeboxes, using 3D programs.

Albert Einstein once said:

only really know something, if you can explain it so that your own grandmother will understand.

I created a step by step with everything needed for anyone ever to use 3D software.

only has a downside, is in Spanish,my language; I hope someone wants to translate it because google .... (google can help but not perfect ...)

download:

tutorial Nodebox con Wings 3D.pdf ESPAÑOL


I'm translating it right now, but you really should learn english... and improve your spanish spelling, lol.

PostPosted: Tue Jul 17, 2012 22:51
by cosarara97
I translated tonyka's manual, you can download it from here: https://dl.dropbox.com/u/57504822/nodeboxes.odt
Please help me improve my English by telling me all the gramatical/spelling/... errors you can find in it :)

PostPosted: Tue Jul 17, 2012 23:13
by tonyka
cosarara97 wrote:I'm translating it right now, but you really should learn english... and improve your spanish spelling, lol.

I'm afraid that's very difficult for me to get ...
confuse letters, since he was little, is a kind of dysgraphia
but I'm a whiz with mathematics and technical drawing

the ways of God are inscrutable ...

PostPosted: Tue Jul 17, 2012 23:15
by tonyka
cosarara97 wrote:I translated tonyka's manual, you can download it from here: https://dl.dropbox.com/u/57504822/nodeboxes.odt
Please help me improve my English by telling me all the gramatical/spelling/... errors you can find in it :)

hey thanks :D

PostPosted: Wed Jul 18, 2012 06:48
by tkerwel
@cosarara97

would it be possible also to translate most of the info of the "Moviliario 3D (proyecto 3D Forniture)" cause i think this is a very good basic for understanding how the node boy is working. kind of bible of 3d in minetest (lol).

i realy would love it, if somebody could translate this info and give other moders that as gift for therer development.

and my biggest thanks to tonyka for the work he is doing and the insperation he already give me

PostPosted: Wed Jul 18, 2012 09:52
by tkerwel
Simple side table (cabinet)
Image
Discription:
a bit more complicatet this time, mainly a cube with space to the bottom with 4 feet

code:
node_box = {
type = "fixed",
-- fixed = slopebox,
fixed = {
{-0.50, 0.30, -0.50, 0.50, 0.50, 0.50},-- tope layer
{-0.50, -0.30, -0.50, -0.40, 0.50, 0.50},-- left side
{ 0.40, -0.30, -0.50, 0.50, 0.50, 0.50},-- right sid
{-0.50, -0.30, -0.50, 0.50, 0.50, -0.50},-- front side
{ 0.50, -0.30, 0.50, -0.50, 0.50, 0.50},-- back side
{-0.50, -0.50, -0.50, -0.40, 0.50, -0.40},-- left front foot
{-0.50, -0.50, 0.40, -0.40, 0.50, 0.50},-- left back foot
{ 0.50, -0.50, -0.50, 0.40, 0.50, -0.40},-- right front foot
{ 0.40, -0.50, 0.40, 0.50, 0.50, 0.50},-- right back foot


}

},

PostPosted: Wed Jul 18, 2012 12:14
by tkerwel
simple half cabinet (Billy IKEA like) ;-)
Image

Discription:
its a half cabinet same build like the shelf, just add a front door. in pic now with the same texture like the simple shelf, gives us a little IKEA feeling.... my tribute to "BILLY"

code:
node_box = {
type = "fixed",
-- fixed = slopebox,
fixed = {
{-0.50, - 0.50, 0.00, -0.40, 0.50, 0.50}, -- left side
{-0.50, -0.35, 0.00, 0.50, 0.35, 0.50},-- front side
{ 0.50, 0.50 , 0.00, 0.40, -0.50, 0.50},--right sid
}

},

PostPosted: Wed Jul 18, 2012 16:25
by cactuz_pl
Castle window, three blocks: upper middle and bottom.

Image

Upper:
Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {-0.4,0.4,-0.5, 0.4,0.5,-0.4},
            {-0.4,0.4,0.4, 0.4,0.5,0.5},
            {-0.3,0.3,-0.4, 0.3,0.5,-0.3},
            {-0.3,0.3,0.3, 0.3,0.5,0.4},
            {-0.2,0.2,-0.3, 0.2,0.5,0.3},
            {0.2,-0.5,-0.3, 0.3,0.5,0.3},
            {-0.3,-0.5,-0.3, -0.2,0.5,0.3},
            {0.3,-0.5,-0.4, 0.4,0.5,0.4},
            {-0.4,-0.5,-0.4, -0.3,0.5,0.4},
            {0.4,-0.5,-0.5, 0.5,0.5,0.5},
            {-0.5,-0.5,-0.5, -0.4,0.5,0.5},
        },
    },


Middle:
Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {0.2,-0.5,-0.3, 0.3,0.5,0.3},
            {-0.3,-0.5,-0.3, -0.2,0.5,0.3},
            {0.3,-0.5,-0.4, 0.4,0.5,0.4},
            {-0.4,-0.5,-0.4, -0.3,0.5,0.4},
            {0.4,-0.5,-0.5, 0.5,0.5,0.5},
            {-0.5,-0.5,-0.5, -0.4,0.5,0.5},
           
        },
    },


Bottom:
Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {0.2,-0.4,-0.3, 0.3,0.5,0.3},
            {-0.3,-0.4,-0.3, -0.2,0.5,0.3},
            {0.3,-0.4,-0.4, 0.4,0.5,0.4},
            {-0.4,-0.4,-0.4, -0.3,0.5,0.4},
            {0.4,-0.4,-0.5, 0.5,0.5,0.5},
            {-0.5,-0.4,-0.5, -0.4,0.5,0.5},
            {-0.5,-0.5,-0.5, 0.5,-0.4,0.5}
           
        },
    },


Licence: GNU GPL v3
Feel free to use these data in your mod.

PostPosted: Thu Jul 19, 2012 08:47
by tkerwel
simple barrel (as far this can still be called simple)

Image

Discription:

first i have to mention:
1. this this is based on the texture of "mauvebic" its his barrel texture
2. the idea with the slopebox is original from jeija

here we draw a circle in the node box parameters can be changed

local slopebox = {}
local px = 0
local py = 0
local kreis =45
local r = 0.3

for pk = 0, kreis, 1 do
px= r * math.cos(pk)
py= r * math.sin(pk)
slopebox[pk+1]={px, -0.5 , py, px+0.1, 0.4, py+0.1}
end


the node box function is easy with this:

node_box = {
type = "fixed",
fixed = slopebox,
},

i dont know if i realy have to write hier the licence ? mainly its only a code sniplet, so everybody can use it for his own purpose and change this.

my intention is, to give with this examples some ppl the idea what is possible with the node box ....

PostPosted: Thu Jul 19, 2012 09:17
by cactuz_pl
tkerwel wrote:local slopebox = {}
local px = 0
local py = 0
local kreis =45
local r = 0.3

for pk = 0, kreis, 1 do
px= r * math.cos(pk)
py= r * math.sin(pk)
slopebox[pk+1]={px, -0.5 , py, px+0.1, 0.4, py+0.1}
end

the node box function is easy with this:

node_box = {
type = "fixed",
fixed = slopebox,
},


Can you post complete lua with this barrel, I want to understand where this:
Code: Select all
local slopebox = {}
local px = 0
local py = 0
local kreis =45
local r = 0.3

for pk = 0, kreis, 1 do
   px= r * math.cos(pk)
   py= r * math.sin(pk)
    slopebox[pk+1]={px, -0.5 , py,  px+0.1, 0.4, py+0.1}
end
should be.

---

Simple model of platform:
Image

Image

Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {-0.5,0.4,0.3, 0.5,0.5,0.35},
            {-0.5,0.4,0.1, 0.5,0.5,0.15},
            {-0.5,0.4,-0.1, 0.5,0.5,-0.05},
            {-0.5,0.4,-0.3, 0.5,0.5,-0.25},
            {-0.5,0.4,-0.5, 0.5,0.5,-0.45},
            {-0.35,0.4,-0.5, -0.3,0.5,0.5},
            {-0.15,0.4,-0.5, -0.1,0.5,0.5},
            {5.e-2,0.4,-0.5, 1.e-1,0.5,0.5},
            {0.25,0.4,-0.5, 0.3,0.5,0.5},
            {0.45,0.4,-0.5, 0.5,0.5,0.5},
           

           
        },
    },


Feel free to use these data in your mod.

PostPosted: Thu Jul 19, 2012 09:40
by tkerwel
@cactuz_pl
Can you post complete lua with this barrel, I want to understand where this:


no problem, here is the whole code for it

local slopebox = {}
local px = 0
local py = 0
local kreis =45
local r = 0.3

for pk = 0, kreis, 1 do
px= r * math.cos(pk)
py= r * math.sin(pk)
slopebox[pk+1]={px, -0.5 , py, px+0.1, 0.4, py+0.1}
end


minetest.register_node("deko:deko_circle", {
description = "deko_circle",
drawtype = "nodebox",
tiles = {
"deko_stahl.png",
"deko_stahl.png",
"deko_barrel.png",

},
inventory_image = "default_wood.png",
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
node_box = {
type = "fixed",
fixed = slopebox,
},
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2},
})

just make sure that the name (deko:deko_circle) is changed to the name you use in your mod. for the tiles ={} you can use your own or default_wood.png.

the whole secret is that you put all the values you need into the slopebox ={} with a simple "for loop" within this loop you calculate with the a bit of math the values of the x and y coordinate for a circle and put them into the slope.

this slopebox contains now all data you need and can be put into the node_box easy....

fixed = slopebox


i already was thinking abt a small converter for 3D objects. theoretical you can transfer into this slopebox data for lots of 3D objects and then place them with the node_box parameter into minetest.

i guess sooner or later somebody herer will find a way to convert 3D objects into minetest this way....

maybe you start this ?

PostPosted: Thu Jul 19, 2012 12:21
by tkerwel
drill machine

Image

Discription:

an simple 3d model for a drill you can put on a table or block.

code:
node_box = {
type = "fixed",
-- fixed = slopebox,
fixed = {
{ -0.10, -0.50, 0.40, 0.10, 0.50, 0.50},
{ -0.10, 0.40, 0.40, 0.10, 0.50, -0.20},
{ -0.20, 0.00, 0.20, 0.20, 0.40, -0.20},
{ -0.01, 0.40,-0.01, 0.01,-0.30, 0.01},
{ -0.20, -0.50, 0.20, 0.20,-0.40, -0.20},
}
},

PostPosted: Thu Jul 19, 2012 14:15
by cactuz_pl
LCD monitor model:
Image
Code: Select all
node_box = {
        type = "fixed",
        fixed = {
            {-2.5136044e-2,-0.45259861,-1.0000000e-1, 2.4863956e-2,-2.5986075e-3,0.10000000},
            {0.13023723,-0.25615262,-0.40006064, 0.16023723,0.26767738,-0.37006064},
            {0.13023723,-0.25615274,0.37054221, 0.16023723,0.26767750,0.40054221},
            {0.13023723,-0.30600000,-0.40000000, 0.16023723,-0.25600000,0.40000000},
            {0.12945597,0.26433021,-0.40000000, 0.15945597,0.29433021,0.40000000},
            {2.9045502e-2,-0.25514168,-0.35000000, 7.9045502e-2,0.24485832,0.35000000},
            {8.0237234e-2,-0.30617002,-0.40000000, 0.13023723,0.29382998,0.40000000},
            {-0.25000000,-0.50000000,-0.25000000, 0.25000000,-0.45000000,0.25000000}
        },
    },

Feel free to use these data in your mod.