0
\$\begingroup\$

As sugested by another kind user, I started using MagicaVoxel to create the scenery for my game (which is in the 2.5D style of Pokémon Gen 5 or Octopath Traveler).

I managed to import the test object that I made into Blender (actually it was a .ply export so i could have all the blocks be individually shown).

Now my question is, how can I unwrap and texture 1 of the blocks and replicate this to all of them? (Is this even feasible?)

My test structure

I want to apply textures similar to the blocks in Minecraft for example.

Similar to this

\$\endgroup\$
  • \$\begingroup\$ Treating your voxel structures as mesh assets might not be the most efficient route here. As a mesh each cube needs up to 24 vertices, each with 8 floating point numbers to specify its position, normal direction, and UV coordinates. That's 768 bytes per voxel, and most of that information is unsurprising (the same pattern of vertices repeats for every voxel). The real payload is just "what kind of block goes here" and you could store that with as little as a single byte, where 0 = no block, 1 = dirt, 2 = grass, etc. MagicaVoxel's rsvo format might be a better intermediate for your needs. \$\endgroup\$ – DMGregory Nov 16 '19 at 3:13
  • \$\begingroup\$ Oh, yes! That's definately something that i was looking for but i didn't know the name until now. SVO, only the faces that are showing up are computed, right? Now, i don't really know how to do this in MagicaVoxel yet, but i'm googling it right this moment! You helped me a lot, thanks! \$\endgroup\$ – 94matheus Nov 16 '19 at 3:48
  • \$\begingroup\$ No, that's hidden surface elimination. Sparse Voxel Octree means storing a voxel model in a hierarchical format that lets you say "this whole 8x8x8 chunk is all dirt" without storing hundreds of individual dirt cubes to fill it. Within your game you can read your voxel data and build a mesh on the fly that excludes the invisible faces, and even compute the UV coordinates on demand so you don't have to fuss with unwrapping it manually, using an algorithm like the one I sketch here. \$\endgroup\$ – DMGregory Nov 16 '19 at 3:54
  • \$\begingroup\$ Oh, okay! I think i get it now. I'll study your code right there so i can come up with a solution. Again, thanks for the help! \$\endgroup\$ – 94matheus Nov 16 '19 at 4:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.