Voxel Recovery

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Voxel Recovery

Postby Priscilla Bibbledale » Mon Feb 22, 2021 3:19 pm

I've been messing about with MagicaVoxel after reading some tutorials on this forum and have muddled through a method of crudely constructing voxel models from the original sprites. Basically I take take the front/side/back sprites, scale them all to matching heights, stretch them all to matching width/lengths, and then intersect copies of the blocks.. it gives you a sort of dual prismatic view of the monster. then by copying a side view prism onto itself with a slight offset and subbracting, or intersecting you can use replace to get a model with front back and sides all corresponding to the original sprites. There's some dilemma as to whether to pad out the sides of the creatures, or let the first row of pixels from the front chop into the side, but the corners will need the most correction anyway.

Then you get an ugly picasso looking creature with eyes at the front and side of its head and arm shapes in its belly and extra butts hanging off its arms (in the case of the imp), but the more obvious artifacts can be erased without any particular artistic talent. Using the 3rd dimension and looking at a creature from top down makes some artifacts obvious, and the shading on the original sprites provides cues for where to add depth.

I'm not sure of the etiquette of posting pictures here, I have some screenshots of going through the process I've described above for pulling out a voxel model of a baron (with four legs). This method recovered the 3D horns from the cacodemon fairly well.

For the minute I'll just link to a 3/4 view of an imp that I've tried removign the artifacts from - it looks quite fair.


