POV-Ray : Newsgroups : povray.newusers : Polyhedra -- intersections of planes or unions of faces? Server Time
24 Nov 2024 04:24:17 EST (-0500)
  Polyhedra -- intersections of planes or unions of faces? (Message 1 to 10 of 10)  
From: Garrett Baird
Subject: Polyhedra -- intersections of planes or unions of faces?
Date: 16 May 2010 03:20:00
Message: <web.4bef9bf9615269587ad077850@news.povray.org>
Hello all,
I've spent a bit of time googling but I've not been able to answer a rather
basic question:  I've got a scene that consists of around 300 polyhedra, each of
which is described by about 20 linear inequalities of the form ax + by + cz <=
d.  The faces of these polyhedra have different image maps that are being
applied to them.  Is it faster if I represent these polyhedra as a union of
faces, rather than an intersection of half planes?  Currently my scene is
rendering very slowly and I'd like to know if it's bad coding on my part or just
the way things work.

Thanks, GB


Post a reply to this message

From: Warp
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 16 May 2010 04:09:27
Message: <4befa837@news.povray.org>
Garrett Baird <the### [at] hotmailcom> wrote:
> Hello all,
> I've spent a bit of time googling but I've not been able to answer a rather
> basic question:  I've got a scene that consists of around 300 polyhedra, each of
> which is described by about 20 linear inequalities of the form ax + by + cz <=
> d.  The faces of these polyhedra have different image maps that are being
> applied to them.  Is it faster if I represent these polyhedra as a union of
> faces, rather than an intersection of half planes?  Currently my scene is
> rendering very slowly and I'd like to know if it's bad coding on my part or just
> the way things work.

  The most efficient way is to create a mesh (or mesh2) from your polyhedron.
You can apply individual textures to each triangle, so it's not a problem.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 16 May 2010 04:29:47
Message: <4befacfb$1@news.povray.org>
Am 16.05.2010 09:17, schrieb Garrett Baird:

> I've spent a bit of time googling but I've not been able to answer a rather
> basic question:  I've got a scene that consists of around 300 polyhedra, each of
> which is described by about 20 linear inequalities of the form ax + by + cz<=
> d.  The faces of these polyhedra have different image maps that are being
> applied to them.  Is it faster if I represent these polyhedra as a union of
> faces, rather than an intersection of half planes?  Currently my scene is
> rendering very slowly and I'd like to know if it's bad coding on my part or just
> the way things work.

Specifying a bounding box (using bounded_by) might help a lot, as 
POV-Ray will probably be unable to auto-generate bounding boxes for the 
polyhedra.

But, as Warp already noted, using a mesh would be the most efficient. 
(You might want to use a mesh instead of a mesh2 though; not that it 
makes any difference in speed - both use the same internal 
representation - but usually a mesh is easier to generate from SDL.)


Post a reply to this message

