[SOLVED] How do I correctly apply transparency and textures to my voxel models on Sketchfab?

Hello, I’m having trouble getting a voxel model to display a certain part as transparent and display textures correctly. The model is made in MagicaVoxel and this is the model:


This is a zombie snail. The green, red, and yellow parts make up the parasites.

What I’ve tried.

Method 1: I followed this guide - Sketchfab Community Blog - A complete guide to importing from MagicaVoxel to Sketchfab and, as mentioned in the tutorial, since some voxels are sharing the same face there are visible “holes” in the model. I did modify the model but soon found out I’d have to modify the parasite to a point that would defeat the purpose of making the parasite as big as it was. I did not (at this point) bake it.

Method 2: I then followed this tutorial - Sketchfab Community Blog - Tutorial: Creating a 3D Star Wars scene in voxels using MagicaVoxel, Blender and VoxelShop. I split my model into three parts (could have been two), the shell and parasites, the middle and eyestalks, and the little outline and “whiskers”, along with their corresponding palettes. I imported into Voxelshop to reduce the polycount and exported each of the three pieces as .dae, and imported into Blender. I did not bake the model (again, not at this point) because I didn’t think it applied to my model. I’m not “baking” any faces into my model, I have textures. I did Smart UV Project though.

There’s nothing about transparency in this tutorial, so I went to YouTube and watched two videos on making transparent textures in Blender 2.8. I got that to work and look how I wanted it to.

I then searched and watched two videos on baking textures in Blender 2.8. This didn’t work since I’m not backing faces or textures into my model. I did try looking for how to bake transparency into a model but nothing really comes up. I tried exporting it anyway. I’ve exported as a .OBJ and a .FBX and while I do get the middle and eyestalks to be transparent with changing the materials on Sketchfab, the shell and parasites have messed up textures:


I even changed the Texture from Trilinear to Nearest (minimap) similar to Blender’s setting (Which is “Closest”)

Method 3: I thought maybe I missed something, so I found and followed this guide - Sketchfab Community Blog - Publishing Voxel Designs from MagicaVoxel to Sketchfab. This didn’t have anything about transparency, but I thought I could apply the same process. I took my whole voxel model (before splitting it up), and took the palette with only the colors for the middle and eyestalks while the rest was black, applied the texture under the Opacity setting and I get this:


The whole model turned transparent.

What now?

I honestly have no idea how to get this working. I got really close with Method 2 but it’s not quite right. Am I missing something? Did I mess up a step? Is there a way to bake transparency into a model and if so how do I do it? I’ve been struggling with this for two days and I want to get this to work since I’m including it in my portfolio. Knowing how to make this model work will help with one or two other models I also want to include in my portfolio.

Thank you in advance,
Vel

1 Like

Hi Vel,

Do you just want to get the transparency to work? Or do you really want to optimize the model as well? (reduced poly count, create regular UV’s etc)

Phil

2 Likes

Hi Phil,

Can you tell or show me how to do it both ways so I know how to do this on my own with future models?

Thank you so much,
Vel

1 Like

I certainly can, Vel :slight_smile:

Transparency
For our purposes, the best way to think of Transparency is just a Greyscale image that determines how transparent parts of our model will be. Since the OBJ export in MagicaVoxel uses a palette texture to handle colours, we can use that to create a quick Transparency texture. Simply make a copy of your palette texture and open it in whatever image editor you like. Find the colour on the texture you used for the body of your snail and replace it with a Dark Grey, then fill the rest of the image with White. The darker the grey you use, the more transparent your snail will be - this might take some trial and error.

You can then upload your model with both textures, and assign this to the Opacity channel of your material. Also worth saying that when working with Transparency you’ll want to change the Face Rendering on the material to ‘Single Sided’ as well. Job done :slight_smile:

From reading your first post I can see that this might cause an issue with the shared internal faces used between the parasite and snail body. If this ends up being true, simply export the model twice - once with just the snail body, and once with the rest, then combine the models in any 3D editor. Since they all use the same palette it should be as simple as importing the 2 models and then exporting again as 1.

Optimizing and UV’s
For this I’m gonna point you towards a blog I wrote on this very subject - probably the only one you didn’t try so far :joy:

Don’t worry that I use 3D-Coat for part of it, that’s only for one step - to generate UV’s. You can easily find tutorials showing you how to do this part in Blender, but what matters is you import the ‘obj_mesh’ version of the model created in the tutorial, generate a UV map for it, and export it again as an OBJ file.

Everything else should still work fine after that, but I’m here to help if there are any problems or questions about anything :slight_smile:

Cheers,
Phil

2 Likes

Okay, so the transparency method worked with a little bit of tweaking! I did the dark grey trick with my palette but I still had to change the transparency with the slider on Sketchfab, and not by how dark the grey was. I don’t mind this since it works.

I also fixed the broken texture in picture three. Instead of splitting the model in MV, reducing polycount in VoxelShop, and then combing in Blender; I split the model in MV and went straight to combining in Blender. The Blender exported texture was broken but now I could use MV’s palettes I had exported for each piece. I couldn’t do this before.

Also yes, that was the only blog post I did try lol. I did try and got as far as clicking the apply button for textures to the meshes in Meshlab. I did it twice and it crashed both times. I have no idea why but the first method works, so I think I’m fine with this :joy: .

The final models look great!

1: https://skfb.ly/6Npon

2: https://skfb.ly/6NpoC

Thank you so much for your help, Phil! I really appreciate this. Now I can upload the last one or two transparent models for my portfolio :smile: .

2 Likes

Glad you got something working, it came out great Vel! :smiley:

And yes Meshlab can be weird sometimes, even in my blog I had to do a very specific export from 3D-Coat otherwise I’d get the same crash you’re seeing! My best guess is it’s something to do with how Meshlab reads the texture data from the MTL file… but I’ve never managed to figure out exactly why :nerd_face:

2 Likes