POV-Ray : Newsgroups : povray.general : POVRay CSG to polygon based models Server Time
31 Oct 2024 23:28:10 EDT (-0400)
  POVRay CSG to polygon based models (Message 1 to 6 of 6)  
From: Matthias Weißer
Subject: POVRay CSG to polygon based models
Date: 24 Feb 2005 14:37:12
Message: <421e2ce8$1@news.povray.org>
Hi

I know this question comes from time to time but mine is more a general one:

I am the maintainer of Eagle3D which contains a set of electronic 
components which are all CSG.

To create a quick preview of the PCB I want to export these component 
(maybe as obj-file) and render them with openGL.

Now I have the problem how to convert the models. My first idea was to 
calculate the bounding box of every component and write them down to the 
obj file. This will be the easiest way because I can do this in pure POV 
SDL without any additional tool.

Second thougt was to create all the simple objects (box, sphere... ) 
outside any difference{} and intersection{} blocks and use them as basic 
shape in my objs. This will need some external programm but souldn't be 
to hard to implement but can produce bad results depending on how the 
component was designed.

Third and maybe because it was late I build up a concept which is maybe 
a bit crazy (it was really late when this came to my mind). Use POVRay 
as some sort of "3D Scanner" to create a cloud of points in 3D which 
then can later be triangulated and I have my mesh in a good quality 
depending on the resolution of the 3D Scanner. Is it possible to shoot a 
single ray into a scene from some given position and get back the 
position of the first hit of the ray and also the color at this point?

Thanks for reading and I hope to get some feedback on all my ideas.

-- 

mat### [at] matweide
http://www.matwei.de


Post a reply to this message

From: Matthias Weißer
Subject: Re: POVRay CSG to polygon based models
Date: 24 Feb 2005 14:47:36
Message: <421e2f58$1@news.povray.org>


> depending on the resolution of the 3D Scanner. Is it possible to shoot a 
> single ray into a scene from some given position and get back the 
> position of the first hit of the ray and also the color at this point?

OK. I have to answer myself. This is possible for the position and the 
normal of an object. Is it also possible to get the color or do I have 
to create a lot of images with 1x1 pixel in size?

-- 

mat### [at] matweide
http://www.matwei.de


Post a reply to this message

From: scott
Subject: Re: POVRay CSG to polygon based models
Date: 24 Feb 2005 17:30:22
Message: <421e557e$1@news.povray.org>
> Second thougt was to create all the simple objects (box, sphere... )
> outside any difference{} and intersection{} blocks and use them as
> basic shape in my objs. This will need some external programm but
> souldn't be to hard to implement but can produce bad results depending on 
> how
> the component was designed.

For this you would effectively have to write a parser for the POV SDL. 
Unless you've written all the SDL with just numbers for all the coordinates 
this would be quite some work.  Compared to that, writing code to do CSG 
operations on meshes would be easy.  (It's not that hard anyway)

Maybe you could patch the POV source somehow to output the raw coordinates 
of objects to your code, then it could create meshes etc.

Sounds like quite a job whatever you decide to do.

It might be quicker to redesign all the components as meshes from scratch.


Post a reply to this message

From: Christopher James Huff
Subject: Re: POVRay CSG to polygon based models
Date: 24 Feb 2005 20:38:56
Message: <cjameshuff-828850.20385124022005@news.povray.org>
In article <421e2f58$1@news.povray.org>,


> OK. I have to answer myself. This is possible for the position and the 
> normal of an object. Is it also possible to get the color or do I have 
> to create a lot of images with 1x1 pixel in size?

The color of an object depends on the direction the object is seen from 
and on the rest of the scene, and the scene isn't fully constructed when 
the file is still being parsed. So no, you can't get the color that way. 
If you have the pigment, you can evaluate its color instead, which is 
normally independent of viewing direction.

Another thing: generating a surface from a cloud of unconnected points 
is extremely difficult. It is actually impossible to do so perfectly, 
though simply using a large number of points can give good results in 
many cases. You would really be better off designing meshes for each 
component. This doesn't necessarily require a mesh editor, you could 
write code in POV that generates the meshes you need, as long as there 
aren't any difficult differences or intersections.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Tim Nikias
Subject: Re: POVRay CSG to polygon based models
Date: 24 Feb 2005 20:41:03
Message: <421e822f$1@news.povray.org>
> OK. I have to answer myself. This is possible for the position and the
> normal of an object. Is it also possible to get the color or do I have
> to create a lot of images with 1x1 pixel in size?

Depends. If your color is based upon some pigment, then yes, you'd have to
do the 1x1 image thing. If by color you want to know which object you've
hit, you can also just use trace() on the different objects, and sort the
results with whatever sorting you need.

BTW <shameless plug> I've just recently written a set of Macros entitled
"Surcoat Macros", which might do that point-cloud-thingy quite well
</shameless plug>. :-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Josh
Subject: Re: POVRay CSG to polygon based models
Date: 2 Mar 2005 06:58:33
Message: <4225aa69$1@news.povray.org>
Have a look at "CSG to Mesh" in p.t.s-f


Post a reply to this message

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