From: Garrett Baird
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 16 May 2010 16:50:00
Message: <web.4bf0596ac1a647be52b4b7440@news.povray.org>
Thanks to the two of you for the helpful advice.  I have a follow-up question on
the use of these image maps:  I have a total of 6 images that I'm going to use
for these image maps, which are photographs of this  object (the real object
that I'm attempting to render) from the front, back, top, bottom, and sides.
What I would like to do is:  for each face of each polyhedron, color that face
with the image map whose orientation is most compatible with that face.  For
instance, if my object is facing in the -z direction, if I have a face that is
most closely aligned with the xy plane, then I'd want to use either the front
picture or the back picture for the image map.  My question is:  is it efficient
enough to specify these image maps one-by-one for each triangle in the mesh, or
should I have a total of 6 meshes, each consisting of the set of all triangles
sharing a particular orientation (i.e. "all the triangles that are colored with
the front image, all the triangles that are colored with the top image", etc.)

Thanks!  GB

clipka <ano### [at] anonymousorg> wrote:
> Am 16.05.2010 09:17, schrieb Garrett Baird:
>
> > I've spent a bit of time googling but I've not been able to answer a rather
> > basic question:  I've got a scene that consists of around 300 polyhedra, each of
> > which is described by about 20 linear inequalities of the form ax + by + cz<=
> > d.  The faces of these polyhedra have different image maps that are being
> > applied to them.  Is it faster if I represent these polyhedra as a union of
> > faces, rather than an intersection of half planes?  Currently my scene is
> > rendering very slowly and I'd like to know if it's bad coding on my part or just
> > the way things work.
>
> Specifying a bounding box (using bounded_by) might help a lot, as
> POV-Ray will probably be unable to auto-generate bounding boxes for the
> polyhedra.
>
> But, as Warp already noted, using a mesh would be the most efficient.
> (You might want to use a mesh instead of a mesh2 though; not that it
> makes any difference in speed - both use the same internal
> representation - but usually a mesh is easier to generate from SDL.)


Post a reply to this message

From: Alain
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 16 May 2010 17:01:15
Message: <4bf05d1b@news.povray.org>

> Thanks to the two of you for the helpful advice.  I have a follow-up question on
> the use of these image maps:  I have a total of 6 images that I'm going to use
> for these image maps, which are photographs of this  object (the real object
> that I'm attempting to render) from the front, back, top, bottom, and sides.
> What I would like to do is:  for each face of each polyhedron, color that face
> with the image map whose orientation is most compatible with that face.  For
> instance, if my object is facing in the -z direction, if I have a face that is
> most closely aligned with the xy plane, then I'd want to use either the front
> picture or the back picture for the image map.  My question is:  is it efficient
> enough to specify these image maps one-by-one for each triangle in the mesh, or
> should I have a total of 6 meshes, each consisting of the set of all triangles
> sharing a particular orientation (i.e. "all the triangles that are colored with
> the front image, all the triangles that are colored with the top image", etc.)
>
> Thanks!  GB
>
> clipka<ano### [at] anonymousorg>  wrote:
>> Am 16.05.2010 09:17, schrieb Garrett Baird:
>>
>>> I've spent a bit of time googling but I've not been able to answer a rather
>>> basic question:  I've got a scene that consists of around 300 polyhedra, each of
>>> which is described by about 20 linear inequalities of the form ax + by + cz<=
>>> d.  The faces of these polyhedra have different image maps that are being
>>> applied to them.  Is it faster if I represent these polyhedra as a union of
>>> faces, rather than an intersection of half planes?  Currently my scene is
>>> rendering very slowly and I'd like to know if it's bad coding on my part or just
>>> the way things work.
>>
>> Specifying a bounding box (using bounded_by) might help a lot, as
>> POV-Ray will probably be unable to auto-generate bounding boxes for the
>> polyhedra.
>>
>> But, as Warp already noted, using a mesh would be the most efficient.
>> (You might want to use a mesh instead of a mesh2 though; not that it
>> makes any difference in speed - both use the same internal
>> representation - but usually a mesh is easier to generate from SDL.)
>
>
>
>

You can have one mesh per face, each with it's own image_map. You then 
combine the various faces toggether using an union.

You can also combine the various views into a single image and, using UV 
maping, have that image wrap around a single mesh.

You can also have a single mesh and apply different images to different 
areas.



Alain


Post a reply to this message

From: clipka
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 17 May 2010 06:05:29
Message: <4bf114e9@news.povray.org>
Am 16.05.2010 22:45, schrieb Garrett Baird:
> Thanks to the two of you for the helpful advice.  I have a follow-up question on
> the use of these image maps:  I have a total of 6 images that I'm going to use
> for these image maps, which are photographs of this  object (the real object
> that I'm attempting to render) from the front, back, top, bottom, and sides.
> What I would like to do is:  for each face of each polyhedron, color that face
> with the image map whose orientation is most compatible with that face.  For
> instance, if my object is facing in the -z direction, if I have a face that is
> most closely aligned with the xy plane, then I'd want to use either the front
> picture or the back picture for the image map.  My question is:  is it efficient
> enough to specify these image maps one-by-one for each triangle in the mesh, or
> should I have a total of 6 meshes, each consisting of the set of all triangles
> sharing a particular orientation (i.e. "all the triangles that are colored with
> the front image, all the triangles that are colored with the top image", etc.)

Using one single mesh for the polyhedron and specifying the texture on a 
per-triangle basis is probably the most efficient, regarding both memory 
consumption and speed.

Note that you need to #declare the textures to be used beforehand.

If your polyhedra all have the same shape and textures, it will also 
save a lot of memory to compute & #declare the polyhedron mesh only 
once, and place copies of it, but you may know this already.

On the other hand, if your polyhedra all have the same shape but 
different textures, the 6-meshes approach may be the most memory 
efficient, as it allows you to #declare only 6 meshes, and place copies 
of it with different textures - you can't do that with per-triangle 
textures.


Post a reply to this message

From: Warp
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 17 May 2010 07:38:42
Message: <4bf12ac1@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
> You can have one mesh per face, each with it's own image_map. You then 
> combine the various faces toggether using an union.

  That would be really inefficient and wouldn't benefit from mesh
optimizations at all.

> You can also combine the various views into a single image and, using UV 
> maping, have that image wrap around a single mesh.

  There's no need to do that.

> You can also have a single mesh and apply different images to different 
> areas.

  Honestly, I can't understand why that wasn't your *only* suggestion,
because the other ones don't make too much sense.

  Meshes have an efficient way of using predefined textures in individual
triangles or even individual vertices, so that's obviously the best way of
doing that.

-- 
                                                          - Warp


Post a reply to this message

From: Garrett Baird
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 18 May 2010 03:40:01
Message: <web.4bf2435ec1a647be77ad2a380@news.povray.org>
Thanks, fellows, for your helpful advice.  I've created a triangle mesh out of
the whole affair, and it consists of 50,000 triangles in total.  Is that an
exceptionally large number of triangles for a mesh, or is that a reasonable
amount?  I realize it's a vague question, but I'm just trying to get a sense of
what's "normally" done for projects of this type.

Thanks, GB

Warp <war### [at] tagpovrayorg> wrote:
> Alain <aze### [at] qwertyorg> wrote:
> > You can have one mesh per face, each with it's own image_map. You then
> > combine the various faces toggether using an union.
>
>   That would be really inefficient and wouldn't benefit from mesh
> optimizations at all.
>
> > You can also combine the various views into a single image and, using UV
> > maping, have that image wrap around a single mesh.
>
>   There's no need to do that.
>
> > You can also have a single mesh and apply different images to different
> > areas.
>
>   Honestly, I can't understand why that wasn't your *only* suggestion,
> because the other ones don't make too much sense.
>
>   Meshes have an efficient way of using predefined textures in individual
> triangles or even individual vertices, so that's obviously the best way of
> doing that.
>
> --
>                                                           - Warp


Post a reply to this message

From: Edouard
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 18 May 2010 04:00:00
Message: <web.4bf248f4c1a647be4af8cec0@news.povray.org>
"Garrett Baird" <the### [at] hotmailcom> wrote:
> Thanks, fellows, for your helpful advice.  I've created a triangle mesh out of
> the whole affair, and it consists of 50,000 triangles in total.  Is that an
> exceptionally large number of triangles for a mesh, or is that a reasonable
> amount?  I realize it's a vague question, but I'm just trying to get a sense of
> what's "normally" done for projects of this type.

50000 mesh triangles isn't huge - POV can cope with over a million just fine for
example.

Cheers,
Edouard.


Post a reply to this message

From: Warp
Subject: Re: Polyhedra -- intersections of planes or unions of faces?
Date: 18 May 2010 07:28:01
Message: <4bf279c1@news.povray.org>
Garrett Baird <the### [at] hotmailcom> wrote:
> Thanks, fellows, for your helpful advice.  I've created a triangle mesh out of
> the whole affair, and it consists of 50,000 triangles in total.  Is that an
> exceptionally large number of triangles for a mesh, or is that a reasonable
> amount?  I realize it's a vague question, but I'm just trying to get a sense of
> what's "normally" done for projects of this type.

  It's ok. It would be interesting to know if it helped with the rendering
speed.

  Whether making the entire group of polyhedra in single mesh, or whether
making each polyhedron a mesh, would be more efficient, is not a trivial
question. If most of the polyhedrons are identical, you could at least
save memory by making one mesh from one polyhedron and then instantiating
it around, which might affect rendering speed as well.

-- 
                                                          - Warp


Post a reply to this message

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