Scene Optimisation: best practices?

marblemarble Posts: 7,500
edited October 2020 in Daz Studio Discussion

There seems to be some debate about what we can actually render with 6 or 8 GB of VRAM. It has been stated by several users that they hardly ever exceed the VRAM and that we should all learn how to optimise the scene properly. I've asked in some of those discussions what, exactly, we should do that we are not doing now. Here's what I do but it is clearly not enough because I struggle to keep my scenes within the 8GB limit of my 1070 GPU.

1. Run Scene Optimizer - especially on character skins. I have "SO versions" of every character I use in a scene - a version that I have run through Scene Optimizer to bring the texure sizes down to 2048.

2. Limit my characters to maximum of 3 in a scene. I hardly ever get away with 4 ... they mostly drop to CPU.

3. Try to use an HDRi which is low resolution. This is a trade off because, if I want the HDRi as a background image, low res does not look good. If I want it for lighting then I can use the low res versions.

4. Hide out-of-shot objects. I am not convinced that this helps much because I believe that the textures are loaded whether or not the object is hidden. I may be wrong.

5. Render smaller sized images and try to enlarge in post. I do this all the time but with varying results. I would rather render at full size but sometimes it just is not possible. I have not yet found a denoiser which does not spoil the look (by smearing out the detail or highlights) so I don't denoise.

Some suggestions that I need to experiment with further:

1. Rendering the room/environment separately from the figures and then compositing in post. I have tried this but struggle with placement, shadows, etc. I need to find a good tutorial.

2. Export to Blender. I'm not sure that Cycles is any more economical with VRAM than IRay but there are features in Blender such as Render Simplify and the Optix denoiser which would certainly help. The main drawback for me at the moment is that I have not been able to reproduce the image quality I get from IRay in Cycles. I know it is possible but the examples I have seen in the Blender sub-forum are usually achieved by people who know the Blender materials node system intimately. I don't.

The latest rumours that there will be no 16GB 3070 (nor a 20GB 3080) have really crushed my hopes of being able to render the scenes I would like to create. By the time that is possible I might be too old to manipluate the keyboard & mouse.

Post edited by marble on

