POV-Ray : Newsgroups : povray.general : How do you convert POV-Ray CSG shapes into other 3D formats? Server Time
30 Jul 2024 08:27:41 EDT (-0400)
  How do you convert POV-Ray CSG shapes into other 3D formats? (Message 5 to 14 of 24)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Urs Holzer
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 4 Feb 2010 07:30:38
Message: <4b6abdee$1@news.povray.org>
Hi

> Is there a way to convert POV-Ray's internal representation of a 3D
> shape (i.e. one constructed using CSG) into another 3D format -
> perhaps mesh or mesh2?

There are some C++ libraries that can do CSG using meshes:
GTS: http://gts.sourceforge.net/
OpenCSG: http://www.opencsg.org/
As far as I know, the second one cheats using some OpenGL features, 
whereas the first one really generates a mesh. Unfortunately, they are 
C++ libraries only, so you have to write your own application for your 
task. Together with an implementation of the marching triangles 
algorithm (as mentioned by Warp), you could do nearly everything:

First convert all primitives to isosurfaces. (Is that possible?) Then 
convert them to meshes. Finally do the CSG using the GTS.

It is really time that someone implements a Povray to Mesh converter 
which works for most scenes. Unfortunately, I do not have the time to 
start such a project.

Greetings
Urs


Post a reply to this message

From: Reuben Pearse
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 7 Feb 2010 17:26:51
Message: <4B6F3E31.4060408@pearse.co.uk>
Thanks for the comments so far.

After a quick look around I found this site that talks about the CAT() 
macro. This seems to do something similar in that is scans a "CSG" 
object. See the following for more details:
http://www.persistencia.org/CATHELP/CAT.html

I also found the following previous thread discussing this subject:
http://news.povray.org/povray.newusers/thread/%3Cweb.4acb6d8f90192b14fedfeaac0@news.povray.org%3E/

Are there any other macros/utilities/converters that I should be aware of?

Thanks in advance

Reuben


Warp wrote:
> Alain <aze### [at] qwertyorg> wrote:
>> You are not the first one to think of that.
>> There are macros that can convert most objects into a mesh equivalent.
>> The most notable is one to convert an isosurface into a mesh.
> 
>   AFAIK the best algorithm to convert an isosurface into a mesh is the
> so-called marching triangles algorithm (it's better than other tesselation
> algorithms because it is able to create more and smaller triangles in high
> curvature places and less and larger triangles in low-curvature places, and
> avoids extremely thin triangles; I think it also handles sharp edges much
> better than other algorithms, although I'm not completely sure of this).
> The same algorithm could probably be used with more or less success with
> CSG objects as well (although they have some pitfalls that isosurfaces
> don't have, as CSG objects need to be traced, which introduces its own
> problems, while isosurfaces just need to be evaluated).
> 
>   However, I have never heard of anyone actually going through the trouble
> of implementing the marching triangles algorithm for POV-Ray. So no such
> luck there.
>


Post a reply to this message

From: Warp
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 8 Feb 2010 01:56:47
Message: <4b6fb5ae@news.povray.org>
Reuben Pearse <reu### [at] pearsecouk> wrote:
> After a quick look around I found this site that talks about the CAT() 
> macro. This seems to do something similar in that is scans a "CSG" 
> object. See the following for more details:
> http://www.persistencia.org/CATHELP/CAT.html

  Creating smaller objects inside one larger object is a completely different
(and far more trivial) thing than tesselating an object (ie. converting it
into a triangle mesh).

-- 
                                                          - Warp


Post a reply to this message

From: scott
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 9 Feb 2010 06:27:19
Message: <4b714697@news.povray.org>
>  However, I have never heard of anyone actually going through the trouble
> of implementing the marching triangles algorithm for POV-Ray. So no such
> luck there.

I started to implement it in POV from some paper, but when different parts 
of the mesh needed to join back up again it never worked properly.  I 
couldn't figure out from the paper how to fix this, so gave up.  Attached is 
about as good as I got meshing a sphere using the algorithm (the next few 
steps after this started to screw up big time).


Post a reply to this message


Attachments:
Download 'marching triangles.jpg' (76 KB)

Preview of image 'marching triangles.jpg'
marching triangles.jpg


 

From: Warp
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 9 Feb 2010 10:35:06
Message: <4b7180aa@news.povray.org>
scott <sco### [at] scottcom> wrote:
> I started to implement it in POV from some paper, but when different parts 
> of the mesh needed to join back up again it never worked properly.  I 
> couldn't figure out from the paper how to fix this, so gave up.  Attached is 
> about as good as I got meshing a sphere using the algorithm (the next few 
> steps after this started to screw up big time).

  That indeed demonstrates (some of) the strengths of the marching triangles
algorithm: There are no thin triangles, and all the triangles are distributed
rather evenly.

  It would be pretty useful if someone could get it to work fully.

-- 
                                                          - Warp


Post a reply to this message

From: Alain
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 9 Feb 2010 14:18:59
Message: <4b71b523@news.povray.org>

>> However, I have never heard of anyone actually going through the trouble
>> of implementing the marching triangles algorithm for POV-Ray. So no such
>> luck there.
>
> I started to implement it in POV from some paper, but when different
> parts of the mesh needed to join back up again it never worked properly.
> I couldn't figure out from the paper how to fix this, so gave up.
> Attached is about as good as I got meshing a sphere using the algorithm
> (the next few steps after this started to screw up big time).
>
>
>

You try to connect each points to 6 other points.

You need to allow points to connect to less than 6 neigours. For the 
sphere, some points only connect to 5 others. Fore some other shapes, it 
can go down to 4 or 3 points. In some cases, a point may need to connect 
to 7 or even 8 or more points.

Try setting some angle or distance thresshold.


Alain


Post a reply to this message

From: B  Gimeno
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 9 Feb 2010 14:55:00
Message: <web.4b71bcde69aaf4d868afa570@news.povray.org>
Reuben Pearse <reu### [at] pearsecouk> wrote:
> Hi everyone,
>
> Is there a way to convert POV-Ray's internal representation of a 3D
> shape (i.e. one constructed using CSG) into another 3D format - perhaps
> mesh or mesh2?
>
> Would it possible to write a POV-Ray macro to scan the surface of an
> object and create mesh2 type co-ordinates (would the trace function be
> able to do this?)
>
> I'm just thinking it would be nice to be able to easily convert POV-Ray
> models to other formats :-)
>
> Thanks in advance
>
> Reuben
> reu### [at] pearsecouk

