POV-Ray : Newsgroups : povray.general : Does declaring an object reduce the rendering time? : Re: Does declaring an object reduce the rendering time? Server Time
19 Apr 2024 14:07:11 EDT (-0400)
  Re: Does declaring an object reduce the rendering time?  
From: Alain Martel
Date: 3 May 2020 12:06:15
Message: <5eaeebf7$1@news.povray.org>
Le 2020-05-03 à 11:35, Kima a écrit :
> Consider
> 
> union{
>      sphere{<0,0,0>,1}
>      sphere{<1,0,0>,1}
>      sphere{<2,0,0>,1}
> .... 10,000th sphere
> texture{}
> }
> 
> Is the rendering faster if we write it as
> 
> #declare S=sphere{<0,0,0>,1}
> 
> union{
>      object{S translate<0,0,0>}
>      object{S translate<1,0,0>}
>      object{S translate<2,0,0>}
> .... 10,000th object
> texture{}
> }
> 
> Note that the question is not about applying texture and normals, as they are
> applied after the union.
> 
> I understand that the latter case consumes less memory,

Not in your example.

  but the key problem is
> the rendering time.
> 
> To my understanding, the time-consuming process is when POVRAY applies the
> light. Otherwise, placing the object is the rapid step.
> 
> 

Both cases will use about the same amount of memory and render in 
exactly the same time. The second case will use a little bit more memory 
to store the definition of the object used. That's the case for almost 
every procedural primitives.
The only advantage here is the ability to change the object used by 
changing a single line of code.

If, instead of spheres, you used some meshes, then, there would have 
been a huge reduction on memory use.
In this case, the first form would need to store each individual meshes 
while the second would instantiate a single mesh.

When using meshes, the reduction in memory use can prevent paging that 
can dramatically bog down the rendering. It may even mean the difference 
between been able to render at all and crashing.


Post a reply to this message

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