[SOLVED] Easy way for converting nodeboxes to models?

Post Reply
User avatar
rudzik8
Member
Posts: 192
Joined: Wed Jun 02, 2021 04:13
GitHub: rudzik8
In-game: db75c and rudzik8
Location: Siberia

[SOLVED] Easy way for converting nodeboxes to models?

by rudzik8 » Post

In my mod I have a nodebox for table lamp (link). To texture all this properly it uses one texture per side, which is very painful T_T
Recreating that in Blender is a whole mess for me, especially when trying to scale texture up perfectly (pixel to pixel), but it may be just my experience :P
Question: is there any easy way for converting nodeboxes to models? I need that to increase performance of my mod and make blocks use more material types instead of just one. Something like a script, or a program (maybe a Blender alternative that is more gentle with voxel models)?
Thanks.
Last edited by rudzik8 on Sat Oct 01, 2022 09:26, edited 1 time in total.
MineClone2 dev and modder and the creator of Voxelgarden (revived) || Codeberg

User avatar
LMD
Member
Posts: 1386
Joined: Sat Apr 08, 2017 08:16
GitHub: appgurueu
IRC: appguru[eu]
In-game: LMD
Location: Germany
Contact:

Re: Easy way for converting nodeboxes to models?

by LMD » Post

rudzik8 wrote:
Fri Sep 30, 2022 03:25
In my mod I have a nodebox for table lamp (link). To texture all this properly it uses one texture per side, which is very painful T_T
Recreating that in Blender is a whole mess for me, especially when trying to scale texture up perfectly (pixel to pixel), but it may be just my experience :P
Question: is there any easy way for converting nodeboxes to models? I need that to increase performance of my mod and make blocks use more material types instead of just one. Something like a script, or a program (maybe a Blender alternative that is more gentle with voxel models)?
Thanks.
Have you actually verified that the models are more performant? On the one hand, Minetest can do some culling on nodeboxes that isn't done as easily for models. On the other hand, you could remove some faces you know won't be visible.
My stuff: Projects - Mods - Website

User avatar
Nathan.S
Member
Posts: 1147
Joined: Wed Sep 24, 2014 17:47
GitHub: NathanSalapat
IRC: NathanS21
In-game: NathanS21
Location: Bigsby Texas
Contact:

Re: Easy way for converting nodeboxes to models?

by Nathan.S » Post

I believe Rubenwardy's nodebox editor can export to obj. Although it's depreciated, and I'm not sure how easily you can import nodeboxes into it. Last time I used it I had to manually enter all the coordinates for the nodeboxes.
I record Minetest videos, Mod reviews, Modding tutorials, and Lets plays.
Check out my website, and brand new Minetest Modding Course

User avatar
rudzik8
Member
Posts: 192
Joined: Wed Jun 02, 2021 04:13
GitHub: rudzik8
In-game: db75c and rudzik8
Location: Siberia

Re: Easy way for converting nodeboxes to models?

by rudzik8 » Post

