POV-Ray : Newsgroups : povray.binaries.images : 3-D printing any type of POV-ray object Server Time
5 Nov 2024 12:41:33 EST (-0500)
  3-D printing any type of POV-ray object (Message 1 to 10 of 18)  
Goto Latest 10 Messages Next 8 Messages >>>
From: Kenneth
Subject: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 15:25:00
Message: <web.655527ca7165e2419b4924336e066e29@news.povray.org>
Very recently, I bought my first 3D-printer-- a 'Creality Ender 3 v3 SE' desktop
model. It's an easy-to-use and nicely-made inexpensive machine at about $200 US,
for printing with the usual PLA plastic. Of course, one of my main reasons for
getting it was to finally print some of my POV-ray models.

And that presents a problem: 3-D printers need the model to be converted to the
...stl file format (or .step format, which is similar.)  These are triangle-mesh
representations of one kind or another. POV-ray does not have an in-built .stl
converter-- and there is no app (that I know of?) that can import a POV-ray
model constructed from its mathematical primitives-- boxes, spheres, cylinders,
torii, etc-- and convert it to triangles and then to .stl.

But there IS a way around this bottleneck, which works very well! A
medical-grade CT-scan viewing app called '3D slicer' is the key to the process--
 for converting a series of 'sliced' images of the object (rendered in POV-ray)
to a reconstructed 3-D model and then to an .stl file for 3-D printing. (The
rather generic name of this app is unfortunate, which kind of complicates the
explanation of the entire process.) I briefly mentioned the basics of the idea
in an earlier off-topic post. Please read it first...

https://news.povray.org/povray.off-topic/thread/%3Cweb.652f11c459a094fa9b4924336e066e29%40news.povray.org%3E/

This 'slicing' idea occured to me in a strange way: I had a medical emergency
earlier this year and a CT-scan was required, the first one I have ever had. I
was shown the scan, which is essentially a series of 2-D image slices that play
back in depth. Curious person that I am,  I had the idea of wanting to view this
 scan on my home computer if I could get the file from the hospital. So I
started researching the various medical-grade viewing apps for CT scans that
might be available to the public and that would run on my Windows machine.

I came across this  very complicated-looking professional '3D slicer' app, which
is supposed to be one of the easier ones to use... for radiologists and hospital
techs, at least!  Amazingly, it's FREE  to download, for Windows, Mac OS and
Linux.  The one thing that caught my eye was the list of file formats that it
can import-- including a series (or 'stack') of .png or  .jpeg images, which was
a surprise; and it can export an .stl file for 3-D printing. Take a brief
look...

https://www.slicer.org/

(This app is not to be confused with the 'slicing' software that 3-D printers
use, like Ultimaker Cura; such apps are the required last step before printing,
to convert the .stl file into .gcode instructions for the printer motors.)

This '3D slicer' app's capabilities immediately gave me the idea of
'pre-slicing' a complex POV-ray model as a series of rendered slice images via
animation (using an intersection of a thin box object), to import into the app
to see what the results might be. I chose to make solid white object-slices
against black, which seemed to be the intuitive way to do it. I am sure that
other users here have had the same general thought of such a slicing process,
but 'putting all the processes together' was perhaps difficult or mysterious to
work out. And this  app is not exactly user-friendly, along with a somewhat
non-standard menu interface. The online user manual does not explain the exact
steps required either. But once I got everything to work together, the results
turned out to be quite spectacular! Only a very few of the app's features need
to be used.

Simply stated: Any complex object that can show up in the intersected slices can
be printed.  This eliminates the need for using the alternative
trace/point-cloud approach, and also reproduces features that such an approach
might miss. Much to my surprise, the POV-ray slicing process is not very
demanding: I have gotten *very* good printed-model results with 400 slices at
800 X 800 pixels. And the great thing about POV-ray primitive shapes is that
they have 'infinite' resolution, unlike mesh or mesh 2 objects.

You might think that this slicing technique would introduce oddities or moire
patterns in the final printed model, when combined with the 3-D printer's final
'slicing' software; but that does not happen (in general)-- because '3D slicer'
interpolates between the slice images to create voxels, producing smooth
connected surfaces. Its own 3-D preview does not show that very well though.

The image collage posted here is just a demonstration, to show that it works. I
chose a model that I made years ago, composed of all kinds of different parts--
including some bicubic patch objects made in an *old* program called sPatch that
did not reproduce well as POV-ray slices; that's probably the one limitation of
the process. Those parts show up as infinitely-thin shells.

I would not actually attempt to 3D-print this model as-is. It would need many
'supports' to hold up the overhanging sections, and the initial slice images
were made too low-rez (my mistake). So, I re-sliced and printed just a part of
the model at 1200 X 1200 rez, 400 frames or slices-- which was actually
overkill! This section of the  model was constructed of primitive shapes only,
and shows how successful the process can be. (By the way: The processing in '3D
slicer' results in a HUGE model when it shows up in the Cura printer software;
it has to be scaled down to fit even my printer's max volume-- which has the
excellent effect of reducing the size of the triangles in the .stl triangle
mesh, greatly improving the printed quality.)

