POV-Ray : Newsgroups : povray.binaries.images : Tracing an object through a soft-edged mask; or objects as airbrush 'spray' : Re: Tracing an object through a soft-edged mask; out of memory Server Time
18 May 2024 09:47:28 EDT (-0400)
  Re: Tracing an object through a soft-edged mask; out of memory  
From: Blue Herring
Date: 16 May 2008 10:20:01
Message: <web.482d974628652b6ace5ce3790@news.povray.org>
"Thomas de Groot" <t.d### [at] internlDOTnet> wrote:
> Yes, the following piece of code, using eval_pigment, gets me a fatal parse
> error: out of memory, while the same code by Kenneth, does not. tested with
> version 3.7 beta 25.

Hi,
  First off, quite a clever idea, props Kenneth.

  Secondly, I haven't yet tried it, but I believe both parse time and memory
usage could be much improved by declaring a function from the pigment once and
then calling the function to get the appropriate value.  This would avoid
declaring the pigment function (which is what eval_pigment does) over and over
again for the same pigment, and replace a repeated macro call with a function
call, which should be much faster.

So for example, before the loop:

#declare Pig_F = function { pigment { Mask } }

Then, instead of eval_pigment:

// For Greyscale images
#declare Intersection = Pig_F(Position.x, Position.y, Position.z).red;

or

// For RGB images
#declare Intersection = Pig_F(Position.x, Position.y, Position.z).gray ;

-The Mildly Infamous Blue Herring


Post a reply to this message

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