POV-Ray : Newsgroups : povray.general : generating an image_map name: string syntax problem : generating an image_map name: string syntax problem Server Time
30 Jul 2024 12:20:48 EDT (-0400)
  generating an image_map name: string syntax problem  
From: Kenneth
Date: 18 Feb 2009 18:05:00
Message: <web.499c91fb755b086ff50167bc0@news.povray.org>
I've come up with an interesting little camera motion-blur idea for animation
(which I'll post when it's done), and the code is *almost* there--but I've been
stopped at a brick wall, with a single problem that I haven't yet been able to
work around, which is keeping me from implementing the whole idea. It concerns
an image_map and its syntax.

Here's a simplified explanation:
I have an image--named "an animation image001.png"--(one of 100 such numbered
images) which I want to apply as an image_map onto a box. But instead of using
that name directly in an image_map, I'm trying to use string commands to
generate the name (to make some 'generic' code that will easily work with any
and all image names and numbers; the details are unimportant for now.) I.e.,
rather than directly doing this--

image_map{png "an animation image001.png"}

I want to do this:

#declare image_name = "an animation image" // the BASIC name of the image; no
// numbers here. A string.
#declare image_type = "png" // also a string
#declare total_images = "100" // the number of images I've pre-rendered; also
// made into a string, for the next step.
#declare zeros = strlen(total_images); // returns the number of digits in
// 'total_images'--3 in this case
#declare counter = 1;
#declare my_image = concat(image_name,str(counter,-zeros,0),".",image_type)

When I #debug my_image, it shows up exactly as...

an animation image001.png

which is the exact name of the actual image that I want to use. But when I try
to plug this into an image_map...

image_map{png "my_image"}

it *should* decode to "an animation image.png"--but it doesn't work; generates a
fatal error, "Cannot open PNG file."

My initial reaction was that I had made a string syntax error; but I've tried
lots of other ideas that all fail as well...

#declare my_image = concat("\"",image_name,str(frame_NUMBER,-zeros,0),"\"")

which #debugs to "an animation image001.png" (WITH the quotes)
then...
image_map{png my_image}

Or this...
#declare my_image = concat(image_name,str(frame_NUMBER,-zeros,0))

which #debugs to    an animation image001
then...
image_map{png "my_image.png"}

There must be something fundamental that I'm doing wrong, or else I really don't
understand how POV-Ray reads strings in image_maps.  I've looked through the
docs for an explanation, but haven't come across a solution.  I seem to recall
a previous post that dealt with a similar issue, but I don't know where to
look. Any help would be GREATLY appreciated; I'm *so close* to working out my
animation blurring scheme that I can taste it!

Ken W.


Post a reply to this message

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