|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Are there any tricks to speed up "complex" boolean objects?
I have a hockey puck, with several thousand small prisms cut from the side to
make a knurl texture on the side. I've manually bounded the puck, but POV still
crawls once it starts rendering that surface.
I'm hoping that by altering the way I put the initial objects together, I can
speed it up.
Here is the code I have:
#declare puck_r = .07;
#declare puck_base =
merge{
cylinder{ <0,0,0> <0,1,0>, 1.5-puck_r }
cylinder{ <0,puck_r,0> <0,1-puck_r,0>, 1.5 }
torus{ 1.5-puck_r,puck_r translate puck_r*y }
torus{ 1.5-puck_r,puck_r translate (1-puck_r)*y }
}
#declare logo =
height_field{
png "logo_heightfield.png"
smooth
translate -.5
scale <2.6,-.02,2.6>
translate <0,0,-.25>
texture{ frosted_glass }
}
#declare knurl_piece =
prism{
linear_spline conic_sweep
1,0,5,
<-1,-1>, <-1,1>, <1,1>, <1,-1>, <-1,-1>
rotate 45*y
scale <1.2,-1,1>
translate 1*y
rotate 90*x
scale .015
translate -.5*y
}
#declare counter = 0;
#declare total = 20;
#declare knurl_row =
union{
#while ( counter < total )
object{
knurl_piece
translate counter/20*y
}
#declare counter = counter+1;
#end
}
#declare knurl_row1 =
intersection{
cylinder{ <0,-.5+puck_r,0> <0,.5-puck_r,0>, 2 }
object{ knurl_row }
}
#declare knurl_row2 =
intersection{
cylinder{ <0,-.5+puck_r,0> <0,.5-puck_r,0>, 2 }
object{ knurl_row translate .5/20*y }
}
#if ( puck_simple = 1 )
#declare puck =
object{ puck_base }
#else
#declare counter = 0;
#declare total = 360;
#declare puck =
difference{
object{ puck_base }
union{
#while ( counter < total )
object{ knurl_row1 translate -1.50*z rotate counter*y }
object{ knurl_row2 translate -1.50*z rotate (counter+1)*y }
#declare counter = counter + 2;
#end
translate .5*y
}
}
#end
#declare puck_w_logo =
difference{
object{ puck texture{ heavy_glass } }
union{
object{ logo translate 1*y texture{ frosted_glass } }
object{ logo scale <1,-1,1> texture{ frosted_glass } }
}
}
#declare glass_puck =
object{
puck_w_logo
hollow
interior{ ior 1.5 }
translate .01*y
rotate -40*y
bounded_by { cylinder { <0,0,0> <0,1.1,0> 1.55 } }
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Okay, I was able to speed it a lot by doing some condensing in the code and
adding some intermediate manual bounding boxes. I'm guessing that I have it
about as good as I can get it.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"P Brewer" <pbj### [at] wowwaycom> wrote in message
news:web.498f84077cfd3c13916e2c9f0@news.povray.org...
> Are there any tricks to speed up "complex" boolean objects?
>
> I have a hockey puck, with several thousand small prisms cut from the side
> to
> make a knurl texture on the side. I've manually bounded the puck, but POV
> still
> crawls once it starts rendering that surface.
>
> I'm hoping that by altering the way I put the initial objects together, I
> can
> speed it up.
I see you've already achieved a bit of a speed up, but in case you're still
interested, this does look like a hole cutting problem discussed a few years
ago.
Mike Williams put together a page describing the problem and a few
alternative approaches to minimising the slowdown at
http://www.econym.demon.co.uk/holetut/index.htm.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thanks! Just what I needed. It's funny how my making small changes to the
hierarchy behind a boolean can make such a big difference in render time...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <nom### [at] nomailcom> wrote:
> Mike Williams put together a page describing the problem and a few
> alternative approaches to minimising the slowdown at
> http://www.econym.demon.co.uk/holetut/index.htm.
The solutions are probably good, but the description of the underlying problem
is a bit misleading.
The better bounding that POV can take advantage of in the described scenario is
not applied to unions - it is applied to scene level objects. It only shows in
the described scenario because POV "unwraps" unions to scene level if possible.
For example, the following construction suffers from the very same slowdown as a
difference - simply because the merge prevents the union from being "unwrapped":
merge {
union {
// place a host of cylinders here
}
}
The true underlying problem is a totally different one: Due to the inner design
of POV-Ray, objects aren't tested for the *first* intersection with a ray, but
rather *all* intersections. It is only afterwards that the very first of them
is determined.
Whether it is an intersection, a union or a merge, this invariably means that
*all* components have to be tested for intersections. And if the components are
all cylinders, bounding boxes wouldn't win a thing because the effort would be
about the same.
Ironically, the mechanism to test for *all* intersections is required for
objects to work properly in CSG intersections...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
P Brewer wrote:
> Are there any tricks to speed up "complex" boolean objects?
>
> I have a hockey puck, with several thousand small prisms cut from the side to
> make a knurl texture on the side. I've manually bounded the puck, but POV still
> crawls once it starts rendering that surface.
>
> I'm hoping that by altering the way I put the initial objects together, I can
> speed it up.
Make it from a mesh. This should be easy to do procedurally. It will
render very quickly.
Regards,
John
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
P Brewer nous illumina en ce 2009-02-08 20:16 -->
> Are there any tricks to speed up "complex" boolean objects?
>
> I have a hockey puck, with several thousand small prisms cut from the side to
> make a knurl texture on the side. I've manually bounded the puck, but POV still
> crawls once it starts rendering that surface.
>
> I'm hoping that by altering the way I put the initial objects together, I can
> speed it up.
>
When you remove pieces with a difference, you get all component's bounding boxes
to overlap. Each is tested against every bounding boxes, ans each components.
Instead of removing small bits, try making the base shape a little smaller, and
ADD in an union the small prisms to acheive the same aspect.
Even faster, try using some normals. Chances are that the difference will be
minimal, barely visible, if you can spot a difference.
--
Alain
-------------------------------------------------
You know you've been raytracing too long when your idea of a complete computer
is a fast CPU, lots of RAM, and a means of running POVray.
Aaron Gage a.k.a Slartibartfast
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>
> Make it from a mesh. This should be easy to do procedurally. It will
> render very quickly.
>
> Regards,
> John
Okay, I went with your plan and went to a mesh. Renders much faster now than
even my best version of the CSG, thanks.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|