2007-06-14

Doing BIG renders in max 9



I have received several questions on how to make very very high res renders in 3ds max with mental ray.

When you do this, there is a memory issue (worse on 32 bits) which makes some tiles turn black, and you get poor results. mental ray actually renders the image fine, but the individual image tiles get lost due to memory being full when sent over to max.

To help you solve this issue, I wrote this very simple script (Warning: I am not a MaxScript expert, this may cause your computer to catch fire and your wife to move to Iowa, use at your own risk) that allows you to split a render into "tiles".

You simply run the script, and a dialog pops up asking you how many "tiles" you want to break the image into. Pretty simple and self-explanatory. The render is broken into pieces, and saved as separate files, which you then can assemble in, say, Photoshop or similar.

There is one important point, though;

If you are using final gathering in the scene, you must do this from a saved final gather map, or you may get artifacts in the joints between the pieces.

In theory, I could add this to the script, but since I am no MaxScript expert (see above) and since I am not made out of time... I didn't.

To do this yourself:

1. Temporarily reduce the resolution of your render to something that renders withouth memory issues.
2. Turn on FG and tell it to write to file.
3. Set your min/max sampling temporarily to 1/64 and 1/64 for a really fast render (FG quality will not be affected by this!)
4. Render.
5. Set back original sampling (and resolution).
6. Set the FG map to "Read Only"
7. Run the script to do your "split render".

Hope this helps anyone stuck in "cannot lender large resolutions" land.



Enjoy.

/Z

30 comments:

Glacierise (a.k.a. Hristo Velev) said...

Nice one, MasterZ. Will use it on some billboards :D

Mark Reisch said...

do you have a maya version of the script.

I am trying to do 4k on mac mini's and have been beating my head against the screen, wiping off the blood and hitting it again. =\

ivorm said...

Hi,

I am trying to download Zap's script, but the links doesn't work.

Does someone else have a copy of this script. I need it in a hurry!

Thks,
Les

Mark Reisch said...

here is the source code for the script that I found MasterZap posted on another forum

copy the script, open notepad, paste and save as a .ms file:

rollout SplitRender "Split Render Tool" width:250 height:100
(
radiobuttons splitcount "Pieces to split render in:" labels:#("1", "4", "9", "16") default:2
spinner width "Total width:" type:#integer range:[0,32000,3000]
spinner height "Total height:" type:#integer range:[0,32000,2400]
spinner overlap "Pixel overlap:" type:#integer

checkbutton show "Show image while rendering" checked:on

edittext filename "File name:" text:"my_filename"
edittext extension "File type:" text:".jpg"

button doRender "Do the render"

on doRender pressed do (
a = splitcount.state
b = splitcount.state * splitcount.state
-- actual render width and height
w = width.value / a
h = height.value / a

bm = bitmap w h
p = overlap.value - 1

for i=0 to b-1 do
(
row = i / a
col = i - floor(row) * a

render renderType:#blowup region:#((w/a)*col,(h/a)*row,w/a*(col+1)+p,(h/a)*(row+1)+p) outputwidth:w outputheight:h outputfile:(filename.text + row as string + col as string + extension.text) vfb:show.checked progressbar:(not show.checked) to:bm
)
unDisplay bm
)
)

-- create the rollout window and add the rollout
if splitRenderFloater != undefined do
(
closerolloutfloater splitRenderFloater
)
SplitRenderFloater = newRolloutFloater "Split Render Tool" 250 225
addRollout SplitRender SplitRenderFloater

Mark Reisch said...

here is the forum

http://www.mymentalray.com/forum/showthread.php?p=2840

Master Zap said...

Link should work now, methinks.

/Z

Mark Reisch said...

any word if there is a maya version in the works????

Mark Reisch said...

MasterZ, is there any possibility to get a maya version?????????????????????????????????????????????????

jomar machado said...

Thank you for this very helpfull tip! Congrats! :)

Jomar Machado

mak 21 said...

I have tried the script in 3dsmax 9 and 3dsmax 8
It works, but I have a small problem.
The images are not saved.
I have tried in various ways, but at the end of the render
the windows of image are automatically closed
and I don't have any lifesaving run to use in the script
You as you do?
Thanks

mak 21 said...

Now i can save the rendering
All ok !

\dev said...

this script worked well with me also in max9 but where does it saves the file?

\dev said...

I got it, its saves to default max folder for screen shots!!

pgallo said...

I am a Max/Mental Ray newbie and I've been having this problem! Thanks so much for the help, I can't wait to try out the script.

Oguz Birgoren said...

Thank you Zap.. How come such a Very Very handy tool/script like this cannot be a standard tool regarding the 32bit incapabilities. You're a life saver. You know you can sell this though :D..

Unknown said...

I have read these comments and still cannot find the folder where the images are saved... please help! Thx in advance...

ronWu said...

Hello Zap

Thank you for the script but I had a hard time to find where it puts the outcome -

this is the place where I found it.

C:\Documents and Settings\rwu\Mijn documenten(my documents)\3dsmax\sceneassets\images

Unknown said...

I finally found those images... I had to search my harddrive for all .jpegs and they turned out to be in a folder on my desktop called newfolder2... weird, but at least I konw where they are going now!

Thx for the great script!

Jonathan said...

Does this script work with a render farm? I am looking for a way to split up a huge image over a farm. I use the split scan lines option, but I still get blank buckets back, so I am looking for a way to ease the memory use or something.

Unknown said...

Nice script, however I have a problem with it. The tiles that I get don't match up nicely. I position them correctly on the center but then I see edges at the sides where the two tiles meet. Any workaround?

Unknown said...

NVM I figured it out, there's some bug in maxscript or your script.

Rocky said...

Hello, is there anyone who can tell me scripts related to Revit and Max Design 2009, which automate and optimize the revit model in Max.

Thomas said...

Hi!
The script really is useful, great work. However I get no overlap to the image tiles, if I write, say 10pixels, the image tiles do not change size.
As the previous poster I also have situations where tiles do not meet exactly, but the overlap will cure that I think.

/Thomas

David
Le Cardinal
said...

Nice Tip and works great!

small question: does the script put the tiles together when it's rendered? or do I have to get them in Photoshop (I did it, but I don't want do it everytimes :) )

If not, I learn Maxscript to do it :) :D

Pyro777 said...

Is there a way to create a rendering larger than 32,000 px wide?....say 36,000


Thanks,

Dean

Unknown said...
This comment has been removed by the author.
Unknown said...

We're having some issues with getting the right tiling; as noted in other comments, we can't seem to get the resulting tiles to match up precisely. Is this a "feature" of the #blowup and #region settings, or is there a bug in the script?

Anonymous said...

hi Ilike it very much, I hope you will soon update your work!thanks for sharing. Chat

Gavin Haywood said...

This works very nicely and now enables me to output a render at 4000px wide. My only issue is that I'm using it with Max 2011 and the renders come out much darker when using the script. If I click on the save icon mid render (script render) and save a half rendered image then it comes out fine. Any suggestions?

Sushanth said...

Resize your image to use it according to your convenience, with Online Image Resizer