Daz script to hide everything off camera?
Upirium
Posts: 722
in The Commons
Not sure if something like this exists but if it does I'd like to know.
Often times when I load in a premade scene I have to go around manually hiding the stuff I'm not using to save on memory (assuming that's actually nessicary) so like I said I was wondering if there's a script out there that does it automatically

Comments
There are at least 2 products I can think of:
https://www.daz3d.com/camera-view-optimizer
https://www.daz3d.com/camera-cutaway
This has been an often discussed point. Render speed and GPU memory usage are different issues. The Iray cutaway node does not reduce what is loaded into GPU memory, it reduces lighting calculations for objects outside of camera boundries which decreases render time. Also note that objects excluded from the render lighting calculations means they also do not interact with objects in the scene. For example, a tree that is "cutaway" from lighting calculations will no longer cast a shadow into the scene. If I need that tree shadow but don't want the tree calculated, then I would make a plane primitive in DAZ Studio and place a png on it which is the black silouette of a tree. I would angle the plane so it blocks the light as the tree would ... or wood.
"This product is for Iray only. Note that Camera Cutaways reduce rendering time but do not change the amount of GPU memory required." https://www.daz3d.com/camera-cutaway
"Objects that are found to be non-visible can be hidden or deleted and the action can be undone from the Edit menu. However, grouped instances can only be deleted (Daz Studio limitation)." https://www.daz3d.com/camera-view-optimizer
Additional note for Camera View Optimizer the statement "from the Edit menu." means using the DAZ Studio undo menu item. It is not a special feature in the tool.
https://www.daz3d.com/iray-stand-kit
You can speed up rendering by hiding objects because it reduces how many things require lighting calculations.
If you want to reduce the amount of GPU memory used, then you must delete objects and/or reduce size of textures. For example, reduce 8K and 4K textures down to 1K or 2K unless you are doing a close-up of the object. Also reduce subdivision (subd) of models to 0 or 1 unless they are close up. Every subd level doubles the size of the mesh loaded into your scene. You should also not use displacement or normal maps for distant objects.
All of these optimizations can be done manually. Purchasing DAZ tools to complete these tasks just speeds up the process. Even if you have an awesome card with loads of VRAM and you have triple the CPU RAM relative to the GPU VRAM, it is still beneficial to optimize your scene because it will render faster.
https://www.daz3d.com/scene-optimizer
Consider these tutorials if you want to know more about render optimizations.
https://www.daz3d.com/optimizing-daz-studio-memory-rendering-scenes-and-workflow
https://www.daz3d.com/daz-studio-render-engines--essentials-guide
Personally I use multiple saves of my scene.
1st save everything in the scene without optimization.
2nd save scene subsets that I might need to play with later. For example alternative outfits.
3rd save delete anything I don't want in the scene.
4th save optimize everything left in the scene.
One last point when I have the scene ready for full render, I will save it and shutdown DAZ studio, then restart DAZ Studio and reload the scene. Make sure all settings are correct for final render, then press render button and make "art". This is often done on my secondary computer which is slower but has the same CPU RAM and GPU VRAM as my primary computer. Doing this way means the secondary computer is only doing one thing, rendering and I can move on and work on something else.
https://www.daz3d.com/iray-memory-assistant
First a caveat – I buy many things and then, regrettably, do not get back to them as often as I’d like or should and, hence, tend to forget about them after initially exploring them. I have all of the products mentioned above. I do have Scene Optimizer and Camera View Optimizer on my Daz Studio toolbar though and do use them. I bought these products to help with RAM/VRAM on my laptop (Intel i7, Windows 10, 16 GB RAM, 6 GB VRAM). This summer, I bought a new desktop (Intel i9, Windows 11, 64 GB RAM, 12 GB VRAM) so I will not be as pressed for resources moving forward.
Another product that I bought that may be helpful to you in reducing RAM usage is Resource Saver Shaders Collection for Iray (https://www.daz3d.com/resource-saver-shaders-collection-for-iray); it’s currently on sale whereas Scene Optimizer is not.
Quick tips -
I'd never seen resource-saver-shaders-collection-for-iray before. If that's released for G9 I would buy it. As it is, the tips included in the promo-images, for "general Daz use" are great. Thanks for the heads up @jjoyner
One thing to keep in mind when it comes to removing things behind the camera or reducing textures of things far from the camera is that there is quite a large risk that an item behind the camera has an instance of the object in the camera frame as a lot of sets uses instances to lower the memory foot print.
Just something to think about. Aslo, reducing SubD level of things far from the camera is a good idea.
MMX Resource Saver Shaders Collection for Genesis 9 and Iray
https://www.daz3d.com/mmx-resource-saver-shaders-collection-for-genesis-9-and-iray
For the record, there are several other products in the series:
https://www.daz3d.com/mmx-resource-saver-shaders-collection-2-for-iray ==> eyes, skin, nails for G1 to G8
https://www.daz3d.com/mmx-resource-saver-shaders-collection-3-for-iray_Mattymanx ==> bricks, concrete, wood, marble...
https://www.daz3d.com/mmx-resource-saver-shaders-collection-4-for-iray ==> ground, leaves, rocks...
https://www.daz3d.com/mmx-resource-saver-shaders-collection-5-for-iray ==> metalic
https://www.daz3d.com/mmx-resource-saver-shaders-collection-7-for-iray ==> cloth shaders
Totte,
When deleting objects, Camera View Optimizer takes into account objects not in the camera view that have one or more instances in the camera view. In that case, it will not delete the node object that is not in the camera view.
From the Reference Guide,
Why do I see objects still visible even though they are clearly not visible in the camera’s viewport?
There are three possible reasons for this:
1. Any object that either has instances linked to it or is the parent of other objects will be automatically ignored. Hiding or deleting it will automatically hide or delete all the instances or children nodes.
2. Grouped instances are checked for visibility using their origin as they do not have a bounding box. The assumption is made that the origin is in the middle of the object. If the origin lies inside the camera’s viewing plane then the grouped instance will be flagged as visible.
3. A very large object like a tree close to the camera might have a large bounding box that intersects with the camera’s viewing plane. This is flagged as visible even though the object’s mesh itself is not visible.
I created a simple scene that has one camera, one yellow cube primitive and one green cube primitive that has two instances. I moved the green cube node behind the camera and launched the Camera View Optimizer command to delete those objects that are not visible (only to green cube primitive node). No objects were deleted; the green cube primitive node was not deleted because instances of it were in the camera’s view.
Further to jjoyner comment, from the user manual of Camera View OpTimizer.
The tool can understand and process instances and grouped instances. It will also automatically ignore specific nodes
that may result in child nodes being erroneously hidden
The following rules are used to determined if an object should be automatically ignored irrespective of the filter
settings.
• Any object that has instances or grouped instances derived from them
• Nodes that have child nodes parented to them. Figures and any parented child nodes are not ignored and
can be optimized if they fall outside the camera’s viewing plane.
• Group nodes
• Nodes that are of type DzBone
• Any type of light.