I understand that the reason existing voxel packs don't include monsters is the cost to the cpu.. but I think it would be cool to have voxel monsters, and I'll worry about my own cpu. I'm no artist and I don't think I can voxellate every doom monster animation frame myself, especially not deaths, but a single voxellated monster (besides RDVox's excellent lost soul) as a proof of concept might not be too huge an undertaking.. it would be a start and one by one we could voxellate them all. The voxels look great in doom, 3d monsters IMO never have.
Priscilla Bibbledale

Re: Voxel Recovery

Postby Gez » Mon Feb 22, 2021 3:38 pm

Embedding images is perfectly fine, as long as they aren't too large (no more than 800x800) and they aren't too many (no hard-and-fast rule here; obviously something like a step-by-step tutorial will need a lot of images; but you can use the spoiler tags to collapse your post in smaller parts to make it easier to scroll past after the first reading).

Here's your imp, embedded:
Joined: 06 Jul 2007

Re: Voxel Recovery

Postby Gwarl » Mon Feb 22, 2021 4:13 pm

Okay so some visual aids to go with my ranting..

Here's a bunch of barons stretched from the flat sprites.. just prisms

There are spares so they can be intersected in different orders.. it seems that the intersection function is a bit random as to which voxels it pulls the colour from, but you can do a replace with your sprite prism and then intersect a copy of it..

The goal is to end up with 3 shapes initially which are prisms along both cross-sections, like so:

and then by keeping copies of these, you can subtract to get just the sides or back of a model, and then replace onto another one so you have all four painted sides.

This gives you a reasonable start with a lot of artifacts to work from; here's the baron


And a couple of frames/perspectives on the cacodemon




and a zombieman with a half-baked effort to correct some artifacts:


He isn't looking good.. his chest has been removed from his gun but his hand/arm still needs attention, he only has two visible eyes from this angle rather than three but I think I might have cut the near eye into a wrong shape, and the shading is causing trouble.. but I think there's potential in this method to get some useable results.

The forum won't let me embed these images.. could be a low post count issue?
Joined: 22 Feb 2021
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Voxel Recovery

Postby Priscilla Bibbledale » Tue Feb 23, 2021 9:23 am

Considering technique, a workable way of adding some of the missing depth to the generated models is colour matching.

Basically start with a monster intersection-block with the pixels set to colour from one direction, eg the side. Here's an imp. From the front he's all wrong.


But we can start removing rows of voxels to get the colours to 'line up' from the front (top down view helps). Here I've started doing it on the upper half of the body.


And now when I shift the colour prism back to the front view here's how it looks from the side


The face is preserved!

Ultimately this could be done iteratively from each side until a rather accurate 3d model was obtained, and then the pixel colours from each side cast onto the 'front' layer of voxels from that perspective. Some things don't line up quite right (real world perspective of the camera used in photographing the original models for one), the 3d nipple bumps from the side view are above the imp's nipple spikes from the front.. I scaled them to be the same height, things are off here and there and corrections would be needed, or perhaps cutting monsters into parts and composing them, e.g. a head or an arm at a time. That would avoid things like the imp having extra arms made from belly and butt, and could be separated as 2d pieces.. But even so some monster features would need to be corrected by a pixel or 2 from the originals to make sense as voxel models.

Still this would give us 3d monsters that are far more faithful to the original artwork (still IMO unsurpassed) that are far better than anything we have. I myself am not about to do a full voxel reconstruction of every animation frame of every monster, but I might eventually get the first frame of the imp done, and hope it inspires someone to make the rest of the imp, which might inspire someone to make a full episode 1 cast, etc.
Priscilla Bibbledale

Re: Voxel Recovery

Postby Caligari87 » Tue Feb 23, 2021 12:04 pm

you can't embed images because you're posting anonymously as a guest. To embed you need to register an account and follow the instructions in the Image and Video Posting Rules thread.

As for your voxelization technique, it's a good effort! The technique isn't novel, people have been proposing and attempting this for a while with both voxels and 3D models. As you've discovered, the main problem is that there's simply not enough data in the sprites, and the data that's there doesn't always agree from angle to angle. This is because while models were photographed as a base for many things in Doom, the final sprites were heavily hand-pixeled by artists to look good as sprites and thus are not quite true to life in many cases.

Right now there's no simple process for this that doesn't involve basically re-drawing every frame from scratch to look good in 3D. I think this might be a good candidate for AI in the future though, if someone is able to train a neural net to reconstruct 3D objects from limited low resolution sprites. Something similar is already done with photogrammetry and image processing algorithms, though it typically requires a lot more data at high resolutions and dozens of angles to get usable results.

User avatar
User Accounts Assistant
Joined: 26 Feb 2004
Discord: Caligari87#3089
Github ID: caligari87

Re: Voxel Recovery

Postby Gez » Tue Feb 23, 2021 2:37 pm

Caligari87 wrote:This is because while models were photographed as a base for many things in Doom, the final sprites were heavily hand-pixeled by artists to look good as sprites and thus are not quite true to life in many cases.

Also, pretty sure the imp was entirely drawn -- they didn't make a model of the imp.
Joined: 06 Jul 2007

Re: Voxel Recovery

Postby Gwarl » Sat Feb 27, 2021 4:43 pm

Been doing some more work on this, and one can get a much better model with fewer artifacts by assembling a frame from four perspectives and disassembling it into corresponding pieces. Then, the opposite pieces, i.e. the front and back or left and right view can be superimposed over each other to match pixels, which fills in missing information and ensures that nothing is lost. These can then be composed into prisms using intersection, and the pixel colours from each perspective cast onto the model, and all the parts assembled together.

Here's the disassembled/superimposed baron. I've made a couple of adjustments to get the heights of each part to match up, some incorrectly in this example, and moved some things around, mostly the back view of the head to make the horns align, and an extra row of pixels on the bottom of the hooves

And here are screens of the assembled pieces from intermediate angles

There are still some obvious artifacts like the horns on the back of the head and the extra hand on the left arm, these can be removed fairly straightforwardly by carving up to the required depth, or could be avoided in the reconstruction by separating the hands and horns beforehand. The face could be carved using colour matching to add depth.

I think there is plenty of information in the sprites to work with. What I have here is made more or less directly from the sprite with a minimum of artistic input from myself and I think it could serve as a pretty decent basis for further improvement.
Joined: 22 Feb 2021
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: ATI/AMD (Modern GZDoom)

Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests