Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] General Discussion => Topic started by: Duron on 2017-03-10, 12:50:29

Title: handle heavy scenes causing high ram usage (automotive)
Post by: Duron on 2017-03-10, 12:50:29
Hi,

i just want to know your experiences on how to handle heavy scenes with large amount of polygons at high resolutions and low RAM such as a 32GB workstation for example.

Since time pasts and the quality of the models gets higher and higher i'm running more and more often to max crashes if i want to render high resolution renders >4k with >30mil polygons (CAD files). I know that the internal resolution is set to 1 by default which is great but i need further optimizations just to get a more stable scene on rendering for production as i get crashes even at 2-3k without any displacement or render elements. I'm working on a 32GB workstation at home. Same scenes working fine at workstations with 96GB at work but i need to get workarounds for my 32GB workstation.   

I read at corona helpdesk something about "Reduce the total number of instances". Normally i prepare all my scenes by deleting all mirrorable parts and then mirror them as instance again. So now i'm a bit confused a little bit with that "Reduce the total number of instances". Which way is now better to reduce ram usage?

What exactly corona does when "lowmem" is activated? How much it can help for render above 4k?

What or how high are the benefits of disabling the VFB? Any drawbacks? Anyone with experience here?

No option:
satisfy with low res
reduce polygon size

Also i could imagine a "high res production" mode at corona which can be activated optionally where the VFB shows only a 10-20% image resolution just to see progress and have control on post process while corona renders internally a resolution like 12k. This could be really helpful as i know that from Autodesk VRED which already have this kind of feature.

Thanks for any tips or help!

Cheers,
Duron
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: pokoy on 2017-03-10, 14:13:07
I don't know how much geometry you have in the scene but this may help. Since you say CAD data - how do you get it into Max? Import as Body objects or already as mesh? If you are using Body objects, make sure you specify a reasonable render tesselation resolution and make sure it's not using different resolutions for the viewport and the rendering. Also, when you convert Body objects to Mesh/Poly they will have all their patches unwelded which will add a lot of memory overhead depending on the number of subelements. A good way to get rid of them is to weld with the ProOptimizer modifier (enable 'Merge Vertices' with a tiny threshold, leave everything else as it is, run 'Calculate' and convert to Mesh/Poly). Don't weld as Mesh/Poly command as this will invalidate explicit normals.

Using Render Elements will increase memory usage since it's allocates additional memory per element, this can easily add a few GB if you use a few of them at this resolution. As for VFB being displayed, I'm not sure how much overhead this adds.

Another option is to use Corona Proxy for each instanced mesh. And the term 'Instance' in the helpdesk probably means unique mesh, that's at least how the term is defined in other places such as Corona's MultiMap.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-10, 17:43:36
we have some slight memory optimization in plans for 1.6 (and already did some), but nothing drastic. The bad part is that 3dsmax efficiently doubles the memory usage by storing the entire evaluated scene and retaining it during and after rendering. We have yet to find out how to flush this copy
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: pokoy on 2017-03-10, 18:14:40
...The bad part is that 3dsmax efficiently doubles the memory usage by storing the entire evaluated scene and retaining it during and after rendering...
Ouch!
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Duron on 2017-03-10, 19:02:43
@pokoy
the geometrys are definetely mesh data, no nurbs.

@ondra
Too bad! But nothing is wondering me which has autodesk in it's name...
What do you think about the idea with a small render window? Is it generally possible to do something that way?
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-10, 19:05:14
i would love to do it, it would fix some other stuff (such as "Cannot create render output" message), but it is probably not doable in transparent way, so the UI would suffer
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: pokoy on 2017-03-10, 19:34:38
@pokoy
the geometrys are definetely mesh data, no nurbs.
If the data came from CAD, you might still want to check for separate elements within the meshes, if there are lots of unwelded vertices it might help a bit. But probably it will be more effective to sacrifice a render element.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Duron on 2017-03-10, 19:41:04
Silly about that memory issue which remains after rendering. I just noticed that the ram usage is decreasing slowly if you leave max for a while which is also really strange.