Nathan.S wrote:
Fri Sep 30, 2022 12:53
I believe Rubenwardy's nodebox editor can export to obj.
Hmm... maybe, but NodeBoxEditor crashes at some basic things like saving projects, so I'm aware exporting it might end up like that. There are some forks of NBE that may work better, may check later.
LMD wrote:
Fri Sep 30, 2022 11:11
Have you actually verified that the models are more performant? On the one hand, Minetest can do some culling on nodeboxes that isn't done as easily for models. On the other hand, you could remove some faces you know won't be visible.
I didn't verify that, but benchmarks from others are telling that models are faster. Even if performance is same, texturing objects like table lamp in nodeboxes is VERY difficult. There's a screenshot of this table lamp:
Image
As you can see, I've used wool for both parts of it just because I can't do otherwise (like make that steel look like if it was made from iron (equivalent to MTG's steel)) so it's looking weird. If I've used model, I could use normal UV-mapping and make the stand steel without making the top part steel as well (which is very ugly and totally unsuitable).
I may keep other blocks in my mod nodeboxed (like armchairs which don't have any problems with texturing), but things like table lamp are painful to look at. Oh, and if you'll put it on glass or barrier and look from bottom you'll see that bottom part of it's stand is actually containing a lamp inside (*sigh*)
MineClone2 dev and modder and the creator of Voxelgarden (revived) || Codeberg

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Easy way for converting nodeboxes to models?

by Desour » Post

Minetest map rendering speed is mostly bottlenecked through the amount of drawcalls. And there's always one meshbuffer per mapblock per tile type. So, if you use the same tile on every node face (e.g. cobble stairs), meshes probably won't be faster. But if you have something like your lamp and only use one tile (and hence only one material in the mesh), it will probably be faster. But to be sure, you should try it out and do benchmarks (i.e. place many lamps with worldedit and compare fps).

Creating meshes isn't that hard.
I've made a small script for fun to convert a nodebox to an obj wavefront mesh:
<https://gist.github.com/Desour/91111d08 ... 11b30d027f>
The winding order should be correct, according to blender. But the texture coordinates are wrong.
Also, there's only one material.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
rudzik8
Member
Posts: 192
Joined: Wed Jun 02, 2021 04:13
GitHub: rudzik8
In-game: db75c and rudzik8
Location: Siberia

Re: Easy way for converting nodeboxes to models?

by rudzik8 » Post

DS-minetest wrote:
Fri Sep 30, 2022 17:10
Minetest map rendering speed is mostly bottlenecked through the amount of drawcalls. And there's always one meshbuffer per mapblock per tile type. So, if you use the same tile on every node face (e.g. cobble stairs), meshes probably won't be faster. But if you have something like your lamp and only use one tile (and hence only one material in the mesh), it will probably be faster. But to be sure, you should try it out and do benchmarks (i.e. place many lamps with worldedit and compare fps).
Sure, probably will that after creating mesh.
DS-minetest wrote:
Fri Sep 30, 2022 17:10
I've made a small script for fun to convert a nodebox to an obj wavefront mesh:
<https://gist.github.com/Desour/91111d08 ... 11b30d027f>
The winding order should be correct, according to blender. But the texture coordinates are wrong.
Also, there's only one material.
Doesn't seem like a go-to solution to me with texture coords being broken (but may be useful for future modders going there for answers)

Will try to redo that in good old Blender once again and reply here.
MineClone2 dev and modder and the creator of Voxelgarden (revived) || Codeberg

User avatar
Blockhead
Member
Posts: 1622
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: Easy way for converting nodeboxes to models?

by Blockhead » Post

A good tool that would complete the texture coordinates (you mean UVs right?) correctly and apply all the right materials would be nice. Thanks for at least spinning something up quickly Desour.

rudzik: There are also alternatives to Blender that are easier to start with like BlockBench in case you don't already have Blender experience. Blockbench is pretty decent for voxel engine models.
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
rudzik8
Member
Posts: 192
Joined: Wed Jun 02, 2021 04:13
GitHub: rudzik8
In-game: db75c and rudzik8
Location: Siberia

Re: Easy way for converting nodeboxes to models?

by rudzik8 » Post

Blockhead wrote:
Sat Oct 01, 2022 02:34
rudzik: There are also alternatives to Blender that are easier to start with like BlockBench in case you don't already have Blender experience. Blockbench is pretty decent for voxel engine models.
I already have some experience with Blender, but will give a try for Blockbench too, thanks!
MineClone2 dev and modder and the creator of Voxelgarden (revived) || Codeberg

User avatar
rudzik8
Member
Posts: 192
Joined: Wed Jun 02, 2021 04:13
GitHub: rudzik8
In-game: db75c and rudzik8
Location: Siberia

Re: Easy way for converting nodeboxes to models?

by rudzik8 » Post

rudzik8 wrote:
Sat Oct 01, 2022 02:26
DS-minetest wrote:
Fri Sep 30, 2022 17:10
Minetest map rendering speed is mostly bottlenecked through the amount of drawcalls. And there's always one meshbuffer per mapblock per tile type. So, if you use the same tile on every node face (e.g. cobble stairs), meshes probably won't be faster. But if you have something like your lamp and only use one tile (and hence only one material in the mesh), it will probably be faster. But to be sure, you should try it out and do benchmarks (i.e. place many lamps with worldedit and compare fps).
Sure, probably will that after creating mesh.
And did. Performance is mostly same, but texturing is much easier now and I finally have some normal mesh experience!
MineClone2 dev and modder and the creator of Voxelgarden (revived) || Codeberg

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: Easy way for converting nodeboxes to models?

by Desour » Post

rudzik8 wrote:
Sat Oct 01, 2022 09:16
rudzik8 wrote:
Sat Oct 01, 2022 02:26
DS-minetest wrote:
Fri Sep 30, 2022 17:10
Minetest map rendering speed is mostly bottlenecked through the amount of drawcalls. And there's always one meshbuffer per mapblock per tile type. So, if you use the same tile on every node face (e.g. cobble stairs), meshes probably won't be faster. But if you have something like your lamp and only use one tile (and hence only one material in the mesh), it will probably be faster. But to be sure, you should try it out and do benchmarks (i.e. place many lamps with worldedit and compare fps).
Sure, probably will that after creating mesh.
And did. Performance is mostly same, but texturing is much easier now and I finally have some normal mesh experience!
I have to correct myself in how one would benchmark this.
Having more than one of the node in a mapblock doesn't increase the tile type count per mapblock. You could however have many mapblocks that have each one of your node and are otherwise filled with air.

Anyway, if it's an artificial, sparsely used node, you shouldn't have to worry too much about performance.
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests