POV-Ray : Newsgroups : povray.newusers : tranparent objects Server Time
29 Nov 2024 14:33:06 EST (-0500)
  tranparent objects (Message 1 to 8 of 8)  
From: Lothar Esser
Subject: tranparent objects
Date: 3 Jun 1998 20:01:41
Message: <3575E3E5.12BC08F1@chop.swmed.edu>
Dear Colleagues,

  I am planning to use povray to render a transparent object
which 
  may contain several thousands of round ended cylinders. I
noticed 
  that it is very slow and I am wondering if a change in the
way
  I generate the object might speed povray up. Since there
are no
  round ended cylinders as primitives in povray ( or at
least I am 
  not aware of their existence ) I create them by merging a
cylinder
  and two spheres. In order to render everything correctly I
have done 
  something like this:

  merge {
    merge {
      cylinder {}
      sphere {}
      sphere {}
    } // this is repeated a few thousand times
    ...
    scale <>
  }

  ( The reason why I have to use the first merge {}
statement
   is because these cylinders can overlap and this overlap
needs
    to be removed. ) 

  So I wonder if something like this is faster :

   #declare round_ended_cylinder = 
   merge { cylinder { <0,0,0>,<1,0,0>,1 }
            sphere {<0,0,0>,1}
            sphere {<1,0,0>,1}
   }

   merge {
      object {round_ended_cylinder 
              // here come a bunch of scaling, translation
and rotation 
              // statements to position the standard
cylinder properly in 
              // space by just giving the end points.
              // This is quite a lot of additional
computation 
      // repeat this a few thousand times
   }

   Before I recode my program I'd like to have some advice
...
   Any help is greatly appreciated. 

   Lothar Esser

------------------------------------------------------------------
Dr. Lothar Esser 
Howard Hughes Medical Institute 
5323 Harry Hines Blvd.
Dallas Texas 75235-9050
E-mail : ess### [at] chopswmededu
------------------------------------------------------------------


Post a reply to this message

From: Ross Litscher
Subject: Re: tranparent objects
Date: 3 Jun 1998 23:14:04
Message: <357610FC.2C0A@osu.edu>
Lothar Esser wrote:
> 
> Dear Colleagues,
> 
>   I am planning to use povray to render a transparent object
> which
>   may contain several thousands of round ended cylinders. I
> noticed
>   that it is very slow and I am wondering if a change in the
> way
>   I generate the object might speed povray up. Since there
> are no
>   round ended cylinders as primitives in povray ( or at
> least I am
>   not aware of their existence ) I create them by merging a
> cylinder
>   and two spheres. In order to render everything correctly I
> have done
>   something like this:

::snip::

I think rendering a few thousand objects with transparency will take a
long time. Especially if they are overlapping, have reflection, or have
refraction... among other things. 

I'm kinda new to this as well, so don't quote me on that. Have you tried
rendering a few thousand of your objects with a simple texture? say just
a red pigment or something? That would give you a best case scenario for
a few thousand of your objects.

Ross

----------------------------------------------------
"Treat the earth well: it was not given to you by
your parents, it was loaned to you by your children.
We do not inherit the Earth from our Ancestors, we 
borrow it from our Children." 
----------------------------------------------------


Post a reply to this message

From: Michael Lundahl
Subject: Re: tranparent objects
Date: 4 Jun 1998 06:41:01
Message: <6l5tjt$dju$1@oz.aussie.org>
In article <3575E3E5.12BC08F1@chop.swmed.edu>,
	Lothar Esser <ess### [at] chopswmededu> writes:
>Dear Colleagues,
>
>  I am planning to use povray to render a transparent object
>which 
>  may contain several thousands of round ended cylinders. 

>I have done  something like this:
>
>  merge {
>    merge {

Eeek! Double merge!? You are in for some serious rendering-times my friend.

The later snippet of code will not help the rendering-time, only make your
code easier to read.

I would like to suggest this:

Avoid merge.
Use Blobs instead (the cylinders in blob are round-ended).
Try to avoid transparency if you can...

Best of luck :)

/Michael


Post a reply to this message

From: Nieminen Mika
Subject: Re: tranparent objects
Date: 5 Jun 1998 13:53:51
Message: <6l9bbf$4hs$2@oz.aussie.org>
Michael Lundahl <d93### [at] efdlthse> wrote:
: Avoid merge.

  Why? If I have understood correctly, merge is as fast as union (the only
difference is that the inner surfaces are ignored; this is easyly done
by counting hits on exterior and interior of objects, ie. each time you
hit an object from outside, increase the counter; each time you hit the
object from inside, decrease the counter; ignore all the surfaces you hit
if the counter is >0 after the decrementation or if the counter is >1 after
the incrementation; I suppose povray uses this method, although I'm not sure).

-- 
                                                              - Warp. -


Post a reply to this message

From: Nieminen Mika
Subject: Re: tranparent objects
Date: 5 Jun 1998 14:26:53
Message: <6l9d9d$7m8$1@oz.aussie.org>
Lothar Esser <ess### [at] chopswmededu> wrote:
:   I am planning to use povray to render a transparent object which 
:   may contain several thousands of round ended cylinders. I noticed 
:   that it is very slow and I am wondering if a change in the way
:   I generate the object might speed povray up.

  You don't tell in your article if your object is reflecting. If so, it's
normal that the rendering times are extremely high. Also refraction may
slow down the rendering.
  If the object is just transparent (ie. it have filter or transmit greater
than 0, but not reflection or refraction) it's faster, but since there are
thousands of objects, it's slow. Although the objects are merged, all the
surfaces are there (they are just ignored), so it takes time to calculate
all the surfaces (but it's just as fast as union, don't believe that guy
who said merge is terribly slow; actually merge is faster than union, I just
made a test: 20 spheres of radius 2 in the z-axis located at 0, z, z*2, z*3,
and so on, and semitransparent, and the camera at -z*10; with union it took
2min 3sec to render and with merge (all the inner surfaces disappeared of
course) it took 45 seconds to render!).

:   So I wonder if something like this is faster :

:    #declare round_ended_cylinder = 
:    merge { cylinder { <0,0,0>,<1,0,0>,1 }
:             sphere {<0,0,0>,1}
:             sphere {<1,0,0>,1}
:    }

:    merge {
:       object {round_ended_cylinder 

  Nope. That ends up to be the same as the first code. Think about the
declared identifier as if the code is just copied in the place of the
identifier (I think that's exactly what povray does).
  Maybe you should try to put all the objects into one single merge body,
although I don't think that will help. Like

merge
{ cylinder { ... }
  sphere { ... }
  sphere { ... } 
  cylinder { ... }
  sphere { ... }
  sphere { ... }
  ...
}

  Why transparent objects are so slow? That's because povray has to made many
many calculations. Each time a ray hits an object, it tests if it's transparent
or reflecting. If so, it send another ray (or two rays if it was both trans-
parent and reflecting), and when it hits another surface, the same again and
again. With thousands of surfaces for every pixel it's understandable that it
takes time to calculate.

-- 
                                                              - Warp. -


Post a reply to this message

From: Nieminen Mika
Subject: Re: tranparent objects
Date: 5 Jun 1998 14:33:09
Message: <6l9dl5$7m8$2@oz.aussie.org>
Nieminen Mika <war### [at] assaricctutfi> wrote:
: Michael Lundahl <d93### [at] efdlthse> wrote:
: : Avoid merge.

:   Why? If I have understood correctly, merge is as fast as union

  Actually I just tested it: merge is faster than union (approximately
3 times faster with my test image).

-- 
                                                              - Warp. -


Post a reply to this message

From: Lothar Esser
Subject: Re: tranparent objects
Date: 6 Jun 1998 20:27:07
Message: <3579DE5B.41C6@chop.swmed.edu>
Michael Lundahl wrote:
> 
> Eeek! Double merge!? You are in for some serious rendering-times my friend.
> 
> The later snippet of code will not help the rendering-time, only make your
> code easier to read.
> 
> I would like to suggest this:
> 
> Avoid merge.
> Use Blobs instead (the cylinders in blob are round-ended).
> Try to avoid transparency if you can...
> 

   Hi Michael,

     thanks for the suggestion to use blobs. A scene with a blob instead
of cylinders is about 5 - 7 times faster. However I am not totally
thrilled with the shape of the blobs. If I use a small threshold to make
a cylinder look like a cylinder and not like a sausage lots of black
dots/ patches appear. Is that a bug ? Why is it not possible to use a
threshold of near 0 ? Is that a numerical problem ?  -I guess so-
Also it appears to me that blobs are slightly less transparent than
cylinders with the same transparency. I cannot quantify this observation
though - I might have done something wrong ...

Thanks for the good advice !

  Lothar

P.S. I am aware of the time penalty to pay for transparency and
reflection / refection or radiosity. All I am trying to do is to
minimize the rendering time if I can.


Post a reply to this message

From: Ross Litscher
Subject: Re: tranparent objects
Date: 6 Jun 1998 22:24:12
Message: <3579F9CC.30D9@osu.edu>
Lothar Esser wrote:

> 
>    Hi Michael,
> 
>      thanks for the suggestion to use blobs. A scene with a blob instead
> of cylinders is about 5 - 7 times faster. However I am not totally
> thrilled with the shape of the blobs. If I use a small threshold to make
> a cylinder look like a cylinder and not like a sausage lots of black
> dots/ patches appear. Is that a bug ? Why is it not possible to use a
> threshold of near 0 ? Is that a numerical problem ?  -I guess so-
> Also it appears to me that blobs are slightly less transparent than
> cylinders with the same transparency. I cannot quantify this observation
> though - I might have done something wrong ...
> 
> Thanks for the good advice !
> 
>   Lothar
> 
> P.S. I am aware of the time penalty to pay for transparency and
> reflection / refection or radiosity. All I am trying to do is to
> minimize the rendering time if I can.

Just curious, but what is this of that you need so many transparent
objects? Did you mention something about medical something or other? I
forget. If it is interesting to the general public, post an image to the
povray.binaries.images group.

Ross
-- 
----------------------------------------------------
"Treat the earth well: it was not given to you by
your parents, it was loaned to you by your children.
We do not inherit the Earth from our Ancestors, we 
borrow it from our Children." 
----------------------------------------------------


Post a reply to this message

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