View Full Version : Floze knows but WHY?! (mr memory ?s)
shikijiyu 01-12-2007, 09:08 PM I was having problems rendering a poly-heavy scene with mental ray when I stumbled upon the "mental ray running out of memory" thread (an excellent thread, btw).
I read through the whole thing and was able to get my render to finish by following floze's advice set the memory limit to zero and turn on "export on demand" with a threshold of zero.
Can someone explain to me why this works? I get the export on demand thing, but why memory at zero?
Also, while it IS working, I cannot deny that it is pretty slow. I am certainly not complaining only yesterday it wouldn't render at all. So my second question is: given a scene which is already having memory problems while rendering, what would be the best starting place for adjusting variables to increase the speed? BSP size, depth (they are still at default)? Anything?
| |
bgawboy
01-13-2007, 03:50 PM
For anything but a 64-bit machine, I must disagree with setting the memory limit to 0. That means unlimited, and unless your scene fits entirely in memory, it should crash. The default of 800 is a pretty good starting place for rendering within the Maya UI on a 2G 32-bit Windows machine. I can sometimes get it up to 1400 if rendering standalone. Maya batch could be somewhere inbetween like 1000-1200 depending on how much memory the UI takes up.
I assume it was the other setting, export on demand, that actually saved you.
To improve it, we would need lots more information on your scene.
Maya/mr version?
FG/GI?
Rasterizer?
Displacements? What kind of approximation?
A description of how the geometry is distributed in your scene could help if there is anything needed for tweaking the BSP controls.
Have you run BSP diagnostics? Any red?
If so, try increasing the depth.
After that, try turning to large BSP, but only if you set a memory limit.
Also, how large are the individual pieces of geometry?
Small pieces make too much overhead. Large pieces make difficult flushing and reconstructing.
Maybe adjusting task size could help.
But what is your filter size set to, and your max samples size?
floze
01-14-2007, 03:40 PM
For anything but a 64-bit machine, I must disagree with setting the memory limit to 0. That means unlimited, and unless your scene fits entirely in memory, it should crash. The default of 800 is a pretty good starting place for rendering within the Maya UI on a 2G 32-bit Windows machine. I can sometimes get it up to 1400 if rendering standalone. Maya batch could be somewhere inbetween like 1000-1200 depending on how much memory the UI takes up.
I agree with you, but if I remember correctly there was a bug in maya 7 where the render (from GUI) simply stopped when reaching the memory limit - making it look like it crashed, though it just wanted to flush caches. That's why I suggested using unlimited memory, to generally avoid the flushing. I'm still not sure under which circumstances and constellations the flush-crash occurs, some people seem to be fine with it, others (like myself) not. In any case it always works in batch mode.
However I totally agree with you that unlimiting the memory usage is anything but reasonable with a scene that might inflate the memory beyond the known ceilings and/or the amount of physical RAM on a 32bit configuration.
Still, if you want to render the stuff from GUI, do yourself a favor and set all viewport shadings to bounding boxes, unload anything unnecessary, save the scene and restart maya. The hardware render vertex buffer can take craploads of mega- and gigabytes, which can be easily avoided by using bounding boxes.
As a last but expensive resort, get a 64bit machine and the maya 8 x64 version. I've pushed it to 12GB memory consumption on such a monster, and I just didnt go further because the physical RAM was at 12GB and I couldnt see anymore after that because of the tears in my eyes.. ;)
bgawboy
01-14-2007, 05:23 PM
Some extra detail with respect to the integration into Maya and the memory limit.
In order to prevent a crash of mental ray from crashing Maya, there is yet an extra buffer zone of memory specified to Maya. It is the percent over the memory limit that Maya checks to see if it should terminate the render.
In Maya 7, this was fixed, and possibly too small, which may explain the behavior you described above. You had to enable a hidden attribute to try to adjust it.
In Maya 8, it is only somewhat hidden. You can adjust it if you go into the AE for the mentalrayGlobals node (not the Render Globals window). At the bottom, in the Extra Attributes section you'll see Memory Zone. The 20 means at 20% above the memory zone will tell Maya to abort the render. So if memory limit is 1000 Mb, then when mr tries something that increases memory beyond 1,200, instead of trying to make it, with appropriate flushing, etc., it will terminate the render.
Also, you'll see Memory Auto as a check box. I'll double check what that means. Its possible this takes away the extra buffer zone, so that crashing mr will crash Maya. [No, it doesn't, it's a great feature for setting memory limit. See my further posts below.]
floze
01-15-2007, 03:28 PM
In Maya 8, it is only somewhat hidden. You can adjust it if you go into the AE for the mentalrayGlobals node (not the Render Globals window). At the bottom, in the Extra Attributes section you'll see Memory Zone. The 20 means at 20% above the memory zone will tell Maya to abort the render. So if memory limit is 1000 Mb, then when mr tries something that increases memory beyond 1,200, instead of trying to make it, with appropriate flushing, etc., it will terminate the render.
Aha, seems to work just fine, both in maya 7 and 8! For anyone who missed that attribute in maya 7, it is enabled by adding the dynamic attribute memoryZone to the mentalrayGlobals node:
addAttr -ln memoryZone -at long -dv 20 mentalrayGlobals;
I suppose it possibly unstabilizes mayatomr, I encountered some 'unknown tag' errors while experimenting. One question though, does it have any effect on a batch render at all?
bgawboy
01-15-2007, 06:18 PM
More information on Memory Auto.
By having Memory Auto on, Maya will calculate how much the memory limit should be by finding out how much memory it is using. Pretty useful. :)
bgawboy
01-15-2007, 06:27 PM
Memory Mode
Finally, in Maya 8 there is an attribute which you can set to specify the behavior (or action) you want to perform when memory goes out of the zone specified by memory zone.
(attribute: memoryMode (integer))
By default this action is 'try to abort mental ray'
A value of 1, named 'report' lets it crash Maya with a report.
A value of 4 is interesting. It tries to unload all Maya file references to make room.
If you are interested in trying it out, it'd be great to hear some feedback on how well it works.
Ash-Man
01-16-2007, 02:45 PM
jus as a note,
from Maya 8.5 docs
Memory
Auto Memory Limit
If Auto Memory Limit is enabled, Maya dynamically calculates the memory limit prior to the start of rendering. This feature can be enabled at all times to obtain better performance.
Tip
For limited memory situations, this setting is recommended.
To view the calculated value, ensure that Export Verbosity is set to Info Messages in the Translation section of the mental ray tab of the Render Settings window. The calculated Memory Limit is then displayed in the render log.
Memory Limit
Soft limit for the memory used by mental ray. A soft limit implies that mental ray may actually use more memory than indicated.
bgawboy
01-16-2007, 03:48 PM
Important note about Memory Auto.
I found that it is not implemented in Maya 8, even though it is in the Extra Attributes of the mentalrayGlobals node.
As noted in the post above, it is in Maya 8.5 which just came out.
Also the complete list of values for the memoryMode attribute are:
0 MemoryNone, // ignore
1 MemoryReport, // report
2 MemoryInquiry, // ask how to react
3 MemoryAbort, // abort rendering
4 MemoryRelease // release other mem
shikijiyu
01-16-2007, 06:26 PM
Bgawboy,
This thread has already evolved quite a bit. But if you are still interested in giving me some advice as to the best course of action for increasing the render speed of this scene, I would still love to hear it.
The scene was just a test of a large array of nurbs spheres (~2000) on a flat poly plane with an IBL sphere around it. The plane was set to a generic lambert and all the spheres were assigned a mr dgs material. In addition to the IBL sphere there was also a large area light above the scene with raytracing enabled. I had to crank up the number of shadow rays (~300-500?) in order to smooth out the shadows from all those nurbs spheres. I am positive that the source of the memory issues is due both to the high tessellation settings mr uses for nurbs (and I have many nurbs spheres but I wanted them smooth in case I wanted to print a large resolution render), as well as the cost of raytracing high quality reflections with a ton of shadow rays for all those nurbs spheres.
I am using Maya 7.0 with whatever default version of MR that comes with. The scene would only render within Maya if I lowered the final image resolution to 640x480 and set the default mr quality setting to preview or lower. I was only able to squeeze out a full 1024 "production" level render from the command line. As such, I never even started messing with FG or GI. There are no displacement maps being used and I am unsure what you mean by "rasterizer."
So
yeah. I have been using the default "production" quality settings. So the filter and task size are both set to default. I realize I could almost certainly improve performance by taking those spheres furthest from the camera and converting them to less smooth polygons. But I am more curious as to the best approach for improving rendering in general. Your information on BSP adjustments using the diagnostics tool, for example, was MASSIVELY helpful (I didn't even know how to get started adjusting the BSP).
As to the physical memory setting, does anyone have any good advice for setting it to something other than zero (if, indeed, that is the best course of action)? Could I potentially open up the task manager while I have Maya running, with the scene open, and just set the memory to whatever is still available? Likewise, could I run the task manager with Maya closed and find out a suitable setting for the memory when doing command line renders?
So if I am having that horrible problem where mental ray just seems to suddenly stop rendering, the best place to figure out what is happening is
where? First turn on detailed info for the output window? Find out why the error is happening? Then adjust the memory setting? Toggle the "export on demand" setting? How about the "Export polygons" setting, I think I heard that mentioned previously? Or would it be better to start wit the BSP?
And Auto Memory Limit, is that only for Maya 8? I am not particularly excited to be doing all this memory adjusting and screwing around. I would very much like to figure out the ideal settings for my setup (even if I need two such ideal settings one for regular and another for command line rendering). But ideally I would prefer to not mess with it at all. Do I have any hope?
I remember the days when I used Bryce to render ridiculously complex scenes with hundreds of millions of polys. It would crawl along at a snails pace but it WOULD render (in a week or so but hey). Why can't I get Maya to do the same?
Alright. Thank you all for the awesome info and sorry for the 32458972435 page post.
Ash-Man
01-16-2007, 08:00 PM
.
Also the complete list of values for the memoryMode attribute are:
0 MemoryNone, // ignore
1 MemoryReport, // report
2 MemoryInquiry, // ask how to react
3 MemoryAbort, // abort rendering
4 MemoryRelease // release other mem
how do you set these values up ?
I tried lokking for the att mentalrayGlobals
its not under the AE of mentalrayGlobals, is it ?
bgawboy
01-17-2007, 11:49 PM
In Maya 8.5, attach the memoryMode attribute to the mentalrayGlobals node.
For more info, check out scripts/others/mentalrayMemory.mel for what it does when == 4.
bgawboy
01-18-2007, 12:18 AM
Shikijiyu, I'll try to be brief and stick to the memory topic..
For Maya 7, I highly suggest to use the default memory limit around 800 for interactive rendering within Maya to the render window. For Maya 8.5, use the Memory Auto feature.
For your scene with nurbs spheres, I bet you are doing a lot of unnecessary tessellation. Try view dependent approximation. Its not what mr does, it is what you tell mr to do. :)
The rasterizer is what is used when you choose scanline -> rapid.
More verbose reports are always useful in problem solving. :)
CGTalk Moderation
01-18-2007, 12:18 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2009, Jelsoft Enterprises Ltd.