POV-Ray : Newsgroups : povray.newusers : CSG shape with many 'holes' takes *forever* to render! Server Time
3 Nov 2024 03:00:02 EST (-0500)
  CSG shape with many 'holes' takes *forever* to render! (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Fuzzy
Subject: CSG shape with many 'holes' takes *forever* to render!
Date: 30 Jul 2003 15:00:01
Message: <web.3f28155bfd97fdff403117160@news.povray.org>
Hi,

I've created a cylinder with a difference taken from it of many smaller
cylinders to punch 'holes' into the surface and it takes *forever* to
render...
at quality 1 it took just over 7 HOURS to render a very simple image at only
640x480!  (this is using 676 cutout cylinders to make 1352 'holes', as the
smaller cylinders were extended larger than the diameter of the main
cylinder to require half as many :)

I've started another run at quality 9... it's taken 6 hours so far and is
only up to line 99 of 480...

I know that CSG is slow but... :)

I think if I did the 'holes' as a texture map instead then it would be a LOT
faster, but is there any way to create a texture on the fly within pov,
rather than having to create some jpg or other to use as a filter?

(I want to be able to do it on the fly as I want to be able to change the
shape of the holes, cylinders was only going to be the start...)

Fuzzy


Post a reply to this message

From: Mike Williams
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 30 Jul 2003 16:06:06
Message: <tEcHfBAkRCK$EwRi@econym.demon.co.uk>
Wasn't it Fuzzy who wrote:
>Hi,
>
>I've created a cylinder with a difference taken from it of many smaller
>cylinders to punch 'holes' into the surface and it takes *forever* to
>render...
>at quality 1 it took just over 7 HOURS to render a very simple image at only
>640x480!  (this is using 676 cutout cylinders to make 1352 'holes', as the
>smaller cylinders were extended larger than the diameter of the main
>cylinder to require half as many :)
>
>I've started another run at quality 9... it's taken 6 hours so far and is
>only up to line 99 of 480...
>
>I know that CSG is slow but... :)
>
>I think if I did the 'holes' as a texture map instead then it would be a LOT
>faster, but is there any way to create a texture on the fly within pov,
>rather than having to create some jpg or other to use as a filter?
>
>(I want to be able to do it on the fly as I want to be able to change the
>shape of the holes, cylinders was only going to be the start...)
>
>Fuzzy


If you ever try to construct an object that has a lot of holes in
POVRay, you'll find that it renders incredibly slowly. My Holes Tutorial
attempts to explain why this happens and suggests something that you
might be able to do about it.

<http://www.econym.demon.co.uk/holetut/>

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: JC (Exether)
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 31 Jul 2003 05:09:40
Message: <3F28DCD3.5090201@spam.fr>
Waooww !!
I knew your great isosurface tut, but I hadn't seen the others !!
This hole tutorial is very clear and usefull, I think I'll redesign my 
menger sponge now.
The alpha shadows is also a question I thought about for a few weeks ...
Thanks a lot,

JC

Mike Williams wrote:
> Wasn't it Fuzzy who wrote:
> 
>>Hi,
>>
>>I've created a cylinder with a difference taken from it of many smaller
>>cylinders to punch 'holes' into the surface and it takes *forever* to
>>render...
>>at quality 1 it took just over 7 HOURS to render a very simple image at only
>>640x480!  (this is using 676 cutout cylinders to make 1352 'holes', as the
>>smaller cylinders were extended larger than the diameter of the main
>>cylinder to require half as many :)
>>
>>I've started another run at quality 9... it's taken 6 hours so far and is
>>only up to line 99 of 480...
>>
>>I know that CSG is slow but... :)
>>
>>I think if I did the 'holes' as a texture map instead then it would be a LOT
>>faster, but is there any way to create a texture on the fly within pov,
>>rather than having to create some jpg or other to use as a filter?
>>
>>(I want to be able to do it on the fly as I want to be able to change the
>>shape of the holes, cylinders was only going to be the start...)
>>
>>Fuzzy
> 
> 
> 
> If you ever try to construct an object that has a lot of holes in
> POVRay, you'll find that it renders incredibly slowly. My Holes Tutorial
> attempts to explain why this happens and suggests something that you
> might be able to do about it.
> 
> <http://www.econym.demon.co.uk/holetut/>
>


Post a reply to this message

From: Fuzzy
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 31 Jul 2003 05:10:01
Message: <web.3f28dc24e5126b67403117160@news.povray.org>
Mike Williams wrote:
>If you ever try to construct an object that has a lot of holes in
>POVRay, you'll find that it renders incredibly slowly. My Holes Tutorial
>attempts to explain why this happens and suggests something that you
>might be able to do about it.

Ooh, thanks... but (since I hit google for a day or two before asking in
here ;) I'd already read that page and I don't think it'd help me much in
this particular case unfortunately.

The example you give works fine for boxes with holes in, as they can be
bounded, but for a cylinder the only bounding that can be done is across
the whole shape IIRC.