Comments

  • PerttiAPerttiA Posts: 10,024

    What kind of scenes do you have that you have a problem with? list the contents

  • marblemarble Posts: 7,500
    PerttiA said:

    What kind of scenes do you have that you have a problem with? list the contents

    Any scene with up to 3 characters (usually G8 and/or G3 figures). These are clothed, with hair (either fibre or ribbon type hair but not dForce) and the skins have been optimised with Scene Optimizer. Most of my scenes are indoors so I try to limit the scene to just the visible room and not, for example, a whole set such as the whole Euro Apartment or one of the fully constructed Collective3D houses. I tend to use rooms I've assembled myself using the Collective3D packs such as this one:

    https://www.daz3d.com/collective3d-create-a-room-xpack-3

    For exterior scenes, I use HDRi as a background whenever possible but also some nature setting sets I have purchased. I will mention that I bought one of the Ultrascenery products but had to return it because, as soon as I added people, it immediately reverted back to CPU on my system. It also took a very long time to render even when it didn't drop to CPU.

    For interior scenes with furniture and props, I tend to use IRay shaders in preference to the included textures. I don't know whether this saves my any VRAM but these shaders often render faster than textures.

  • brainmuffinbrainmuffin Posts: 1,213

    I tend to set things up and then use the Scene Optimizer script (https://www.daz3d.com/scene-optimizer) and reduce based on how far away things are from the camera.

  • marblemarble Posts: 7,500

    I tend to set things up and then use the Scene Optimizer script (https://www.daz3d.com/scene-optimizer) and reduce based on how far away things are from the camera.

    Yeah, as I said a couple of times, I do use Scene Optimizer. However, I have never quite understood how the camera distance thing works. I usually optimise characters individually (because the skin textures are the VRAM hogs) so that I can import them into scenes already optimised because I don't want to be optimising each and every scene. So I doubt whether I could follow your workflow based on camera position.

  • PerttiAPerttiA Posts: 10,024
    edited October 2020

    As you are having problems with "all" of your scenes, even when you have optimized the textures, I don't think the textures in general are the problem.

    "(either fibre or ribbon type hair but not dForce)" - I don't think dForce adds the rendering load at all, but any strand-based hair will, as each and every one of the thousands of strands is processed individually.

    I would start looking at environment settings, rendering settings and the lighting in general - I usually remove all the light sources that come with the scene and use 3 spotlights indoors, environments settings "Scene only" and in rendering settings there is a choice between speed and memory...

     

    Edit: Forgot... A non-RTX card also uses more memory for IRAY

    Post edited by PerttiA on
  • jerhamjerham Posts: 155
    edited October 2020

    Scene optimizer also has a nice other feature. Setting the meshresolution lower/higher for specific objects (SubD level).

    In my experience thats works great as a first step. finding the right balance between those and the detail you want to see. A high meshresolution uses a lot of memory.

    - far away -> render subd level 0 or 1

    - fulbody -> render subd level between 1 or 3 depending on the scene

    - closeup G8 -> render subd level 3 or 4

     

    Post edited by jerham on
  • cajhincajhin Posts: 154

    I would add

    - restart DAZ before final render

    - set viewport to wireframe (sends a clear signal that textures are no longer needed for preview, I believe it helps)

    - disable the "denoiser available" setting. It takes memory just so you could turn it on during renders.

    - reuse figures/textures where possible. Often all distant figures can have the same skin and it is not noticeable. Just apply your "foreground figure's MAT" to all others.

    - remove bump and normal maps from distant figures, if you cannot see the details anyway

    - I find the Render Throttle script useful. Lets you use different render settings in preview, and on final render it applies the exact render settings you specify.

    - iray section planes might help (have never used it myself)

  • IvyIvy Posts: 7,165
    edited October 2020

    Scene Optimizer is a great product . it takes a while to set up and you need to make a directory folder for storing Optimize Textures and settings. & it has add or remove or reduce other mat option. & its great for using Scene Optimizer for creating animation

    Another resource saver I would like to recomend is Resource Saver Shaders Collection for Iray https://www.daz3d.com/resource-saver-shaders-collection-for-iray

    Its a great product for changing out high end 4k+ textures specially for skin on characters . its a very useful product for saving on gpu resoruces. But thats just my 2 cents

    Post edited by Ivy on
  • j cadej cade Posts: 2,310

    I'll add another tip - Is your character wearing pants and shoes? remove all the textures on the legs. I do this one so frequently I have a preset for it in my favorites menu

    same rule if you're rendering from the waist up or what have you

    hiding objects absolutely will stop their textures from loading -- if those textures arent used anywhere else 

    for characters I personally find SSS maps superfluous with you can set up material settings where you use the diffuse textures for both.

    Use DOF and anything thats out of focus can have tiny or no textures. For example I primarily use 4k hdris - generally too small to be used as anything more than lighting but you add some dof and can absolutely use them as background elements as the lack of resolution gets completely hidden by the natural blurriness of the dof.

     

    also strand based hair requires more memory for the geometry but not necesarrily more total as it generally uses fewer and smaller textures than modern transmapped hair. Additionally SBH generally requires fewer iterations to clear up so can actually render much faster (this is because layers of transmaps are actually much more complex to calculate) 

     

  • plasma_ringplasma_ring Posts: 1,025
    j cade said:

    I'll add another tip - Is your character wearing pants and shoes? remove all the textures on the legs. I do this one so frequently I have a preset for it in my favorites menu

    same rule if you're rendering from the waist up or what have you

    I do this all the time too and it really helps! 

    For compositing I usually set up the characters and scene all together the way I want and then render them out separately using Iray canvases, since those can render separate pieces of scenes exactly how they look with everything else around them. This gets kind of complicated, but if I have something like a room with a lot of background detail I hide everything that doesn't need to cast shadows on or otherwise influence the look of my character, then render out the character and crucial props they interact with separately. Then hide the character, unhide the rest of the room, and render that. I match up the character and their nearby props to the intact background and do any cleanup needed. 

    It's a pain but you can kind of render out scenes piece by piece by taking note of which parts of the scene influence each other with lighting/shadow/color and hiding everything but that when rendering different chunks using canvases. There are some scenes where omitting anything would create hard-to-match changes, but thinking of scenes in layers is helpful for me. 

  • marblemarble Posts: 7,500
    edited October 2020

    Some really useful tips being posted ... thank you all.

    Compositing still seems a bit tricky to me but I will have to give it some experimental time.

    This thing about hiding and VRAM is still confusing me though. Can someone explain the logic? I've seen it claimed that hiding reduces VRAM if the scene has not been worked on (but I don't know what that means in practice). Then there's the comment (above) about hiding being effective if the textures are not usesd elsewhere in the scene. Well, that makes sense because IRay would need to load any texture that is visible but is that the only condition that prevents hiding from reducing VRAM demands?

    All I can say is that when I have compared my GPU-Z numbers before and after hiding I see little difference (or, at least that was true when I last tried that). But then one self-proclaimed expert on this forum told me to ignore GPU-Z because those numbers don't tell the true story. All I know is that if GPU-Z tells me I am on the bordeline with my VRAM and I add something else to the scene, it will drop to CPU so I tend to trust the numbers.

    Of course, the thing about hiding is that the objects that hog the VRAM are not the ones I would normally hide - i.e. the characters in the scene. Hiding props and walls is all very well but they use minimal amounts of memory compared to characters. Also, my characters are almost always front and centre in my scenes so I want the detail that comes with normal maps, etc. I think that if I needed background figures I might look for some Low-res models or even learn how to make billboard people. But hiding legs under pants and removing SSS maps might be a possibility (again, could I get away with hiding or would I need to remove the maps?).

    Post edited by marble on
  • ZiconZicon Posts: 352
    For compositing I usually set up the characters and scene all together the way I want and then render them out separately using Iray canvases, [...]

    Am I understanding this correctly that you render out each character separately using canvases? What kind of canvas settings do you use to make that happen?

  • cajhincajhin Posts: 154

    When I turn my expensive figure's visibility on/off in an otherwise empty scene, I see the VRam usage go up/down by 1.5GB.

    Generally speaking, memory systems like to cache, they don't want to throw away useless stuff unless they run out of storage space, they might need it again sometime (sounds familiar? ;)
    This potentially affects the numbers; some combo of dazVersion+driver+card might decide to _not_ kick out the figure from VRam when you hide it, unless the card runs out of memory. On top, DAZ+nVidia probably isn't 100% perfect when it comes to discarding resources; that's why a restart can help, especially after longer sessions where lots of things have been loaded and removed.

    Things that are visible but off screen are still needed in memory - a red wall just outside your scene will cause a red tint from its reflections. That's where the iRay section planes can help to cut out a whole section of the scene in one go.

    What is very noticeable in my setup is that VRam hovers around 7.8GB (out of 8) pretty much all the time with bigger scenes, no matter what I do. Then it gets slower, then finally it switches to CPU.

  • marblemarble Posts: 7,500

    By the way ... on the subject of GPU-Z accuracy, I did a quick search and there is an interesting discussion about this very subject on (of course) the techpowerup.com forum:

    https://www.techpowerup.com/forums/threads/gpuz-vram-use-what-is-it-really-showing-us.250746/

  • marblemarble Posts: 7,500
    cajhin said:

    When I turn my expensive figure's visibility on/off in an otherwise empty scene, I see the VRam usage go up/down by 1.5GB.

    Generally speaking, memory systems like to cache, they don't want to throw away useless stuff unless they run out of storage space, they might need it again sometime (sounds familiar? ;)
    This potentially affects the numbers; some combo of dazVersion+driver+card might decide to _not_ kick out the figure from VRam when you hide it, unless the card runs out of memory. On top, DAZ+nVidia probably isn't 100% perfect when it comes to discarding resources; that's why a restart can help, especially after longer sessions where lots of things have been loaded and removed.

    Things that are visible but off screen are still needed in memory - a red wall just outside your scene will cause a red tint from its reflections. That's where the iRay section planes can help to cut out a whole section of the scene in one go.

    What is very noticeable in my setup is that VRam hovers around 7.8GB (out of 8) pretty much all the time with bigger scenes, no matter what I do. Then it gets slower, then finally it switches to CPU.

    Some interesting observations.

    IRay section panes: I use them but generally for cutting down render times because I don't want to waste processing time on objects out of shot (I also use them for letting in HDRi light with interior scenes). So you are saying that the section pane is equivalent to hiding where VRAM is concerned? If so, good to know.

    Yep, I've noticed that my VRAM jumps up to around 7.8 pretty easily. Trouble is that I get to that number with three characters and a few props. I can generally get away with adding a couple more props but no way I can add another character.

Sign In or Register to comment.