POV-Ray : Newsgroups : povray.general : HELP: Saving Memory Server Time
15 May 2024 18:59:51 EDT (-0400)
  HELP: Saving Memory (Message 1 to 7 of 7)  
From: Sven Littkowski
Subject: HELP: Saving Memory
Date: 16 Dec 2015 03:38:29
Message: <56712305$1@news.povray.org>
Please assist me with your advise:

I try to save memory, and wanted thus to prevent declaring one and the
same (very large) image multiple times. This is, how I tried it:

#declare MyHullPlating     = image_map { jpeg "Seneca II - Hull
Plating.jpg"     interpolate 2 }
#declare MyInteriorPlating = image_map { jpeg "Seneca II - Interior
Plating.jpg" interpolate 2 }

#declare MyInteriorPlating = bump_map { png "Seneca II - Hull Bump
NoGates Windows.png" }
#declare MyHullBumpNogates = bump_map { png "Seneca II - Hull Bump
NoGates.png.png"     }

#declare HullPlatingSquare     = pigment { image_map { MyHullPlating
                                                              } }
#declare HullPlatingSphere     = pigment { image_map { MyHullPlating
                                map_type 1                    } }
#declare DeepHullPlatingSquare = pigment { image_map { jpeg "Seneca II -
Deep Hull Plating.jpg"                    interpolate 2      } }
#declare InteriorPlatingSquare = pigment { image_map { MyInteriorPlating
                                          interpolate 2      } }
#declare InteriorPlatingSphere = pigment { image_map { MyInteriorPlating
                               map_type 1 interpolate 2      } }
#declare HullWindowsSquare     = pigment { image_map { png  "Seneca II -
Hull Windows.png"                         interpolate 2      } }
#declare WindowsSquare         = pigment { image_map { png  "Seneca II -
Windows.png"                              interpolate 2      } }
#declare HullWindowsManySquare = pigment { image_map { png  "Seneca II -
Hull Windows Many.png"                    interpolate 2      } }
#declare HullPaintingSquare    = pigment { image_map { jpeg "Seneca II -
Hull Painting.jpg"                        interpolate 2 once } }
#declare CupolaPaintingSquare  = pigment { image_map { jpeg "Seneca II -
Cupola Painting.jpg"                      interpolate 2 once } }
#declare HullPlatingWHGSphere  = pigment { image_map { jpeg "Seneca II -
Hull Plating WHG.jpg"          map_type 1 interpolate 2      } }
#declare WHGPlatingSphere      = pigment { image_map { png  "Seneca II -
WormholeGenerator Plating.png"            interpolate 2 once } }
#declare RingPlatingSphere     = pigment { image_map { jpeg "Seneca II -
Ring Plating.jpg"              map_type 1 interpolate 2      } }
#declare RedHullPlatingSphere  = pigment { image_map { jpeg "Seneca II -
Red Hull Plating.jpg"          map_type 1 interpolate 2      } }

#declare HullBumpNogatesWindowsSquare04 = normal { bump_map {
MyInteriorPlating                                          bump_size 0.4 } }
#declare HullBumpNogatesWindowsSquare10 = normal { bump_map {
MyInteriorPlating                                          bump_size 1.0 } }
#declare HullBumpNogatesWindowsSphere04 = normal { bump_map {
MyInteriorPlating                               map_type 1 bump_size 0.4 } }
#declare HullBumpNogatesWindowsSphere10 = normal { bump_map {
MyInteriorPlating                               map_type 1 bump_size 1.0 } }
#declare HullBumpNogatesSquare10        = normal { bump_map {
MyHullBumpNogates                                          bump_size 1.0 } }
#declare HullBumpNogatesSquare20        = normal { bump_map {
MyHullBumpNogates                                          bump_size 2.0 } }
#declare HullBumpNogatesSphere04        = normal { bump_map {
MyHullBumpNogates                               map_type 1 bump_size 0.4 } }

But POV-Ray seem not to like my intentions to save some memory. And so,
I am ending up having to undo the IMAGE_MAP and BUMP_MAP declaration and
do it now this way:

