Enabling volume rendering for a large volume makes the application crash

This indicates that you get a TDR error: the operating system shuts down applications that keep the graphics card busy for too long. This happens because the size of the volume is too large for your GPU to comfortably handle. There are several ways to work around this:

  • Option A: Run the code snippet above to split the volume to smaller chunks (that way you have a better chance that the graphics card will not be unresponsive for too long) or increase TDR delay in the registry.
  • Option B: Crop and downsample your volume using Crop volume and volume render this smaller volume.
  • Option C: Increase TDR delay value in registry (see details here)
  • Option D: Use CPU volume rendering.
  • Option E: Upgrade your computer with a stronger graphics card.

You need to run the code after you enabled volume rendering.