How do out-of-frame objects affect render time and RAM use?
Bright Shadow
Posts: 63
Imagine that I have a scene with:
- 2 fully enclosed rooms that aren't connected in any way
- 10 objects in each room
- a scene camera in 1 room with just 1 object in frame
Here's what I've been assuming:
- Render time: scene room. Since Iray does realistic ray tracing, it has to account for out-of-frame objects that are in the same visible area—in this example, the scene room. So if I temporarily delete the 9 out-of-frame objects from my scene room, it helps render time (at some cost of lighting realism).
- Render time: second room. The second room as no effect on render time since it's not visible to my scene camera. So even if I delete that room and all its contents, it won't help render time.
- Video RAM use. If I want to avoid exceeding my video card's available RAM—which would force a CPU render—rules 1 and 2 apply. Temporarily deleting objects from the scene room will reduce video RAM use, but the second room has no effect since the video card isn't trying to render it.
Can anyone confirm whether some or all of those assumptions are right?
Thanks much.
Comments
IIRC everything in a scene — not just "everything in camera view" — is included in Iray render calculations and VRAM use. Yes, this means if you're rendering through a camera in one room, the other room will also be "rendered" but not shown, because the camera can't see it. There seems to be general agreement that you should delete anything in a scene that can't be seen by the camera, and can't affect the lighting on anything that can be seen by the camera (e.g. shadows, reflected light, etc.).
Note that this means you might have borderline conditions, where you have almost enough VRAM — sometimes you'll get it to work if you save the cut-down scene, close D|S (and WAIT until it's finished shutting dow) then restart and reload your scene. This makes sure any data from deleted bits and pieces isn't allowed to hang around and push the total scene requirement over your available VRAM.
Your assumptions are correct, although its a bit more complicated.
Most geometry is cheap relative to the cost of textures. One Genesis 3 character might take up around 50MB of video card memory for geometry and 1GB for textures as one 4096x4096 texture will take up 64MB of memory before any in memory compression that iray might be doing and you're likely to have many of those for each character.
So, if you're removing objects from the scene that are light on geometry and have no textures or don't have a lot of large textures, the memory savings you get from them might be very small. If you have texture compression enabled (Render Settings->Advanced Tab->Texture Compression medium and high thresholds), you might be saving a lot of memory already as far as textures go and removing objects, even with textures, doesn't save much memory.
As far as rendering speed goes, removing objects is likely to provide for a faster render, albeit the savings might be so small you can't really measure it.
However, there can be circumstances where removing one or more objects slows the render up. For example, make a closed room out of a cube and put a pure white surface on it. Put a bunch of dark objects in it. Render the scene with all the dark objects in it and render it with some removed.
You're likely, not guaranteed, to find a situation where removing some of objects slows up the render. This would happen because of the rays bouncing around the room without hitting something to lose energy, i.e. hitting a lot of pure white (highly reflective) cube surfaces instead of the darker (low reflective) objects. It can cause iray to spend extra time either tracing rays unnecessarily or to adding noise that takes a long time to clear.
Note, NVIDIA recommends limiting the reflectivity of a surface to 0.7, about a 216 HSV/RGB value. My contrived example above ignores that recommendation and is likely to lead to pain of some sort whether you remove objects or not, .
For your example 2, another thing to take into account is how you're rendering your scenes. If you are NOT using NVIDIA Iray draw mode in a view port and you don't have any render windows open, every time you initiate a render, DS needs to send everything in the scene to iray. It takes a finite amount of time for DS to get all the geometry, textures, shaders, etc. to Iray and Iray needs to get all that into the video card.
If you have a few "light weight" objects in room 2, the time DS and Iray spend processing those objects is minimal, but if you have a couple of Genesis 3 characters (not light weight in this context) in room 2, that can noticeably add to the time it takes to setup the scene prior to it actually rendering.
If you are starting your render with a view port in NVIDIA Iray mode or you have a previous render window still open, the scene setup work is already done and hanging around in the video card memory, so what is in room 2 really doesn't matter if its all fitting into the video card.
Most of the time when I'm trying to do some quick test renders while I'm tweaking lights or surface settings, I render a small 512x512 image of the scene. I then leave this window open behind DS. While that window is open, the objects in the scene are all ready to be rendered and my test renders all happen quickly. Leaving a view port in NVIDIA Iray draw mode will do the same thing, but it can be hard to pose and do other tasks in a view port when its in that draw mode, unless you've got some monster hardward, which I don't.
Thanks much! This is great information.
For example, it didn't occur to me to close and restart DS after deleting objects, and I wouldn't have thought to leave an Iray window open in the background
I'll experiment with all of this and see what I learn.
You're welcome.
You don't normally have to close and restart DS after deleting objects. SpottedKitty is right though, if you've blown past what fits in video memory, many times DS won't clear video memory without restarting.
Also, if you leave render windows open, that keeps whatever is necessary to render the scene in video memory, even if you load a new scene in DS or delete objects in the current scene.
Hiding objects ("close the eye" in the Scene tab for the object, and its children if necessary, or toggling Visible in Render in the Parameters tab) will stop them rendering as effectively as deleting them from the scene. I normally make several groups for different classes of objects in my scenes. If you toggle the eye on the group, all of the items in the group will be hidden or visible for the render.