[Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

Post Reply
User avatar
Noodlemire
Member
Posts: 61
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

[Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Noodlemire » Post

This mod provides a new method to making 3D models. It comes with voxelmodel.obj, a model consisting of a 17x17x17 grid of overlapping squares. Thus, by simply making different textures for this model, you can make a wide variety of voxelated shapes. It also allows for a very unusual style of animation, as you can use texture-based animation to constantly change the shape of your model and have it act like a 3D sprite.

There are also a few example objects provided. There's a table, a bookshelf that can optionally replace the default bookshelf, an animated floor torch, and a simple cat that can walk around and blink. Note that by default, these are only available in creative mode, except for when the default bookshelf is overridden.

If you want to make your own object using voxelmodel, specifics about how it works are detailed in the init.lua and voxelmodel_guide.png files.
Image Image Dependencies: none
Optional dependencies: default
Repository: https://github.com/Noodlemire/voxelmodel
Liscense: LGPL 2.1, https://github.com/Noodlemire/voxelmodel/blob/master/LICENSE.txt
Download: https://mega.nz/file/ruIyxYrJ#GefUxLjolTqQ9wx1yZSDX92hDnFnNDPdu05k1TRVYqw

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by PolySaken » Post

This is actually amazing. I never would have thought of doing something like this. It's definitely better than nodeboxes IMO, and the potential for node animation is amazing. (I don't think 3d animated nodes were even possible before).
I don't really understand the texture layout, but it doesn't look too complicated.
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
Noodlemire
Member
Posts: 61
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Noodlemire » Post

PolySaken wrote:
Sun Sep 13, 2020 22:05
(I don't think 3d animated nodes were even possible before).
They were possible, if you followed the same principle that voxelmodel uses, which is to create a file that has all possible geometry that the object will use, and hide parts of it as needed by making parts of the texture blank.
PolySaken wrote:
Sun Sep 13, 2020 22:05
I don't really understand the texture layout, but it doesn't look too complicated.
I tried to make it as simple as possible. It might be easier to understand with a metaphor. Imagine dominoes, except they're square. Grab 17 dominoes, and line them up in a row so that each domino is the same distance away from the previously placed one. Make sure each domino is oriented the same way, and faces the same direction. This is how any single axis looks in voxelmodel.obj. The obj file in its entirety is just three sets of these domino rows, one for each axis, placed so that they overlap perfectly into the shape of a cube.

Now, take that row of dominoes, and start laying them on the floor. Start with the first domino you placed, and work your way downwards, placing one domino directly underneath the last one that you laid on the floor. Like before, also make sure that they are all orientated in the same way. This is how an axis in the model relates to any particular texture made to fit the model. Which column coresponds to which axis is shown in the provided voxelmodel_guide.png file.

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by PolySaken » Post

Oh, that makes sense. I'll try it out later, maybe use it in one of the games I'm working on. Here's a suggestion: perhaps a set of differently sized models, for example a two-node high one for taller entities or nodes. Imagine a fully voxel-animated player model, lol.
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
Noodlemire
Member
Posts: 61
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Noodlemire » Post

PolySaken wrote:
Mon Sep 14, 2020 22:58
Oh, that makes sense. I'll try it out later, maybe use it in one of the games I'm working on. Here's a suggestion: perhaps a set of differently sized models, for example a two-node high one for taller entities or nodes. Imagine a fully voxel-animated player model, lol.
I was thinking of adding more sizes down the line, but I'd prefer to stick to cubic models. A rectangular model wouldn't divide as nicely as I'd like, and it'd be easier overall to keep the same general format as much as possible. You can set the size of the model in-game easily enough anyways, stretching it to whatever size you please, so you could take a theoretical 32x32x32 textured model and scale it to 0.5x on both horizontal axis to get what is effectively a 16x32x16 model.

User avatar
Wuzzy
Member
Posts: 4786
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy
Contact:

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Wuzzy » Post

This is a very interesting idea!
I wonder how strong the impact on performance is, tho. How many faces?

User avatar
Noodlemire
Member
Posts: 61
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Noodlemire » Post

Wuzzy wrote:
Tue Sep 15, 2020 13:15
I wonder how strong the impact on performance is, tho. How many faces?
51 square faces in the model, without backface culling. I haven't tested it very heavily yet, but I'm reasonably certain that the more complex a textured voxelmodel becomes, the faster it'll be in comparison to an equivalent traditional model.

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by PolySaken » Post

A single 9-faced block can slice 1 fps off a raspberry pi, so I imagine 51 faces would be impossible to handle for a lower-end machine. Is backface culling an option? If not, perhaps culling settings would be important in the next engine update.
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

User avatar
Noodlemire
Member
Posts: 61
Joined: Sun May 27, 2018 00:07
GitHub: Noodlemire
In-game: Noodlemire

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by Noodlemire » Post

PolySaken wrote:
Tue Sep 15, 2020 21:17
A single 9-faced block can slice 1 fps off a raspberry pi, so I imagine 51 faces would be impossible to handle for a lower-end machine.
To be honest, in the context of machines that low end, I don't think there's anything at all I can do to help, other than to tell those users not to use this mod.
PolySaken wrote:
Tue Sep 15, 2020 21:17
Is backface culling an option? If not, perhaps culling settings would be important in the next engine update.
I'm not sure if it's possible or even worth it to have backface culling for specific parts of a texture. Rigth now, backface culling does exist, but it can only turn individual faces on or off. It would be extremely difficult to implement proper backface culling with this setup, and would very likely require defining individual normals on a pixel-by-pixel basis.

It might be easier to understand why backface culling voxelmodels would be so difficult, if I gave a visual example.
First, look at this close-up of the voxelmodel cat. See the inner part of the ear I outlined? See how it looks like it's just one face, that would be pointed forward and should therefore be culled when looking at it backwards?
Image Now look at this highlighted section of the cat's head. Not only is that not six faces but one, it's also part of the exact same face as the inner part of the ear that I mentioned in part 1. Yes, the same spot on the opposite ear also belongs to this one face. If you tried the current automatic method of backface culling, you would just see though one side of the ear or the other. The only way to see both is to have either no backface culling, or super manual pixel-by-pixel backface culling.
Image

User avatar
PolySaken
Member
Posts: 817
Joined: Thu Nov 09, 2017 05:18
GitHub: PolySaken-I-Am
In-game: PolySaken
Location: Wānaka, Aotearoa
Contact:

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by PolySaken » Post

Ah, I see. I don't know how Irrlicht works, but It seems like it could benefit from a reworked culling method, perhaps slice-based culling rather than face-based. I know irrlicht is pretty dead though, so there might be no hope of such a thing. (why do we use irrlicht anyway?)
Guidebook Lib, for in-game docs | Poly Decor, some cool blocks | Vision Lib, an all-purpose library.

deleted c0a803ab

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by deleted c0a803ab » Post

This is just awesome, really good work!
I love the bookshelf in special.
But I've found a bug in it, the yellow book downside is broken, see the attachment.
screenshot_20210402_233735.png
screenshot_20210402_233735.png (16.13 KiB) Viewed 1133 times

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by j0j0n4th4n » Post

I try to do the same thing you did with the with bookshelf to the vesselshelf but I keep getting this error:

Code: Select all

ModError: Failed to load and run script from /home/j0j0/.minetest/mods/voxelmodel/init.lua:
/home/j0j0/.minetest/mods/voxelmodel/nodes.lua:10: Attempt to override non-existent item vessels:shelf
stack traceback:
	[C]: in function 'error'
	/usr/share/games/minetest/builtin/game/register.lua:402: in function 'override_item'
	/home/j0j0/.minetest/mods/voxelmodel/nodes.lua:10: in main chunk
	[C]: in function 'dofile'
	/home/j0j0/.minetest/mods/voxelmodel/init.lua:44: in main chunk
Verifique o debug.txt para mais detalhes.

This is what I did in the nodes.lua file:

Code: Select all

minetest.override_item("vessels:shelf", {
	drawtype = "mesh",
	mesh = "voxelmodel.obj",
	tiles = {"voxelmodel_vesselshelf.png"},
	inventory_image = "voxelmodel_vesselshelf_inv.png",
	wield_image = "voxelmodel_vesselshelf_inv.png",
})

cdb_894a100ddd76

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: [Mod] Template to Easily Make Fancy Voxelized Models [voxelmodel]

by j0j0n4th4n » Post

*facepalm*
I had forgot vessels was not in default. That was the problem, I added as dependency and everything worked.
Here is a screenshot of the vessel shelf I made:
Image

And here is the texture:
Image
cdb_894a100ddd76

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests