Depending on the scene setup, V-Ray GPU might reach high VRAM consumption due to scene complexity, which might end up with an Out-Of-Mem error. Adding a GPU device with more VRAM to the machine is always the best option to resolve the issue. But if that is not an acceptable option you may use the following techniques to reduce the amount of VRAM used and eventually render the scene without Out-Of-Mem error.
There are several ways to monitor GPU Memory Usage and Utilization if needed:
- V-Ray GPU reports how much memory is used for Textures/Geometry/Light Cache/etc in the V-Ray log
- 3rd party utilities like MSI Afterburner and EVGA Precision provides detailed information about GPU Memory Usage and Utilization
- Nvidia-SMI command line utility comes with Nvidia drivers installation
Using Chaos Cloud service
Chaos Cloud is a brilliant option to render projects which can't fit into a local machines' memory. It's a one-click solution that will help you render the scene without investing in additional hardware or losing time to optimize the scene to use less memory.
Using NVlink when hardware supports it
The latest Nvidia technologies allow stacking Memory Amounts from multiple GPU devices together. NVlink technology enables V-Ray to use GPU Memory from all NV-linked GPU devices as a single unit which makes it possible to render much more complex projects without hitting Out-Of-Mem error.
More information about NVLink performance could be found here.
V-Ray GPU allows you to apply on-the-fly optimization to the project textures. There are three different texture modes.
- Full-Size Textures. This mode will not apply any optimizations to the textures and it is recommended only if projects fit in the available GPU Memory
- Resize All Textures. This mode allows you to resize textures to smaller resolution and bit-depth which will help reduce Memory Usage
- On-Demand Mip-Mapping. This mode will force V-Ray to load textures in a very intelligent way, in the appropriate resolution and only if it is needed. The main benefits are significantly less Memory Usage and faster loading times.
More information about On Demand Mip Mapping could be found here.
Using the GPU device with the highest Memory Amount
Although V-Ray GPU is compatible with different GPU models and brands there are certain limitations in terms of Memory usage. If multiple GPU Devices are available, V-Ray GPU is limited by the GPU with the lowest amount of VRAM.
If Out-Of-Mem error occurs and your hardware setup consists of GPU devices with different Memory Amount, you may try excluding the GPU devices with less Memory and render the project without them. This way V-Ray will be able to fully utilize their Memory.
Render in separate passes (foreground/background)
This technique is very useful for extremely complex projects where all other Memory Optimization techniques fail to help. Rendering in passes means splitting the scene into separate sub-projects. The most common approach is to render the Foreground and Background separately and then merge both render outputs in a Compositing/Image Editing software.
Optimizing project geometry
Optimize dynamic geometry. Hair/Fur, Displacement and Subdivision objects tend to consume a lot of memory. Displacement and Subdivisions are also dependable on the image resolution, the higher the resolution is the higher the memory consumption will be. Make sure the geometry generated by these features is with reasonable polygon count otherwise it could fairly easily eat the whole memory.
Remove unnecessary/out-of-camera view objects (If they are not specifically needed). It's not uncommon to have a project populated with lots of unneeded or not-in-camera view objects. Removing those will certainly help reduce the memory usage
Optimize regular geometry. Very often objects with unnecessary dense geometry end up in the project, those are usually assets gathered from external libraries. Optimizing those will definitely help reduce memory usage
Export to .vrscene and render with V-Ray Standalone
Host Applications just like V-Ray need some VRAM to keep the scene open and to operate with it. Depending on scene complexity Host Application may occupy a few gigabytes of VRAM which could be very valuable for V-Ray in case there isn't enough Memory for the Rendering. Exporting the scene to a .vrscene file and rendering it with V-Ray Standalone will minimize VRAM consumption by excluding the Host Application.
vray -sceneFile=“\\path\to\exported\scene.vrscene” -rtEngine=7
Note: this approach will reduce VRAM usage from the GPU devices connected to
monitors. GPU devices not connected to a monitor won't benefit from it.
Close other Memory Intensive applications
It's not unusual to have multiple applications open when working on a project. Although it's very handy to have all the needed apps up and running, this will also reduce the amount of memory available for the rendering process.
As mentioned above, this approach will reduce VRAM usage from the GPU devices connected to monitors.
Using GPU Hybrid Rendering with CPU enabled only
This is not very effective approach in terms of render times since V-Ray won't benefit from using GPU devices. However, if the scene is massive and there is no way to fit it into the GPU memory, it is still possible to render it with V-Ray GPU by using Hybrid Rendering with CPU enabled only.
More information regarding Hybrid Rendering could be found here.
Using V-Ray Proxies
V-Ray Proxies is a very powerful tool that is especially useful for optimizing scenes with a lot of geometry. They are not that Memory Efficient for the GPU rendering as they are for the CPU, but they allow replacing the original geometry in the scene with a simplified one. This alone may help reduce VRAM usage for the viewports leaving more Memory for V-Ray to work with.