mariolukas / openexposer

Open Exposer - Hardware, Slicer, Host, Firmware
67 stars 25 forks source link

Use bounding volume hierarchy to speed up slicer #8

Open cemonds opened 8 years ago

cemonds commented 8 years ago

The slicing algorithm does a bad job at the moment when intersecting the rays with the mesh triangles. This could be dramatically improved by using something like a bounding volume hierarchy or an octree to determine which triangles have to be checked for intersection. A first start could be this cross compiled python version of the original java code from http://thomasdiewald.com/blog/?p=1488. bvh.py.zip

DanielJoyce commented 8 years ago

I have a totally GPU based slicer I have been working on that only generates raster images, but the black and white images could be used to drive a scanline style laser printer very easily.

Is there any documentation on the structure g-code commands used to drive the actual printer? I assume Y and Z are fairly std, what about the laser line?

https://goo.gl/photos/9WXNBp7vEHuyTqBw8

I even have ideas on how to do shelling, including hollow pattern filled shells, and interior vs exterior supports via various slicing and other tricks. I thick I even have a method for automatic support generation.

There are no geometry calculations involved. It can be expanded to rafting as well.

cemonds commented 8 years ago

Right now there isn't any documentation besides the code. The g-code coordinates are relative with the origin being centered in the middle of the build platform. Distances are always in µm. The laser line g-code works as following:

  1. It moves relative to the next scan line in y direction with the command G01 Y;
  2. It sends each x coordinate where the laser is toggled as a single command G05 D; So for a line that spans from position -4000 to 2000 relative to the origin the following commands are send: G05 D-4000; G05 D6000;
  3. Starting the exposing process is done with the command G06 E; where cycles defines how many times this scanline is exposed.

The slicer right now uses just STLs and calculates the intersections of the scan line rays with all triangles of the stl mesh. No support generation is available at the moment, but it can be done with an external tool. It was more a proof of concept than a finished slicing tool. Using the GPU is an interesting idea. Have you some code one could take a look at?

DanielJoyce commented 8 years ago

Yes, yes I do. Its alpha.

https://goo.gl/photos/tbtD5fjcRpuH7Bwv5, play icon in upper right

https://github.com/DanielJoyce/microtome

Support generation and slicing all done via camera, shader, etc tricks. I also now have a decent idea on handling "Shelling" and support generation that properly handles unsupported areas during the print that the current simple scheme doesn't catch always.

sajjadul-wematter commented 8 years ago

I already have experience of implementing a whitted ray tracer using the bounding volume hierarchy in C++. I am also trying to use the very same concept(ray tracing) to do a uniform / adaptive slicing of 3D CAD model. Some references/hints will be very helpful.

Thanks