you might have checked out my script already, if not:
so my script generates animated grass, and currently uses a whole algorithm of random values and bend modifiers to do so.
BUT ofcourse I want to put as much control as I can in the hands of the user, so I decided to implement an option to load a video file that defines the height of the grass determined by the brightness value of the pixel in the video file corresponding to the position of each grass strand. (use the video output as an animated heightmap in other words)
now, i've implemented a sampling function that works fine, but I ran into a very big problem.
obviously grass strands are numerous, which means that for my script to be useable in the least bit, I need speed. lots of it. so far everything worked out fine: I have a laptop that gets slower every single day, and I still don't have any trouble running my script creating thousands of animated strands in a matter of seconds.
however, when I load in the video file and begin sampling, the problems start.
I am currently using the "getpixels videofile [position,position (point2 values)] nrofpixels" maxscript function, in combination with the "gotoframe" function.
basically, for each frame of the video file, I sample the brightness value I need (one per frame for each grass strand), and then move to the next frame, doing the same thing, and that for every frame of the video file for every grass strand.
now apparently max doesn't load the file / frames until it needs them, and once it's loaded them and used them it discards them again. I'm assuming this is a built-in memory saving mesure. that would be fine, but now it takes over a full minute PER STRAND to sample a grayscale hypercompressed 20 mb video file of a mere 630 frames, which is insanely slow. agreed, my laptop isn't what it used to be, but it's still stronger than most of our home computers, that simply freeze upon running the script with a video file loaded.
now what I need to do, or what I would like to do at least, is to somehow create a kind of buffer before sampling, to which I go back for each sample, so that i only need to load the entire video file only once, and than the animation sampling can go smoothly.
is there a way to achieve this?
if not, do you have any other suggestions to achieve the result i'm going for?
to give you a good example of the end effect i'm hoping to achieve:
only with grass or custom geometry that's user-defined. (yes, i put that in, too)