[Closed] How to script which pixel-lines and -columns to be rendered?
All right, this is a little difficult to explain:
We’ve got the job to produce an animation that’s to be shown on a huge LED-“screen”. But technically it’s no a screen, but a series of LED-“strips”, evenly spaced across the facade of a building.
Each strip consists of 2 x 64 pixels. To make it a little easier, let’s say that we’ve got 4 strips horizontally, and 2 strips vertically (actually it’s more). They are horizontally spaced by about 150 centimeters (around 5 ft), which equals a pixel number of 98 pixels. Vertically there’s a gap of around 90 cm (ca. 3 ft) between the strips, equaling, let’s say, 60 pixels.
Now, let’s just assume the gaps between the strips aren’t gaps, but filled with LEDs as well… that would give us a total of:
2 + 98 + 2 + 98 + 2 + 98 + 2 = 302 pixels horizontally
and
64 + 60 + 64 = 188 pixels vertically
So, if the facade was completely filled with LEDs (no gaps), our animation would have to be created at a resolution of 302 x 188 pixels, for each LED to get it’s very own pixel. BUT, there are GAPS between the LED-strips… so we need to tell MAX that it should render only selected columns and lines of the image:
columns 1, 2, 101, 102, 201, 202, 301, 302
lines 1-64, 125-188
So basically I want MAX to render everything EXCEPT for the pixels which lie inside the gaps. BUT I don’t want these pixels to be just black, I want them not to be included in the image at all… so that, when being projected onto the LEDs, the image gets split up correctly. Like this:
[[img] http://img339.imageshack.us/img339/9679/split9uo.jpg[/img]]( http://img339.imageshack.us/img339/9679/split9uo.jpg[/img]]( g"/> )
Is this actually possible in MAX? Maybe through scripting? Otherwise we would have to render out the animation at 9200 x 3700 pixels, just to cut it down to 188 x 1370 (which, by the way, I am not really sure how to do… maybe through batch in Photoshop or an AviSynth-script.)
This would be relatively straight forward using a render effects scripted plugin, but it would still render all of the frame, and then resize it to the target size and shape.
Probably the easiest thing to do would be to render each strip animation sequence using a cropped render region, and then composite them all together in premiere, combustion, or after effects.
This code will give you a basic way to work. Change the parameters at the start to choose your region. If you want a utility I can write that also but it will take more time. Oh, and it wont netrender, that requires a bit more work!
------------------------------------------------------------
-- change these parameters
-- [www.joshuanewman.net]( http://www.joshuanewman.net/)
-- written:03/11/2005
rw=800 -- the overall width of the rendered image
rh=50 -- the height of the cropped row (ie 50 pixels high)
cs=0 -- the highest pixel of the row
fname="c://temp/myrender.tif" -- the filename of the output
srt=0 -- the start frame
end=100 -- the end frame
------------------------------------------------------------
r=render fromframe:0 toframe:1 rendertype:#regioncrop region:(Box2 0 cs rw (cs+rh)) outputfile:fname
Josh.
Well, I was hoping for an automated way instead of putting the pieces together by hand (we would have to deal with 94 x 21 segments)…
I think “Thanks for your time Joshua” might have actually been a more appropriate reply, he just gave you some ideas and an example how to tackle this problem… I’m sure someone here with a bit of spare time would be glad to write a fully functional script for you, but I don’t think this can be taken for granted.
- Martijn
I guess that “basic idea” Josh posted didn’t take him too long, being the scripting-pro that he is
Plus, I didn’t ask anyone to do the work for me (don’t get fooled by the term “automated”). Maybe it would be even a little MORE appropriate, if you would’ve read our posts more carefully. He posted, that I would have to composite the different rendered parts together by hand (showing the drawback of his method), and I said, that I was looking for an automated way to deal with that drawback (as it was my problem since the first post)… but thanks for trying to teach me manners :rolleyes:
I think I will be using this approach:
Rendering out the frame at full size (gee, 9200 x 3700), covering up the “not-to-be-rendered”-parts with matte/shadow planes (actually a little smaller to not lose any pixels) linked to the camera, to save on render time. Then I somehow have to create an Avisynth-script with a truckload of crop- and stack-commands to create the final thing.
[QUOTE=Martijn van Herk]I think “Thanks for your time Joshua” might have actually been a more appropriate reply, …QUOTE]
Thanks Martijn too right! < :
Laserschwert,
I think where you missed is that rather than provide you with a finished solution, I gave you some tools to work with. There isn’t much point in doing your work for you since you will learn nothing.
Anyway, flattery will get you almost anywhere and I have written a render effect that cuts out areas of the rendering using a clip map and stiches the image back together again. But i have run into what seems to be a bug with mapbuttons so it has become stuck. It’s beer o’clock here now but I may have some time to play with it on the weekend so if you can wait then you may get lucky.
Oh, and if it works like it should then I would expect a page of thank you’s
J¬
Uhm… what is it with you people? As I said to Matijn before, “I didn’t ask anyone to do the work for me”, so please stop saying so!
Anyway, of course I am thankful for your effort, and it’s really interesting to see that you’ve managed to put the “cut and stitch” into the render effect. I am not very familiar with MAXscript, but I saw that your script posted first was basically a scripted region-renderer… and when saying that I was looking for an “automated” way for the cut and stitch part, I got flamed for being so lazy and ungrateful.
So, don’t put too much effort into this, I am not expecting you to do taht. I was just curious about whether this would be possible through MAXscript at all. It would save a lot of render time, since the full image would have to be 9200 x 3700 pixels, wheras the cut up and stitched image would just be 188 x 1376 pixels.
will you have to do any post prosseing to the renderer frames? like glows or effects?? or comp background and foreground elements? just think it would be very painfull to do this with the sliced up versions?? if you want to run this a post processes on your final images, you could maybe setup a prosessing comp in fusion or combustion, i guess if you do it right in after effects, and just replace your sequence file and the comp will do all the choping and placing for you. or you could writte a max script to post prosses your images just not at render time more . if your doing all you final output throught max then the rendereffect would be the way to go for you.
anyways you putting in my 2 cents,
cheers,
Los.
sorry dude,
just noticed that wouldn’t fix your saving render time concern.
i get exited sometimes