How is the denoiser stressing ram usage here? Does the denoiser causing higher ram usage after rendering compared to the actuall render process? This could also be an indication for the crashes i get over night. I guess the rendering itself is just good, but the denoiser then leads to the crash, because more ram is needed. Correct?

@pokoy
i think this can really help but the amount of worth i have to do together with that risk to destroy the normals which is generally a problem with 3ds max with cad mesh is questionable.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: pokoy on 2017-03-10, 19:55:47
@pokoy
i think this can really help but the amount of worth i have to do together with that risk to destroy the normals which is generally a problem with 3ds max with cad mesh is questionable.
Hence the ProOptimizer workaround - it'll respect and keep normals intact. Maybe useful for future projects then ;)
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-10, 22:17:04
denoiser requires about 4-5 additional render elements to be allocated, so it can actually make a big difference for large resolution renders
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: chilombiano on 2017-03-11, 03:48:51
damn! So 32GB is low ram ? :)

I don't know about how things come from CAD but always found tha Max sucks when dealing with simpy too many objects independent of the poly count. and would say that scene and the moment the renders starts to kick out improves a lot by collapsing things like crazy. like a whole building . don't know why but it works for me.
There is an old very handy script called DANDG_Collapse. It screws the uv's in some rare cases but generally gives a nice single mesh with a multi material in seconds.
Or you could split the scene and try Xref. gross.


Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: FrostKiwi on 2017-03-11, 09:48:53
Would the V-Ray framebuffer trick (https://docs.chaosgroup.com/display/VRAY3MAX/Frame+Buffer+Settings#FrameBufferSettings-Overview) work in Corona aswell, if Corona had it's own way of inputting Resolution or did Corona already fix, what V-Ray couldn't?

Quote
Due to technical reasons, the original 3ds Max frame buffer is still created at render time even if rendering to the V-Ray Frame Buffer. However, when the V-Ray Frame Buffer is enabled, V-Ray will not render any data to the 3ds Max frame buffer. To preserve memory consumption when using the V-Ray Frame Buffer, the following settings are recommended:
  • Under the Common tab Output Size section in the Render Setup window, set both Width and Height to low values such as 100.
  • In the V-Ray Frame Buffer rollout (described on this page), disable Get resolution from MAX and enter the desired Width and Height values along with any other needed information such as Image aspect.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-11, 20:04:48
i can probably do the same trick - but not in "UI smooth" way :/
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: FrostKiwi on 2017-03-12, 08:42:00
i can probably do the same trick - but not in "UI smooth" way :/
Maybe hide it in devel tab, because if I render in 4k vs 8k, my usage goes from 8gb to does not fit into ram anymore.
For these special cases maybe, who are willing to dig into the Corona UI, to get the render going at all.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: romullus on 2017-03-12, 10:21:21
+1
Yes please, if there's choice to be able to render at higher resolution even with crippled UI or not to render at all, i'd choose former. As long as there will be ability to have normal UI at lower resolution renders of course.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: arqrenderz on 2017-03-12, 15:21:22
+1
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Rhodesy on 2017-03-12, 23:11:20
I think C4D also keeps a copy of the scene in RAM too which sucks. I used to use a trick with Vray a few years ago where you just close your scene once the render had started and you could save some RAM but you had to be careful with IES lights. But from what I have learnt about Corona is that it continually still has to sample all the C4D native shaders that are being used in the scene. So Im guessing if I close the scene in the background they will not be read anymore?

Either way I find my 64GB soon fills up on highish res scenes with lots of layers which can be a real pain as it always happens when you are nearing the end of the scene creation and just want to hit render and leave.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Frood on 2017-03-13, 10:06:54
doubles the memory usage by storing the entire evaluated scene and retaining it during and after rendering.

Regarding memory usage and evaluated scene:

This one puzzles me since the day it poped up: https://corona-renderer.com/bugs/view.php?id=1947
Unfortunately there is no conclusion (at least on mantis). It has always been my understanding that the renderer gets a evaluated scene for a given frame/tick only - at least for simple geometry without any animation.

However rendering that scene as is and after collapsing everything to stack result leads to ~40GB vs. ~10GB(!) max working set.

It seems that the complete stack history is passed to the renderer (?). This means if we have trouble rendering complex/large scenes there could be a one-button "solution" (destructive) named "Collapse" from the Utility panel? Isn´t this something that should happen anyway when the scene gets evaluated?


Good Luck


Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-14, 10:33:05
I can only speak for Corona, but Corona does not request nor gets nor stores anything with history - we get flattened triangle mesh after all modifiers, end of story. It is however possible 3dsmax stores something extra when we request this. Quick hunch: erasing undo history might help?
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Frood on 2017-03-14, 11:13:34
Well... no. The scene from issue #1947 is a very good example:

1. Restart max, open it, render it: 40 Gigs.
2. Open it, collapse stacks, save it, restart max, open it, render it: 10 Gigs ram...

And with "history" I was just refering to some existing modifier stack, not to the undo history.

Good Luck


Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Charlie Nicols on 2017-03-14, 19:04:52
I posted here about this, https://forum.corona-renderer.com/index.php/topic,6176.0.html . See for test results.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Frood on 2017-03-15, 08:49:25
Yes I´ve seen this but there is nothing unusual with your tests imho (including max staying at high ram usage after a render). I´ve done something similar (https://forum.corona-renderer.com/index.php/topic,12285.msg79104.html#msg79104) for v1.4 and while it´s all expected, you have to be aware of what happens if you activate adaptivity/denoising. Doesn´t mean that there is no room for improvement though. Afaik there are some ideas in the drawers to lower cVFB memory consumption generally.

But the problem with the mentioned scene above is about just geometry with collapsed stack vs. geometry with some modifiers in the stack. Black Max magic maybe.


Good Luck



Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Charlie Nicols on 2017-03-15, 10:35:49
Yes I´ve seen this but there is nothing unusual with your tests imho (including max staying at high ram usage after a render).

So you are telling me for one of the most basic scenes you can make in 3DS MAX combined with Architectural Visualisation production ready render settings I am going to struggle with corona and machine with 32GB worth of RAM?

Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Frood on 2017-03-15, 11:20:38
I´m telling you another thing: You are not alone :) You can waste every ram on earth with high resolutions and additional passes. I can easily fill my 64GB box rendering a Max teapot with 4 segments.

But as mentioned, VFB memory allocation is another story.


Good Luck

Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Juraj on 2017-03-15, 19:46:03
You are not alone :) I can easily fill my 64GB box rendering a Max teapot with 4 segments.


:- )

I am not sure if this is more of pub bragging ( "that is nothing, I can do....") or alcoholics anonymous meetup ( "I too waste my ram easily" ) but it cracked me up.

But yeah, 64 is the new 8.
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Ondra on 2017-03-16, 09:47:01
I can fill it with 3 lines of C++. 2 if I break our coding conventions :D
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Christa Noel on 2017-03-16, 10:12:27
 I can fill and break any ram in this universe with half of boiling teapot :D
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: FrostKiwi on 2017-03-16, 10:45:58
I can fill it with 3 lines of C++. 2 if I break our coding conventions :D
With April 1st coming up, please implement this to show up once every year.
(https://forum.corona-renderer.com/index.php?action=dlattach;topic=15211.0;attach=61051;image)
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: pokoy on 2017-03-16, 12:21:37
Love it, good one!
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Christa Noel on 2017-03-16, 12:23:44
Nice idea! Haha
Title: Re: handle heavy scenes causing high ram usage (automotive)
Post by: Frood on 2017-03-16, 18:05:10
please implement this

+1

But do not use your threeliner for this if possible, thank you.

Good Luck