POV-Ray : Newsgroups : povray.general : QUESTION: STL to POV (INC)? : Re: QUESTION: STL to POV (INC)? Server Time
25 Apr 2024 23:03:30 EDT (-0400)
  Re: QUESTION: STL to POV (INC)?  
From: clipka
Date: 27 Jul 2017 05:39:42
Message: <5979b4de$1@news.povray.org>
Am 27.07.2017 um 08:45 schrieb Sven Littkowski:
> Hi, there is the NASA 3D Resources website, offering various vehicles
> and planetary landscapes as 3D models, formats OBJ and STL.
> 
> 1. Is there any OBJ to POV converter?
> 
> 2. I tried to convert the Martian and Lunar landscapes (STLs) to the
> POV-Ray format, using STL2POV:
> command line: "stl2pov -s InputFile.stl >OutputFile.inc".
> It reads STL files, and creates a POV-Ray mesh and saves that file as
> INC. But the result is horrible: instead of a block with a planetary
> surface, I get a block on the one side and a thin surface on the other
> side (90° angle!), and there are many holes in that landscape. Is there
> any better way to convert STLs into POV? I need a massive block with the
> landscape above, as I want to "dig tunnels" into it, too.

The mesh files provided by NASA are certainly just the surface, and
since it's not the entire planet but just a tile (or so I guess),
turning it into a solid 3D volume isn't trivial. You'll need to proceed
as follows:

(1) Generate the mesh INC file.

At this point, all you have is a mesh patch object, i.e. a genuinely
non-solid sheet.

(2) To the mesh, add an `inside_vector` specifying whatever direction is
supposed to be "up" with respect to the tile.

At this point, you have a chimera between a solid and a patch: It now
has a well-defined inside (namely every point that is "below" the tile,
i.e. the tile extruded "downwards" toward infinity). The surface
definition is still patchy though (pun intended), so right now you won't
see any effect, because POV-Ray can only render surfaces, not volumes.

Note however that this chimera is already good enough to start "digging"
using CSG.

(3) Intersect the mesh with another object, e.g. a box, defining the
dimensions of the "massive block" you want.

Make sure that for any point on the box that is supposed to be "below"
the landscape, if you trace a line in the direction given by the
`inside_vector`, it should properly intersect the mesh (note that
grazing it might not be enough).

This step will add surfaces to the "sides" and the "bottom" of your
block of landscape, so that they can be seen as well. If that's not a
thing you need, this third step is entirely optional.


Post a reply to this message

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