• About us
  • Contact Us
  • Terms and Conditions
  • Forum
  • Materials
  • Shaders
  • Tools
  • Video
  • Learn
  • Gallery
My Mental Ray

Navigation

  • Main Page
  • Cookbook

MYMR WIKI Tools

  • Creating pages
  • Markup n styles
  • Page protection
  • Help

 

Toolbox

  • Upload file
  • Special pages
  • Printable version
  • Permanent link
Article    Discussion    View source    History   
Personal tools
  • Log in / create account

High resolution images

From Wiki

Jump to: navigation , search

/////// DRAFT ////////////

You are here: mental ray cookbook / rendering high resolution images

Contents

  • 1 Introduction
  • 2 32bit vs 64bit
    • 2.1 Fragmentation
  • 3 Memory and Rendering
    • 3.1 Symptoms
  • 4 Possible approaches
    • 4.1 Tips & Tricks
  • 5 External links

Introduction

Rendering very high resolution images (larger than 2k) can be challenging, not only because render time increases quadratically, but also because large amounts of memory are needed.

When mental ray runs out of memory, this can produce a variety of effects. mental ray might bail out with an error message, your rendered image might contain black squares from render buckets that ran out of memory or 3ds Max may even crash.

Another problem that can occur then rendering high-res images is that mental ray cannot allocate enough memory for the framebuffer. Apparently, both 3ds Max and mr request a full framebuffer when rendering, regardless of whether the Virtual Frame Buffer of 3ds Max is visible or not. So rendering at higher bit depths (e.g. floating-point) will make this problem worse.

32bit vs 64bit

Of course, memory problems are no longer an issue when using 64bit software and enough RAM. Still, for any 32bit software, the theoretical virtual address space is limited to a maximum of 2^32 = 4GB. On standard 32bit Windows, this is even reduced to 2GB. You can try to use the /3GB switch to allow a maximum of 3GB, but that's it (and this only works if the software was compiled with a special compiler option and all of your hardware drivers cooperate).

Fragmentation

The memory problem is made worse by something called "memory fragmentation". It can happen that Taskmanager reports lots of free memory and yet you get an 'out of memory' error, simply because your application requested a large consecutive chunk of memory, and Windows simply does not have that. All the free memory is split up in smaller pieces. Rebooting Windows might fix that temporarily.

Memory and Rendering

There are many strategies of working around memory problems while rendering (rendering in layers, using level of detail, pre-computing data at lower resolution) which cannot possibly be covered all here.

Also, there is a lot of different data that requires different amounts of memory while rendering (geometry, shadowmaps, photon maps, final gather maps, frame buffer data, raytracing data structures (BSP), textures...), and each one could be optimized.

One key point in all of these is that mental ray tries to work around memory problems by keeping only those parts of the scene data in memory that really are needed for rendering the current bucket, and flushing other parts as quickly as possible - but not all data is flushable.

Symptoms

With mental ray in 3ds Max, you might encounter one of these problems:

  • you get an mr error early on, saying that it cannot allocate enough memory
  • some buckets of your rendering show up black whereas others render fine
  • mr and 3ds Max crash

Naturally, memory problems become more of an issue as you start using Global Illumination and/or Final Gather, since use additional memory to precompute the indirect illumination effects. If you use 'FG Point Density' to define the resolution of the Final Gather process, remember that this is measured in pixels, so as you increase your image resolution, you might want to lower your FG Density if you want to keep the same level.

Possible approaches

  • Use tiled .map or .exr textures (see High resolution textures): only the pieces of the texture that are actually required are loaded/unloaded on demand from disk to memory. If you also include a filter pyramid in the .map file, mental does not need to compute and store it while rendering, which saves time and memory.
  • Use object instances where possible; if you do and use 3ds Max 2009, you should switch to the new BSP2, which can handle instances much more efficiently. If you use the 'old' BSP, optimize your BSP settings; you can trade memory consumption for speed. See Optimized ray tracing for some more information on BSP. On older 3ds Max versions, switch to "Large BSP", which can be unloaded from memory but is slower. "Large" really means "Flushable" in this context.
  • Split image into subregions and render these; check out Zap's script for automatically splitting up the image
  • Open the mental ray Message Window and enable "Information" and "Progress" messages, which can also be saved to a log file that you specify in the mental ray Preferences window. It contains a lot of information that can be used to optimize your scene.

Tips & Tricks

  • Try using the rasterizer, or even scanline=off. The traditional "Scanline" acceleration structure is not flushable, so using scanline off actually helps on heavy scenes. (The rasterizer data is flushable)
  • Check what your "Memory Limit" in the Translator Options is set to. mr will try to abide by it and start flushing stuff when you hit it. Is it actually less than the amount of memory really available?
  • If many threads try to access many objects at the same time, these are all "busy" and can't be flushed from memory.
  • There is a certain amount of "per thread" memory needed, and each core gets at least 2 threads. This adds to the actual consumption of memory, which could explain why a lesser-cored machine can render that which a more-cored didn't.
  • If your scene contains lots of objects which are not seen from a single camera viewpoint, enable "Placeholder Objects" in the Translator Objects. This will cause each object being sent to mental ray as a mere bounding box and then only objects that really are needed will be pulled into memory on demand. See the LAmrUG notes on placeholders for some more details.
  • Be careful when using Final Gather and/or Ambient Occlusion and/or Glossy Reflections. All these can potentially cast a lot of rays in all kinds of directions, and thus could require loading a lot of the scene into memory. Try using ray distance falloff to reduce the range of the rays.

To do:

  • explain bucket width parameter
  • role of bitmap pager when using mr
  • role of 'use mental ray Map Manager' and 'Conserve Memory' option

External links

  • The LA mental ray user group has some detailed Memory Tips on the internal memory management in mental ray.
  • Doing BIG renders in max 9 by Zap Anderson has a MAXScript that will split up your rendering into smaller images which you can later assemble outside of 3ds Max.
  • Some general advise on Reducing Memory Usage To Render A Memory Hungry Scene by Neil Blevins
  • Windows Memory Allocation Limitations
  • Memory Support and Windows Operating Systems by Microsoft
  • Bruce Sanderson's General Windows Information: RAM, Virtual Memory, PageFile and all that stuff
Retrieved from "http://mymentalray.com/wiki/index.php/High_resolution_images"

Category: Mr cookbook

Copyright © 2008 My Mental Ray Community. All Rights Reserved.
No part of this website may be reproduced unless for personal use without prior written permission from The My Mental Ray Community.