I am presently working on a a step-by-step guide to the '3D slicer' settings
required, which I will post, probably as a series of screenshots with
explanations. The process is actually NOT complicated, once the few steps are
learned. Most of  the app's  many specialized and mysterious features can be
ignored.


Post a reply to this message


Attachments:
Download 'pov_to_3d_printer_demo_kw.jpg' (1402 KB)

Preview of image 'pov_to_3d_printer_demo_kw.jpg'
pov_to_3d_printer_demo_kw.jpg


 

From: William F Pokorny
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 15:54:02
Message: <65552fea$1@news.povray.org>
On 11/15/23 15:21, Kenneth wrote:
> Very recently, I bought my first 3D-printer-- a 'Creality Ender 3 v3 SE' desktop
> model.

Very cool! Thanks for posting details.

Bill P.


Post a reply to this message

From: Bald Eagle
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 16:35:00
Message: <web.6555391231a5d0e01f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

Yes, very cool, glad you're figuring all this out well.
I've played with this slicing method at least 10 y ago.
https://news.povray.org/povray.binaries.images/thread/%3Cweb.5201a355ba23818d45338b700%40news.povray.org%3E/

One thing I thought of is:  if you use the object pattern, then you can just
slide or scale or reproportion a box that's pigmented with the object pattern,
and you'll get a nice image without having to do any "slicing" by differencing
and actual slice.

> The image collage posted here is just a demonstration, to show that it works. I
> chose a model that I made years ago, composed of all kinds of different parts--
> including some bicubic patch objects made in an *old* program called sPatch that
> did not reproduce well as POV-ray slices; that's probably the one limitation of
> the process. Those parts show up as infinitely-thin shells.

You can probably use the "thickening" trick in Mike Williams' Isosurface
Tutorial:
Thickening
If we have a function F(x,y,z) we can turn it into two parallel surfaces by
using abs(F(x,y,z))-C where C is some
small value. The original function should be one that works with zero threshold.
The two resulting surfaces are
what you would get by rendering the original function with threshold +C and -C,
but combined into a single
image. The space between the two surfaces becomes the "inside" of the object. In
this way we can construct
things like glasses and cups that have walls of non-zero thickness.


(Of course, you'd have to render the bicubic patch as an isosurface... ;) )

> ... Cura printer software;
> it has to be scaled down to fit even my printer's max volume-- which has the
> excellent effect of reducing the size of the triangles in the .stl triangle
> mesh, greatly improving the printed quality.)

And there, my friend, you have just discovered a way to make a mesh from a bunch
of primitives.
Get your slices, make your model, export an ASCII stl file, and then convert it
to a mesh {}.

Next thing you know, you're going to be using that Creality to make something
really neat and exciting ... like analytical circle tangents or something.

https://defdist.org/
https://defcad.com/

"3D printer go BRRRRRR!!!!"

- BW


Post a reply to this message

From: Cousin Ricky
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 17:40:00
Message: <web.655547d831a5d0e060e0cc3d949c357d@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> The image collage posted here is just a demonstration, to show that it works. I
> chose a model that I made years ago, composed of all kinds of different parts--
> including some bicubic patch objects made in an *old* program called sPatch that
> did not reproduce well as POV-ray slices; that's probably the one limitation of
> the process. Those parts show up as infinitely-thin shells.

I see you've upgraded the police car engines to the newfangled RISE open-rotor
model.


Post a reply to this message

From: Kenneth
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 22:30:00
Message: <web.65558b1c31a5d0e09b4924336e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
>
> One thing I thought of is:  if you use the object pattern, then you can just
> slide or scale or reproportion a box that's pigmented with the object pattern,
> and you'll get a nice image without having to do any "slicing" by differencing
> an actual slice.

Ah yes! I had forgotten about that. My past use of the object pattern was
exclusively for creating *volumetric* media; but of course, it can be used as
you mention, by having a thin surface intersect it, then simply moving the
surface through the object-pattern's volume.

Alas, none of my old bicubic-patch objects even show up when given the
object-pattern treatment; they are ignored by the pattern. Which is no worse
than my present situation with those objects! (I have since learned NOT to use
them in POV-ray-- even though they render OK *as* objects in a typical scene.)
But the object pattern also has the interesting(?) ability to show flaws in
triangle-mesh objects-- like holes, or an un-closed mesh-- that otherwise don't
show up in a typical render. I discovered this by accident during some old media
experiments. (The image below illustrates this.) The bunny model renders fine as
a typical object; but when used as an object pattern, the holes(?) in the bottom
are picked up and proudly displayed! The direction of those errant rays is the
same as the bunny mesh's inside_vector direction.

But my 'image slicing' technique (with the intersected box) fares no better-- it
*also* picks up such mesh flaws, for reasons unknown. This is apparently an
unexpected(?) result of the simple intersection process itself. Obviously, any
mesh object used in my 'slice' technique needs to be free of flaws.