#declare HullPlatingSquare     = pigment { image_map { jpeg "Seneca II -
Hull Plating.jpg"                         interpolate 2      } }
#declare HullPlatingSphere     = pigment { image_map { jpeg "Seneca II -
Hull Plating.jpg"              map_type 1 interpolate 2      } }
#declare DeepHullPlatingSquare = pigment { image_map { jpeg "Seneca II -
Deep Hull Plating.jpg"                    interpolate 2      } }
#declare InteriorPlatingSquare = pigment { image_map { jpeg "Seneca II -
Interior Plating.jpg"                     interpolate 2      } }
#declare InteriorPlatingSphere = pigment { image_map { jpeg "Seneca II -
Interior Plating.jpg"          map_type 1 interpolate 2      } }
#declare HullWindowsSquare     = pigment { image_map { png  "Seneca II -
Hull Windows.png"                         interpolate 2      } }
#declare WindowsSquare         = pigment { image_map { png  "Seneca II -
Windows.png"                              interpolate 2      } }
#declare HullWindowsManySquare = pigment { image_map { png  "Seneca II -
Hull Windows Many.png"                    interpolate 2      } }
#declare HullPaintingSquare    = pigment { image_map { jpeg "Seneca II -
Hull Painting.jpg"                        interpolate 2 once } }
#declare CupolaPaintingSquare  = pigment { image_map { jpeg "Seneca II -
Cupola Painting.jpg"                      interpolate 2 once } }
#declare HullPlatingWHGSphere  = pigment { image_map { jpeg "Seneca II -
Hull Plating WHG.jpg"          map_type 1 interpolate 2      } }
#declare WHGPlatingSphere      = pigment { image_map { png  "Seneca II -
WormholeGenerator Plating.png"            interpolate 2 once } }
#declare RingPlatingSphere     = pigment { image_map { jpeg "Seneca II -
Ring Plating.jpg"              map_type 1 interpolate 2      } }
#declare RedHullPlatingSphere  = pigment { image_map { jpeg "Seneca II -
Red Hull Plating.jpg"          map_type 1 interpolate 2      } }

#declare HullBumpNogatesWindowsSquare04 = normal { bump_map { png
"Seneca II - Hull Bump NoGates Windows.png"            bump_size 0.4 } }
#declare HullBumpNogatesWindowsSquare10 = normal { bump_map { png
"Seneca II - Hull Bump NoGates Windows.png"            bump_size 1.0 } }
#declare HullBumpNogatesWindowsSphere04 = normal { bump_map { png
"Seneca II - Hull Bump NoGates Windows.png" map_type 1 bump_size 0.4 } }
#declare HullBumpNogatesWindowsSphere10 = normal { bump_map { png
"Seneca II - Hull Bump NoGates Windows.png" map_type 1 bump_size 1.0 } }
#declare HullBumpNogatesSquare10        = normal { bump_map { png
"Seneca II - Hull Bump NoGates.png.png"                bump_size 1.0 } }
#declare HullBumpNogatesSquare20        = normal { bump_map { png
"Seneca II - Hull Bump NoGates.png.png"                bump_size 2.0 } }
#declare HullBumpNogatesSphere04        = normal { bump_map { png
"Seneca II - Hull Bump NoGates.png.png"     map_type 1 bump_size 0.4 } }

Is there really no way, to optimize this code? I don't mean to make the
graphics smaller, but to have POV-Ray loading each graphic only one time
into the RAM. Any advise?


Post a reply to this message

From: clipka
Subject: Re: HELP: Saving Memory
Date: 16 Dec 2015 09:40:00
Message: <web.567177628c656afad6fa18f0@news.povray.org>
Sven Littkowski <jam### [at] yahoocom> wrote:
>
> I try to save memory, and wanted thus to prevent declaring one and the
> same (very large) image multiple times. This is, how I tried it:
....
> #declare MyHullPlating     = image_map { jpeg "Seneca II - Hull
> Plating.jpg"     interpolate 2 }
....
> #declare HullPlatingSquare     = pigment { image_map { MyHullPlating
>                                                               } }

