POV-Ray : Newsgroups : povray.binaries.images : city buildings-- WIP 9_29_2020 : Re: city buildings-- WIP 9_29_2020 Server Time
10 May 2024 00:20:47 EDT (-0400)
  Re: city buildings-- WIP 9_29_2020  
From: jr
Date: 4 Oct 2020 04:50:01
Message: <web.5f798bbc32341a55f5e85bab0@news.povray.org>
hi,

"Kenneth" <kdw### [at] gmailcom> wrote:
> Thomas de Groot <tho### [at] degrootorg> wrote:
> > Op 01/10/2020 om 23:40 schreef Kenneth:
>
> > > One trick that I learned long ago was to pre-#declare image_map pigments, when
> > > they are going to be used repeatedly in a scene. That saves a whopping
> > > amount of memory usage later.
> >
> > Yes sir. You probably learned this the hard way, like I did. ;-)
>
> Indeed! I probably stumbled onto the idea purely by mistake, ha.
>
> I've also experimented with trying to use a #macro to do the same thing.
> Like...
> #macro _MY_IMG_MACRO() // to create it
> pigment{image_map{png "my_image.png" interpolate 2}}
> #end
>
> then...
> #for(i,1,1000)
> box{0,1
> MY_IMG_MACRO() // the pigment-- but no pigment identifier needed here
> translate ...
> }
> #end
>
> Alas, the macro does not 'pre-#declare' the image_map in a similar way, or save
> on memory usage. I remember, from several years ago, that Clipka added some
> 'caching' abilities to macro use, in one of the v3.8xx development releases; I
> guess an image_map was not part of that scheme... or that the macro just caches
> the text of the pigment specification, not the image itself? (I make no claim of
> understanding the behind-the-scenes workings of a macro!)

it would have been helpful to see some (excerpted) real code, so I suspect I may
have the "wrong end of the stick", in which case ignore.  :-)  reading the above
and the follow up (0750h), I thought why aren't the basic image_map pigments in
an array?  (perhaps in a separate include file)  then the macro (and other code)
only need to deal with indices.  eg. (just typed, any errors mine):

#declare myImgMaps = array {
  pigment {image_map {jpeg "building windows 7 HO.jpg" interpolate 2}},
  ...
};

so you'd refer to 'myImgMaps[0]' etc.


regards, jr.


Post a reply to this message

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