Since I know that using CSG to cut holes is slow I was trying to find a way
to 'cheat' instead and to get the same effect but using a texture, if it's
possible (which it must be, *anything* is possible in POV one way or
another ;)

The only way I found out was to use an image with the 'hole' drawn in the
alpha channel and then repeatedly map that where I want it, but I want the
ability to alter the shape of the holes without having to have loads of
jpegs pre-drawn :(

Fuzzy


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 31 Jul 2003 06:17:59
Message: <3f28ecd7@news.povray.org>
Even if you slice your cylinder into pieces,
POV-Ray will only have to check that piece
in a certain area of the image. So, instead
of one long cylinder, do several shorter
ones. I'm not sure if slicing it like a cake
would do any additional good. But the smaller
the object is that POV-Ray has to test,
the less time it will spend sorting through all
difference/intersection tests that were made
on the entire object.

That's the whole point of the idea of using
several objects instead of one large object
with tons of CSG.

Regards,
Tim

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights

> >If you ever try to construct an object that has a lot of holes in
> >POVRay, you'll find that it renders incredibly slowly. My Holes Tutorial
> >attempts to explain why this happens and suggests something that you
> >might be able to do about it.
>
> Ooh, thanks... but (since I hit google for a day or two before asking in
> here ;) I'd already read that page and I don't think it'd help me much in
> this particular case unfortunately.
>
> The example you give works fine for boxes with holes in, as they can be
> bounded, but for a cylinder the only bounding that can be done is across
> the whole shape IIRC.
>
> Since I know that using CSG to cut holes is slow I was trying to find a
way
> to 'cheat' instead and to get the same effect but using a texture, if it's
> possible (which it must be, *anything* is possible in POV one way or
> another ;)
>
> The only way I found out was to use an image with the 'hole' drawn in the
> alpha channel and then repeatedly map that where I want it, but I want the
> ability to alter the shape of the holes without having to have loads of
> jpegs pre-drawn :(
>
> Fuzzy
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18.07.2003


Post a reply to this message

From: Fuzzy
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 31 Jul 2003 07:35:01
Message: <web.3f28fe77e5126b67403117160@news.povray.org>
OK... just done a few tests and I *can* create what I want for this
particular instance quickly using a gif with a plain background and the
holes drawn on it and used as a transparent texture map... fine...

now I just need to find a way to automate that within pov... isn't there a
way for POV to 'pre-render' something into memory that it can refer to
instead of referring to a gif on file?

I've read all the docs last week and have a vague recollection of thinking
there was something like that mentioned *somewhere* in there, but I can't
find it just now... will continue looking...

If I can get POV to create the image that will be mapped on the fly then
that would be perfect (and hopefully I don't want to use a temporary file
inbetween either)

Thanks for the help so far, hopefully someone might know what I'm wittering
on about though... :)

Fuzzy


Post a reply to this message

From:
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 1 Aug 2003 01:08:03
Message: <3f29f5b3$1@news.povray.org>
/*

Hi Fuzzy

> If I can get POV to create the image that will be mapped on the fly then
> that would be perfect (and hopefully I don't want to use a temporary file
> inbetween either)

(1) You will need a temporary file

(2) You should be happy about this: else the map(s) would have to be
    recalculated at every test render, even if they don't change.

(3) It's possible to achieve such an on-the-fly creation of the maps
    with a little animation that first creates the map(s), then uses
    them in the last frame of the animation (which is the final result).
    The code is like this: (3 maps in this example)

      #switch (frame_number)
        #case (1)
          // code for first map goes here
          #break
        #case (2)
          // code for second map goes here
          #break
        #case (3)
          // code for third map goes here
          #break
        #else
          // code for the final image goes here; the maps created in
          // the previous frames can be used here
        #end

    The main disadvances of this method are:
    - all files have the same size and type
    - the quality settings, antialias parameters etc. are the same
      for all these files

(4) Using maps for holes doesn't create correct shape, shadows and
    reflections of the walls in the holes. Animation with realistic
    deep holes is impossible.

(5) CSG isn't as slow as you think! I've made a cylindrical sieve with
    FIVE THOUSAND holes. They required less than 26 MINUTES for 640*480
    at 933 MHz, although I used +A0.1 +SP8 +EP8. Your 1352 holes were done
    in only 2 minutes 18 seconds. See code below. For test renders, the
    number of holes can be reduced by lowering Rings and/or Sectors. So I
    can't see any reason not to use CSG. Random placement within the rings
    also is no problem, but additional vertical variation can be difficult
    (depending on density and randomness of the placement).


   Sputnik


*/


// beginning of code

// Cylinder with holes

// +SP8 +EP8 -FN +A0.1 +W640 +H480


#declare Rings = 50; // or 26; 26*52=1352
#declare Sectors = 100; // or 52; // must be even; >=4
#declare Height = 300; // height of cylinder
#declare Radius = 100; // radius of cylinder
#declare Thick = 3; // thickness of wall of cylinder
#declare Hole = 2.5; // radius of holes
#declare Screw = .5; // try -.5 ... 0 ... .5

#declare Ring =
  difference {
    cylinder { 0, Height/Rings*y, Radius
      pigment { color red 1 }
      finish { ambient .5 diffuse .7 }
      }
    cylinder { -0.01*y, (Height/Rings+0.1)*y, Radius-Thick
      pigment { color green 1 }
      finish { ambient .5 diffuse .7 }
      }
    #declare S = 0;
    #while (S<Sectors/2)
      cylinder {
        <0, Height/Rings/2, -Radius-0.01>,
        <0, Height/Rings/2, Radius+0.01>, Hole
        rotate S/Sectors*360*y
        pigment { color rgb <1, .8, 0> }
        finish { ambient .5 diffuse .7 }
        }
      #declare S = S+1;
      #end
    }

#declare Cylinder =
  union {
    #declare R = 0;
    #while (R<Rings)
      object { Ring translate R/Rings*Height*y rotate R*Screw*360/Sectors*y }
      #declare R = R+1;
      #end
    }

object { Cylinder }
object { Cylinder scale <-1, 1, 1> }

light_source { <-3, 2, -1>*1000, rgb 1 }

camera { location <1, 2, -3>*100 look_at 0 translate Height/2*y }

// END of code


Post a reply to this message

From: Fuzzy
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 1 Aug 2003 03:00:03
Message: <web.3f2a0fb0e5126b67403117160@news.povray.org>
INVALID_ADDRESS wrote:
>(1) You will need a temporary file

I guessed as much :/

>(2) You should be happy about this: else the map(s) would have to be
>    recalculated at every test render, even if they don't change.

that much is true, though I would expect it to only be a tiny amount of
calculation time really compared to the entire thing...

>(3) It's possible to achieve such an on-the-fly creation of the maps
>    with a little animation that first creates the map(s)
<code snippet>
>    The main disadvances of this method are:
>    - all files have the same size and type
>    - the quality settings, antialias parameters etc. are the same
>      for all these files

That's quite a lot of disadvantages really, the worst one being the image
size... the point of me needing a parameterised texture creation method is
that, within the same rendering, I want to have different sizes of the same
object which, if using a texture mapped on, would require different sized
images to map on (as far as I know the cylindrical wrapping only wraps once
around the x axis, so I needed to create an image file wit enough holes for
one 'row' around the cylinder)

>(4) Using maps for holes doesn't create correct shape, shadows and
>    reflections of the walls in the holes. Animation with realistic
>    deep holes is impossible.

shadows I did notice were rough... as for 'deep' holes, I'm not sure I know
what you mean, as I mapped my texture to an outer cylinder and to an inner
one, the holes gained depth from the distance between the two cylinders.

>(5) CSG isn't as slow as you think! I've made a cylindrical sieve with
>    FIVE THOUSAND holes. They required less than 26 MINUTES for 640*480

then it's obvious that I'm doing something very wrong (hopefully) :)