>
> > ..in Cura printer software--
> > it has to be scaled down to fit even my printer's max volume-- which has the
> > excellent effect of reducing the size of the triangles in the .stl triangle
> > mesh, greatly improving the printed quality.
>
> And there, my friend, you have just discovered a way to make a mesh from
> a bunch of primitives.
> Get your slices, make your model, export an ASCII stl file, and then
> convert it to a mesh {}.
>

A great idea! (Although, I don't know the intricacies or re-coding strategy for
the .stl --> mesh conversion; I think you mentioned elsewhere that you came up
with such a process in the past?)

Oh, and unfortunately, the '3D slicer' app outputs its .stl file in only the
binary format; no choice of an ASCII version there  :-(  So far, anyway... but
the developers are always adding new features to the app, from user feedback...


Post a reply to this message


Attachments:
Download 'triangle_mesh_oddities_kw.jpg' (34 KB)

Preview of image 'triangle_mesh_oddities_kw.jpg'
triangle_mesh_oddities_kw.jpg


 

From: Kenneth
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 22:50:00
Message: <web.6555909a31a5d0e09b4924336e066e29@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
>
> I see you've upgraded the police car engines to the newfangled RISE open-rotor
> model.

Yes indeed! :-) With titanium blades coated with top-secret nanotechnology
stuff. Too government-classified to explain here...


Post a reply to this message

From: Bald Eagle
Subject: Re: 3-D printing any type of POV-ray object
Date: 15 Nov 2023 23:30:00
Message: <web.65559a1331a5d0e01f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> A great idea! (Although, I don't know the intricacies or re-coding strategy for
> the .stl --> mesh conversion; I think you mentioned elsewhere that you came up
> with such a process in the past?)

https://paulbourke.net/dataformats/stl/

solid
   :
   :
   facet normal 0.0 0.0 1.0
   outer loop
      vertex  1.0  1.0  0.0
      vertex -1.0  1.0  0.0
      vertex  0.0 -1.0  0.0
   endloop
   endfacet
   :
   :
endsolid


https://wiki.povray.org/content/Reference:Mesh

MESH:
  mesh {
  triangle {
    <Corner_1>,
<Corner_2>,
<Corner_3>
    }

So it's just a matter of read, discard, find/replace/rename.


Post a reply to this message

From: jr
Subject: Re: 3-D printing any type of POV-ray object
Date: 16 Nov 2023 00:50:00
Message: <web.6555acff31a5d0e0f11225116cde94f1@news.povray.org>
hi,

"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> > A great idea! (Although, I don't know the intricacies or re-coding strategy for
> > the .stl --> mesh conversion; I think you mentioned elsewhere that you came up
> > with such a process in the past?)
> ...
> So it's just a matter of read, discard, find/replace/rename.

alternatively, you could take my 'stl2gts' and edit to output mesh[2] directly,
instead.  fwiw, I'd prefer via GTS as it will allow manipulation of the
(intermediate) data.  ;-)

<https://news.povray.org/web.5e75678e7c21754451952ca0%40news.povray.org>


regards, jr.


Post a reply to this message

From: Kenneth
Subject: Re: 3-D printing any type of POV-ray object
Date: 16 Nov 2023 13:10:00
Message: <web.65565a1031a5d0e09b4924336e066e29@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> >
> > So it's just a matter of read, discard, find/replace/rename.
>
> alternatively, you could take my 'stl2gts' and edit to output mesh[2] directly,
> instead.  fwiw, I'd prefer via GTS as it will allow manipulation of the
> (intermediate) data.  ;-)
>
> <https://news.povray.org/web.5e75678e7c21754451952ca0%40news.povray.org>
>

For those who don't know what GTS is (like me!), see this link. I'm just a lowly
Windows user, ha, with no Linux experience. I had to look it up. ;-)

https://occam.cs.pitt.edu/QmWKxta8pD5wrK76F1J2iRRP2kUwzZph5hqGRpCB6Vjpeq


Post a reply to this message

From: Kenneth
Subject: Re: 3-D printing any type of POV-ray object
Date: 16 Nov 2023 14:30:00
Message: <web.65566c8031a5d0e09b4924336e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> Oh, and unfortunately, the '3D slicer' app outputs its .stl file in only the
> binary format; no choice of an ASCII version there  :-(  So far, anyway... but
> the developers are always adding new features to the app, from user feedback...

Since I am so new to this .stl and 3-D printer stuff, I *just* discovered that a
binary .stl file can be easily converted to a human-readable ascii TEXT file
(should you want to.) I used Audodesk's free (but no longer supported)
'Meshmixer' app for the conversion. There are probably other apps that can do
the same. Even though the file still has the .stl file type appended, it can be
opened by most(?) simple text editors, even POV-ray. I used Windows' simple
Wordpad app.

The text-file version is much larger than it's equivalent binary file, about 5X
larger. My CURA printer software can open both types.


Post a reply to this message

Goto Latest 10 Messages Next 8 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.