Render freezing

2»

Comments

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    Garstor said:
    I'm not saying this as a brag. I'm saying this because I think if you have a 64 bit system, then I think upgrading to C8.5 Pro 64 bit will fix your memory allocation errors. If you don't have a 64 bit system, then I think it won't help, because the underlying issue is the 32 bit system and the 32 bit version of Carrara you would be forced to use.

    Just an additional FYI about Windows memory management here. If you run a 32-bit process on 64-bit Windows, the virtual address space will increase to 4 GB -- double what you would have on 32-bit. However, you could experience additional crashes if Carrara was not compiled with the LARGEADDRESSAWARE flag -- because this extra virtual address space could be perceived as "illegal" at the >2 GB ranges.

    Why go to 64-bit processes on 64-bit hardware? Because then your process space increases to 8 TB - and that is an artificial limit imposed by Microsoft...64-bit address space can be far bigger than that still. So memory allocation errors on 64-bit is almost guaranteed to be exhaustion of physical RAM rather than exhaustion of virtual address space.

    Before C8, in the old forums, there was a stickied thread about the Large Address aware issue and a link to a LUAA (or something) script. Mac OS X was already large address aware, so we didn't have this issue.

  • InflaterInflater Posts: 0
    edited December 1969

    Hello again.

    Looks like this is going to be a longer thread. ;)

    Are all these textures saved internally? Have cleaned out unused and duplicate shaders? The fact that you build a scene from scratch and don't have these issues suggests that the original scene file has lots of data that's being retained. This could be a bug with Carrara or a scene management issue. Have you tried turning down the number of undos in the preferences. This can also be an issue. If you have it set too high, Carrara is forced to hold onto that data. It should be flushed when you quit Carrara.
    All textures externally. I don't see why I should waste memory in the saved file when all textures are already present on my HD. No unused shaders there.

    And no: The original faulty scene and the rebuild »from scratch« scene have exactly the same objects in the scene and use exactly the same shaders. The faulty one has a bigger memory print.

    Turning down the number of »Undos« sounds a good idea since I nearly never use it more than in the depth of 2 or 3 times. It's currently set to 16.

    I know you said you've been using Carrara fro five years, but it's obvious that there are some areas that you're not fluent in, just from the posts in your other thread. As an example, not knowing about being able to pause and resume a render. This is why I'm suggesting some things that maybe you know- because I don't know what you know´.
    To be honest: That's what I've NOT asked in the other thread. I've asked for »render continue« which is a complete different thing and is solely for the sake for saving precious render time. Think about »power loss«, »hardware failure« or simply »I need the PC for something different now«.

    Thank you for pointing me to the fact I am a noob in Carrara. That might be. You can be assured I am neither a noob in rendering (using 3D software for over 20 years now) nor in computer programming (doing this since 1980).

    The other example is the number of figures. You may not think that three Millenium figures has that high of a geometry, but they do. I seem to recall a V4 alone has over 60,000 polys. Add another and then an M4 or David and you're already pushing 200,000 polys. Not to mention the polys in their clothes or any other props you have in the scene. They can add up quickly. Add to that the image maps. I know C7.2 can handle it, as I've built scenes like that before, but it is making Carrara work and pushing its 32 bit memory limits.


    Well, we are living in 2013 not in 2003 anymore. V4 has around 70,000 vertices and around 60,000 polygons. Let's assume we are using 32-bit-floats for the vertices and for their vertice normals and 32-bit-integers for the polygon indexes which make up the polygons and let's assume further V4 is solely made of 4-sided polygons (just to push the memory boundaries).

    vertices: 70,000 x 4 byte (32 bit floats) = 280,000 byte
    vertice normals: 70,000 x 4 byte (32 bit floats) = 280,000 byte
    polygons: 60,000 x 4 byte (32 bit integers as indexes for the vertices) x 4 (sided polygons) = 480,000 byte

    That's ridiculous low 1,040,000 or roughly only 1 Mbyte to represent the figure in memory.

    Now on with the shaders. Let's assume I have textures with the size of 3000x3000 pixel. Let's also assume I need roughly 6 textures for the whole figure (skin textures, eyes, eyelash, hair, some clothing). Some textures are usually smaller (eyes, lashes) so I think we are not bad with 6 textures in the size of 3000x3000 pixel all in all. Let's assume Carrara internally uses 4 byte for each pixel (RGBA) of the texture. We get:

    6 textures x 3000 x 3000 x 4 (RGBA) = 216,000,000 byte

    This is again far away form any 2 GByte boundaries.

    BUT (!) when we take into account the number of »Undos« Carrara has to keep track off and the number of changes I made to shaders we can soon come to a limit. If there is a glitch in the internal memory management of Carrara this could be pretty much the reason for the Carrara behaviour.

    Again: Good point again on the number of »Undos«.

    This image has M4, the Mill-Horse and the Mill-Dragon, plus the clothes and armour, dynamic hair, a pretty complex terrain, atmosphere, volumetric clouds, three different Carrara trees, several surface replicators, a stone fence with displacement and a butt-load of procedural shaders and image maps. The Assembly room view was pretty sluggish navigating around in, but I never had a memory allocation error. ...
    That is most interesting to know.

    Very nice image btw. :-)

    Kind regards,
    The Inflater

  • FenricFenric Posts: 351
    edited December 1969

    A few observations...

    Your calculations, while reasonable for basic math, are far short of Carrara's internal usage. Carrara is a painfully academically correct C++ application built on top of a home-brewed COM-like reference counted system. Each vertex is a heavyweight object, implementing I3DExVertex (and a host of other interfaces). It is contained in a list in an IPolygon, in a list inside an IPolymesh, wrapped with an I3DExVertexPrimitive... and that's ignoring the rigging and morphing data.

    And while your shader calculation is closer to accurate, the internal texture representation is 16-bits per channel floating-point RGBA (8 bytes per pixel) stored (again) in a heavyweight object called TMCColorRGBA.

    I just tested, and on a fresh system, loading V4 took my Carrara usage from 128 MB to 274 MB: that's 146 MB just to load a bare-bones V4.


    Now, to your other point that the shader room leaks.

    Yes, I believe it does - getting a reference counted system perfectly clean is a hopeless task. You will get the best results if you disassemble complex shaders from the bottom up, leave "auto-refresh" off, and run "Remove Unused Shaders" frequently because it does a lot more than just drop things from the Master Shader list.

    Carrara is not a garbage collected system, it is a reference counted system, and the more you work in a way that minimizes dangling references, the less trouble you will have.

  • GarstorGarstor Posts: 1,411
    edited December 1969

    Fenric said:
    A few observations...

    I doff my cap to you sir! Excellent explanation as only a plug-in developer and/or DAZ code monkey could do it. Bravo!

  • InflaterInflater Posts: 0
    edited September 2013

    Thanks a lot for some in depth look at the internal data structures of Carrara.

    Fenric said:
    ... Your calculations, while reasonable for basic math, are far short of Carrara's internal usage. Carrara is a painfully academically correct C++ application built on top of a home-brewed COM-like reference counted system. Each vertex is a heavyweight object, implementing I3DExVertex (and a host of other interfaces). It is contained in a list in an IPolygon, in a list inside an IPolymesh, wrapped with an I3DExVertexPrimitive... and that's ignoring the rigging and morphing data. ...
    Ouch! That explains a lot.

    Fenric said:
    ... And while your shader calculation is closer to accurate, the internal texture representation is 16-bits per channel floating-point RGBA (8 bytes per pixel) stored (again) in a heavyweight object called TMCColorRGBA. ...
    I didn't knew that either - never looked into Carrara the SDK - but from this facts it's a bit emberassing Carrara uses internal floating point values for the colors while acting with integer values for example as input data for the »Value Percentage« in it's shader tree. I am pretty sure people seldom uses values higher than 30% for example in the »Shininess« path because the size of the highlights don't differ too much from 30% to 50%. Opposed to the drastic difference in look from 3% to 4%. Same goes with »Scale« parameters in the »Noise« shaders and in many more shaders. Yes, you can enter decimal fractions but Carrara rounds it to nearest integers.

    [Update]
    It's even more embarrassing Carrara calculates internally with 16 bit floats but isn't able to save this information into a finished file in a 16-bit-per-channel format ... except 16-bit greyscale. *sigh* So many unused potential.

    I just tested, and on a fresh system, loading V4 took my Carrara usage from 128 MB to 274 MB: that's 146 MB just to load a bare-bones V4.


    You are right, I just did the same with a bare V4 exported from Poser as an .OBJ so no textures. I have lower values but it's way higher than my expectation.

    Now, to your other point that the shader room leaks.

    Yes, I believe it does - getting a reference counted system perfectly clean is a hopeless task. You will get the best results if you disassemble complex shaders from the bottom up, leave "auto-refresh" off, and run "Remove Unused Shaders" frequently because it does a lot more than just drop things from the Master Shader list.

    Carrara is not a garbage collected system, it is a reference counted system, and the more you work in a way that minimizes dangling references, the less trouble you will have.
    Thank you for the FIRST real hint in this direction. My point is not Carrara does leak. My point is it obviously does corrupt the saved data.

    Which makes Carrara kind of unreliable. Especially for professional work (meaning: time constraints and earning money). And that's where we are now: I don't care for the internals of Carrara. I just know something's going damn wrong with it. And that's from someone who really likes Carrara. And I know from other render systems this is not the usual case: Use a program and pray everything goes well. And this was the basic reason for me to ask (in the other thread) about a list of correct or non-corrected bugs. If the programmers are not able to warn the user about a failure about to happen they should at least clearly point out it can happen.

    Kind regards,
    The Inflater

    Post edited by Inflater on
  • wsxcwsxc Posts: 19
    edited December 1969

    Fenric said:
    A few observations...

    I will add a few more :)

    The scene is not only figures and textures. It's also light and shadow. Reflection, refraction, transparency. Plus antialiasing. Plus filters. Plus Depth of field, Motion blur and so on.
    When I set all this option to minimum, Carrara does the render very fast and without any errors even if I have high-poly models (3xV4 + complicated room interior). When I set all this to maximum, even the simple cube (SIX polygons) need some time and memory to render.

    As about jargon. People have a right to use it. I become bored when somebody give me a long and detailed advice in reply to short question and this advice contains the explanation
    1)What the RAM is and how does it works
    2)Why the rendering requires a lot of memory
    3)How to check available memory and my system type (32/64 bit)
    and so on...
    If there are short and well-known terms to call particular things, it's much more easy for user to just read enough about them and for programmer/pro to just describe the problem solving in short terms. If the user doesn't undertand, he can always ask. Or check FAQ. They're called "Frequently asked questions", but in fact I call them "RRA" - Rarely readed advices. If the user will understand all the terms once, many pro's will save their time on explaining the obvious things.

    As about problem itself. I did a lot of investigation and found:
    1)Now I have 4 GB RAM instead of 2. Freezing became SLIGHTLY less often, though the memory expanded more than twice. Looks like it's a virtual memory issue.
    2)Freezing is not "slowing down". It's suspension. You can't move the render screen and can't switch back if you'll press Alt+TAB. You have to kill the Carrara process... and it consumes not so much memory at that moment!
    3)It happens not only during renders. When I move a lot of stuff in a short amount of time, Carrara freezes. I have to save the scene and restart Carrara before every render.
    4)Carrara has an internal memory management error. Because every next render has a less chance to success. Looks like it doesn't free all the memory used for previous render.
    5)The more time passed from the render start, the more chance to fail the render. I saw how the scene freezed at 16%. When I changed the settings to improve performance, render failed at 26%, 63% and finally succeed. One render failed on 92%, when it was processing the simpliest part of the scene... It means Carrara most likely has a memory management error, not just the lack of RAM.

    On the other hand, I found some ways to reduce the amount of problems:
    1)Set the Maximum undo level as low as possible. I rarely use more than 1-2, while the default value is 16. Imagine how much memory you need to store 16 changes of complicated objects, especially adding/deleting...
    2)System reboot HELPS more than Carrara reboot! I had a scene that failed 3 times though I restarted the Carrara, but succeed when I reboot the computer. Looks like Carrara produce a lot of garbage...
    3)Watch the lights count. When I played with the "Sun light", it made even the simpliest render very slow and unreilable, while the single standard light doesn't slow the render down too much.
    4)Disable Multi Threading! When I render with 2 threads, it often fails. When I use only one thread, it is two time slower but has much more time to succeed. I prefer a slow succes than a fast failure :D
    5)The most helpful: delete all the invisible objects. Normally, Carrara should "forget" about them during render. In fact, deleting them before render makes the process much faster and reliable. I have two version for every scene: "Scene.car" for example (where all the objects are in their places) and "SceneRend.car" where all invisible objects (for THIS particular camera view) were deleted.

  • wsxcwsxc Posts: 19
    edited September 2013

    And today I've found a VERY funny thing...

    When the render "freezes", you can't finish it even if you'll wait for a couple of hour. If you'll switch to another application, you'll be unable to switch back to Carrara. But when I press the power button, Carrara CONTINUES the work! :-)
    If I work with the scene, it asks me if I want to save the render. If the render is already started (and freezed), it continues! Unfortunately, after 3-4 seconds the system turns off so Carrara doesn't have enough time to finish the render. I think, there should be a possibility to let Carrara finish the job, save the result and then let the system to shut down...

    Post edited by wsxc on
Sign In or Register to comment.