Slicer Fails

published 08/19/2024 • 2m reading time • 34 views

While working on my masked stereolithography slicer, mslicer, I ran into some visually interesting bugs while both slicing and rendering 3D models. This project was my first time working with 3D models or GPU rendering so there were a lot of bugs. Note that all of these bugs have been fixed at this point in development.

Rendering Fails

This was one of the first rendering bugs, because there was no depth buffer at this point, sometimes the back of the model would render over the front.


In an attempt to make the bottom grid, I somehow made this by using the screen position rather than the transformed vertex positions.


To be honest, not really sure whats going on here. Probably mixed up the vertex indexes of each face.


Similar to the last image, I must have messed up the face indexes.


When working on an option to show model normals, because they aren’t re-computed every frame when the model was removed the normals would stay making this ghost frog.


When updating the debug line render pipeline, somehow color data and position data got mixed up causing this mess.

Slicing Fails

This was one of my first attempts at converting a list of points (from intersecting a plane with the mesh) to an image with a polygon fill algorithm. Unfortunately my intersection algorithm still had some issues and the fill algorithm made really ugly lines.


Here I switched to a new system for filling polygons, for each row of the image I find intersecting points between the row of pixels and the lines in the polygon. As you can see though, the intersection algorithm was messed up.


Same as above, but slightly better. I was able to get it working later with more hacks that ended up being a pain later, but I didn’t really know what I was doing so its fine.


Here I am debugging the polygon fill algorithm I mentioned a few images ago. Every row has a random color so they are easy to tell apart, starts and ends of lines are marked red.


A debug image showing the points coming from the mesh/plane intersection, showing how bad the algorithm is.


This isn’t a fail but I thought it looked really cool and its nice to see the result of working intersection algorithms.


Honestly I dont remember what this is. Something bad must have happened while trying to encode or decode a goo file.


Even after fixing the previously mentioned intersection bugs, this was the first time I tried slicing a model with a large triangle count. With all the small triangles there were a lot of opertunites for edge cases.