Extrude transparent background PNG to mesh

Turn 2D pictures to 3D meshes. I remember seeing something similar but I couldn’t seem to find it so I implemented this, hopefully somebody finds it helpful! The implementation isn’t perfect, though, these are the known issues.


Eyy I hope this isn’t rude, but I liked your app so much I made my own!

It was waay harder than I expected… and probably is still very buggy.

but you’re welcome to any of it you find useful…

Instead of InstancedMesh, I constructed the faces by rasterizing the alpha channel.
So now the things themselves can be instanced. :slight_smile:

I used single large faces for front and back, with alphaTest on the material and min/magFilter = NearestFilter to get the blocky pixels.
The sides are a face per pixel for exterior faces.
Theres some sizzle/cracking at the edge seams that looks hard to fix without doing a quad per pixel… I might make that an option… but it is what it is…

p.s.-btw your voxelize engine looks cool!


Thank you so much for sharing, it looks amazing! Any way to control the number of vertices or triangles it uses? like to add a cap.

This is amazing!!! Is there any chance this is open source? Would LOVE to learn how you did it! This will be such a performance boost, gonna hot replace with your implementation hahaha :))

1 Like

Ohhh I just saw the “Show Code” button, will be porting now :sunglasses:

1 Like

Nice! Lmk if you have questions or whatnot!

What would that look like if you hit a vertex limit? It’s kindof a fixed amount… you need a couple triangles per edge pixel, and 4 for front and back face. It’s not a super adaptive process…

Deployed and shipped to v0.0.7, online demo is here, thanks so much!

1 Like

hehe sick.

1 Like