POV-Ray : Newsgroups : povray.tools.general : Do we have a linux-friendly mesh exporter? : Re: Do we have a linux-friendly mesh exporter? Server Time
20 Apr 2024 09:10:57 EDT (-0400)
  Re: Do we have a linux-friendly mesh exporter?  
From: Le Forgeron
Date: 26 Jan 2020 13:20:43
Message: <5e2dd87b$1@news.povray.org>
Le 24/01/2020 à 19:27, Bald Eagle a écrit :
> 
> Le_Forgeron <jgr### [at] freefr> wrote:
> 
>> I made a custom extension to import & export STL (as well as GTS).
>> As SDL is only able to handle text (and not binary file), it was not an
>> option.
> 
> I saw some search results regarding hgpovray38, but I didn't really "get" it.
> Don't we have the ability to read/write binary files in SDL?
> I was searching for a way to write GrADS data, and finally reminded myself that
> it was possible.
> http://wiki.povray.org/content/Reference:File_I/O_Directives
>   uint8              - unsigned byte (0..255)
>   sint8              - signed byte (-128..127)
>   uint16be, uint16le - unsigned 16-bit word (0..65535)
>   sint16be, sint16le - signed 16-bit word (-32768..32767)
>   sint32be, sint32le - signed 32-bit word (-2^31..2^31-1)
> 
Writing: yes. But reading ?

>> Problem with STL: there is 2 opposite specifications for colour, so I
>> just dropped that part too, only load & save the shape.
>>
>> OBJ specification is text, but not made only of triangle (you can have 4
>> points faces).
> 
> Well that's "easy enough" to grapple with - just use corners 1, 2 & 3, and 3, 4,
> & 1 to make 2 separate triangles.

I write code that I need, usually (I once wrote Nurbs support, only to
get no modeler at the end that would export raw nurbs data). I did not
need Obj support, whereas I was in need of STL (due to converting povray
object into real 3D printed object) and GTS (because the rabbit is so
lovely and the GTS collection was interesting).

Feel free to play with Obj if you need:
https://en.wikipedia.org/wiki/Wavefront_.obj_file

I was wrong above, a face has a minimum of 3 points, but no upper limit,
and you can encounter other elements (full spec in
http://www.martinreddy.net/gfx/3d/OBJ.spec )


> 
>> I also made an extension to be able to read back the data of a mesh, it
>> could be used to save it as mesh2 (but really, STL is faster if you can
>> cope with the constraint of being in the positive corner cube)
> 
> Huh.
> I got the impression from the documentation that mesh2 was "better" - so why is
> STL faster?

Ok, it depends on the number of points.
On reading:
Mesh2 is filled directly in pov structure, but each number need to be
parsed from its text form to binary.
STL is binary, so no parsing time, but the structure in memory need to
be searched as it grows to provide an efficient set of data for povray.

On writing: the speed is probably about the same.

> I'm impressed that you coded something up for mesh2 - I was mulling over how to
> do that, and it seemed like a lot of record-keeping to  know which triangles
> were which and what ones shared vertices....
> 

Mesh2 is an external representation of the internal "mesh" structure. It
is as raw as possible. Mesh is more natural description for the same
data, but it is slower to parse (the same way STL is) because additional
computations and searches must be performed to get into the "mesh"
structure.

>> Whatever, I use *meshlab* to convert between these formats (and perform
>> also other operations, including preview).
> 
> Yes, I think I stumbled across a link to meshlab.  I'll try to install that some
> time soon, as it a nice program for viewing and fixing meshes.
> 
>> Also, *makehuman* is a nice way to get mesh of human bodies if you
>> intend to have a set of Greek statues.
> 
> Hmmm.  IIRC that project was abandoned some time ago - I'll look and see if I
> can find the files for that.
> 
> 
> 

Please check http://www.makehumancommunity.org/

Seems still alive, as 1.2.0 alpha4 was announced on 16th December 2019.


Post a reply to this message

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