When I tried the CSG without assigning a texture to the cylinders making the
holes the holes just turned out black, so I assigned rgbt <1,1,1,1> to the
smaller cylinders... and since I'm using Polished_Chrome on the main
cylinder... this might not be a good idea.

What I'll try first, as someone suggested, is to have shorter cylinders that
ONLY punch out the hole, and that don't cross over in the middle to punch
out the opposing hole on the other side too - my guess is that the crossing
over of them is throwing things off somewhere...

*looks around at the POVray swimming pool... maybe I should have tried to
climb in down at the shallow end instead of jumping in here... ah well...
too late now* ;)

Fuzzy


Post a reply to this message

From: sascha
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 1 Aug 2003 03:33:55
Message: <3f2a17e3$1@news.povray.org>
Fuzzy wrote:
> (as far as I know the cylindrical wrapping only wraps once
> around the x axis, so I needed to create an image file wit enough holes for
> one 'row' around the cylinder)

You can use u/v mapping and then scale the map - so you can place more 
copies of your image-map around the cylinder, here's an example:

camera {
	location <0,3,-10>
	look_at <0,0,0>
}

light_source {
	<-10,10,-10>
	color rgb <1,1,1>
}

cylinder {
	<0,-2,0>,<0,2,0>,3
	pigment {
		uv_mapping
		image_map {
			jpeg "f:/test.jpg"
			map_type 0
		}
		scale <0.5,0.5>
	}
	finish {
		ambient 0.3 diffuse 0.7 specular 0.5 roughness 0.01
	}
}

-sascha


Post a reply to this message

From: Fuzzy
Subject: Re: CSG shape with many 'holes' takes *forever* to render!
Date: 1 Aug 2003 04:05:01
Message: <web.3f2a1ec5e5126b67403117160@news.povray.org>
sascha wrote:

>You can use u/v mapping and then scale the map

now *that's* something new... :)
still... I think I *should* try to do this the CSG way, the 'proper' way as
the shape I'm making is only a test for more complex things later, and if I
head down the mapping route now... there'll be no end :(
Tha trick will be useful for things that *need* to be mapped though in the
future, thanks :)

Fuzzy


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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