The above should work fine...

> #declare HullPlatingSphere     = pigment { image_map { MyHullPlating
>                                 map_type 1                    } }

.... while this possibly won't. Likewise...

....
> #declare HullBumpNogatesWindowsSquare04 = normal { bump_map {
> MyInteriorPlating                                          bump_size 0.4 } }
> #declare HullBumpNogatesWindowsSquare10 = normal { bump_map {
> MyInteriorPlating                                          bump_size 1.0 } }

.... the above two statements should be fine...

> #declare HullBumpNogatesWindowsSphere04 = normal { bump_map {
> MyInteriorPlating                               map_type 1 bump_size 0.4 } }
> #declare HullBumpNogatesWindowsSphere10 = normal { bump_map {
> MyInteriorPlating                               map_type 1 bump_size 1.0 } }

.... while these again might not be.


> But POV-Ray seem not to like my intentions to save some memory.

IIRC, at present POV-Ray won't share images across different map flavors (e.g.
image_map vs. bump_map), nor with different interpolation, nor with different
projection (map_type) - or anything that is common to all statements that load
an image, for that matter.

bump_size should be fine; if it doesn't work, try moving it from the bump_map{}
block to the normal{} block.


I'm aware that there's room for improvement there; technically there's no reason
to glue stuff like the projection type and interpolation as tightly to the image
itself as it is currently done, and we should probably have some dedicated
statement to just load a "naked" image and assign it to a variable, to be used
later in image_map, bump_map or even height_field statements. And if I had a
bigger supply of round tuits, we'd already have something like that ;)


Post a reply to this message

From: Sven Littkowski
Subject: Re: HELP: Saving Memory
Date: 16 Dec 2015 18:03:02
Message: <5671eda6$1@news.povray.org>
I don't know, what round tuits are (I am not English), but I hope you
soon get these round whatever and can start developing it (the P-Team).
 Because it is true - it would be a useful improvement, saving lots of
memory and thus allowing more speed for the renders, I guess.


Post a reply to this message

From: Alain
Subject: Re: HELP: Saving Memory
Date: 16 Dec 2015 20:08:46
Message: <56720b1e$1@news.povray.org>

> I don't know, what round tuits are (I am not English), but I hope you
> soon get these round whatever and can start developing it (the P-Team).
>   Because it is true - it would be a useful improvement, saving lots of
> memory and thus allowing more speed for the renders, I guess.
>

"getting a round tuit" sounds similar to "getting around to it"
Next, if it's not clear enough, you can try using Google translation, or 
some other, to your native language.


Post a reply to this message

From: Todd Carnes
Subject: Re: HELP: Saving Memory
Date: 16 Dec 2015 21:54:00
Message: <567223c8$1@news.povray.org>
On 2015-12-16 15:02, Sven Littkowski wrote:
> I don't know, what round tuits are (I am not English),

It's a pun. It sounds like "around to it".

In other words, he hasn't had enough time to get "around to it" yet. :)

Todd


Post a reply to this message

From: Larry Hudson
Subject: Re: HELP: Saving Memory
Date: 16 Dec 2015 23:00:54
Message: <56723376$1@news.povray.org>
On 12/16/2015 06:53 PM, Todd Carnes wrote:
> On 2015-12-16 15:02, Sven Littkowski wrote:
>> I don't know, what round tuits are (I am not English),
>
> It's a pun. It sounds like "around to it".
>
> In other words, he hasn't had enough time to get "around to it" yet. :)
>
> Todd
>
There are also small round disks labelled "Round Tuit" that can be (jokingly) given to
people 
implying you are giving them the time to "get around to it" (whatever "it" may be at
that time). 
  But of course, it's still just a pun.

      -=- Larry -=-


Post a reply to this message

From: Sven Littkowski
Subject: Re: HELP: Saving Memory
Date: 17 Dec 2015 17:07:23
Message: <5673321b$1@news.povray.org>
Yes, if it comes to those special things within a language, many persons
not speaking natively that language are left outside. :-)

Thanks for this little education. I learned something new today.


Post a reply to this message

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