The relationship between the next link and this thread can be considered as very
subtle (at best), but can serve as inspiration to try another ways. I regret the
absence of more examples and the presence of syntactic and grammatical errors.

regards,
B. Gimeno

http://www.persistencia.org/CATHELP/CAT.html


Post a reply to this message

From: mone
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 10 Feb 2010 17:35:01
Message: <web.4b73342169aaf4dac681f860@news.povray.org>
"B. Gimeno" <bgi### [at] lycoses> wrote:

>
> The relationship between the next link and this thread can be considered as very
> subtle (at best), but can serve as inspiration to try another ways. I regret the
> absence of more examples and the presence of syntactic and grammatical errors.
>
> regards,
> B. Gimeno
>
> http://www.persistencia.org/CATHELP/CAT.html

Thanks for the link!
That cubic golfer guy looks quite cool and inspiring. I'll give this a try when
I have some time again to do some POV-Ray experiments :)
Does this warning "VERY VERY VERY IMPORTANT: Ignore or forget this section will
dramatically raise up the parsing time without obtain results" refer to section
5 or to section 5.1 ?

Best wishes,

Simone


Post a reply to this message

From: bgimeno
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 11 Feb 2010 14:48:42
Message: <4b745f1a@news.povray.org>
> Does this warning "VERY VERY VERY IMPORTANT: Ignore or forget this section 
> will
> dramatically raise up the parsing time without obtain results" refer to 
> section
> 5 or to section 5.1 ?

To Section 5. The inclusion of the keyword "inside_vector" is well 
peremptory, without which the process is perpetuated without result. Thanks 
for your comment.
Soon, Mr. Cubic will be published at a higher resolution on your favorite 
news server.

B. Gimeno

P.D. That you look like a man playing golf is a Poserguy playing in a 
Discobolo pose being misunderstood by my macro, with several boxes aligned 
to the vector determined by vector_inside


Post a reply to this message

From: Alain
Subject: Re: How do you convert POV-Ray CSG shapes into other 3D formats?
Date: 11 Feb 2010 23:02:50
Message: <4b74d2ea@news.povray.org>

>> Does this warning "VERY VERY VERY IMPORTANT: Ignore or forget this section
>> will
>> dramatically raise up the parsing time without obtain results" refer to
>> section
>> 5 or to section 5.1 ?
>
> To Section 5. The inclusion of the keyword "inside_vector" is well
> peremptory, without which the process is perpetuated without result. Thanks
> for your comment.
> Soon, Mr. Cubic will be published at a higher resolution on your favorite
> news server.
>
> B. Gimeno
>
> P.D. That you look like a man playing golf is a Poserguy playing in a
> Discobolo pose being misunderstood by my macro, with several boxes aligned
> to the vector determined by vector_inside
>
>

In that case, try changing the orientation of the inside vector.
If it was "inside_vector x" change to "inside_vector <1,0.1,0.1>"

The cause of your problem is probably that the inside_vector is parallel 
to some triangle of the mesh.


Alain


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 10 Messages >>>

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