Wheiraucher
12-02-2008, 11:46 AM
Hi I have written (or rather copied from http://www.louismarcoux.com/MaxTips.htm, to be honest), a script that combines two renderings to create an anaglyph image to be viewed with red-cyan glasses. It is not really complicated or long:
left = render camera:$camleft rendertype:#regioncrop region:#(imgdiff+1,1,fwidth,renderheight) fromframe:rendstart toframe:rendend --gamma:2.2
right = render camera:$camright rendertype:#regioncrop region:#(1,1,fwidth-imgdiff,renderheight) fromframe:rendstart toframe:rendend --gamma:2.2
newimage = bitmap dwidth renderheight --gamma:2.2-- create a new image of the correct size
for j = 0 to (newimage.height)-1 do
(
for i = 0 to (newimage.width)-1 do
(
Colorleft = getpixels left [i,j] 1 -- get the red pixel color
ColorRight = getpixels right [i,j] 1 -- get the blue and green
ColorFinal = #([ Colorleft[1].red,Colorright[1].green,Colorright[1].blue] )
setpixels newimage [i,j] Colorfinal
)
)
display newimage
my problem is. Though it is working perfectly i find it is rather slow. My question: Is there a way to speed the process up? Some other approach then going through all the pixels, maybe? I remember delphi had something like a scanline command which was really fast, does maxscript have this, too?
thx in advance
David
left = render camera:$camleft rendertype:#regioncrop region:#(imgdiff+1,1,fwidth,renderheight) fromframe:rendstart toframe:rendend --gamma:2.2
right = render camera:$camright rendertype:#regioncrop region:#(1,1,fwidth-imgdiff,renderheight) fromframe:rendstart toframe:rendend --gamma:2.2
newimage = bitmap dwidth renderheight --gamma:2.2-- create a new image of the correct size
for j = 0 to (newimage.height)-1 do
(
for i = 0 to (newimage.width)-1 do
(
Colorleft = getpixels left [i,j] 1 -- get the red pixel color
ColorRight = getpixels right [i,j] 1 -- get the blue and green
ColorFinal = #([ Colorleft[1].red,Colorright[1].green,Colorright[1].blue] )
setpixels newimage [i,j] Colorfinal
)
)
display newimage
my problem is. Though it is working perfectly i find it is rather slow. My question: Is there a way to speed the process up? Some other approach then going through all the pixels, maybe? I remember delphi had something like a scanline command which was really fast, does maxscript have this, too?
thx in advance
David
