# Volume rendering invalid texture dimensions

**URL:** https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917
**Category:** Support
**Created:** [August 5, 2020, 2:00pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917 "2020-08-05T14:00:55Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![mykolav](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mykolav/32/2177_2.png) [@mykolav](https://discourse.vtk.org/u/mykolav)
#### Post date: [August 5, 2020, 2:00pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/1 "2020-08-05T14:00:55Z")

</div>

Hi everyone, I’m using vtkSmartVolumeMapper to render volume. The resolution is about 4000 in each dimension. When I run the rendering I get ERROR: OpenGL MAX\_3D\_TEXTURE\_SIZE is 2048. Invalid texture dimensions.  
How does the vtk handle if the volume is bigger than opengl max texture size? Should I handle it myself? What are the ways to deal with it?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [August 5, 2020, 5:25pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/2 "2020-08-05T17:25:01Z")

</div>

> [@mykolav](#):
>
> How does the vtk handle if the volume is bigger than opengl max texture size? Should I handle it myself? What are the ways to deal with it?

Yes, the OpenGL2 rendering backend currently does not automatically downsample the volume, so if you have a graphics card that cannot handle large textures then you need to downsample the volume yourself. You can use vtkImageShrink3D or vtkImageReslice for this.

---

<div class="post-metadata">

### Author: ![mykolav](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mykolav/32/2177_2.png) [@mykolav](https://discourse.vtk.org/u/mykolav)
#### Post date: [August 7, 2020, 2:25pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/3 "2020-08-07T14:25:33Z")

</div>

Thanks for the reply. I actually don’t want to downsample the volume.  
I tried to use partitions inside vtkOpenGLGPUVolumeRayCastMapper, but it slowed down the rendering a lot. Better approach for me was to split the volume into blocks on the CPU and then use vtkMultiBlockVolumeMapper.  
My question would be, is there any vtk data structure that would load memory not contiguously, but strided, so that I wouldn’t have to split the volume in memory? Also any additional optimizations regarding this approach?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [August 7, 2020, 3:09pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/4 "2020-08-07T15:09:57Z")

</div>

What graphics card do you have? What is the current rendering speed with vtkMultiBlockVolumeMapper?What is the rendering speed with a volume downsampled to 2000x2000x2000 and 1000x1000x1000 if you use vtkGPUVolumeRayCastMapper?

---

<div class="post-metadata">

### Author: ![mykolav](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mykolav/32/2177_2.png) [@mykolav](https://discourse.vtk.org/u/mykolav)
#### Post date: [August 7, 2020, 3:22pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/5 "2020-08-07T15:22:20Z")

</div>

My graphics card (geforce gtx 1070) actually supports this big volume, but the customer gpu probably will not support these dimensions.  
The rendering speeds for 4112x3008x32 are as follow:  
whole volume with vtkOpenGLGPUVolumeRayCastMapper : ~150fps  
whole volume with vtkOpenGLGPUVolumeRayCastMapper and SetPartitions(2, 2, 2) : ~3fps  
partitioned volume with vtkMultiBlockVolumeMapper 2x2x2 : ~70fps

---

<div class="post-metadata">

### Author: ![mykolav](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mykolav/32/2177_2.png) [@mykolav](https://discourse.vtk.org/u/mykolav)
#### Post date: [August 7, 2020, 3:39pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/6 "2020-08-07T15:39:17Z")

</div>

I’ve found vtkDataTransferHelper which seems to do exactly what I want, but I’ve no idea how to integrate it into the pipeline with vtkOpenGLGPUVolumeRayCastMapper?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [August 7, 2020, 4:12pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/7 "2020-08-07T16:12:11Z")

</div>

> [@mykolav](#):
>
> whole volume with vtkOpenGLGPUVolumeRayCastMapper : ~150fps  
> whole volume with vtkOpenGLGPUVolumeRayCastMapper and SetPartitions(2, 2, 2) : ~3fps

I can confirm similar tremendous volume rendering slowdowns if I use `SetPartitions(2,2,2)`.  
@sankhesh is this expected?

> [@mykolav](#):
>
> I’ve found vtkDataTransferHelper which seems to do exactly what I want

Helper classes in VTK are typically intended for VTK’s internal use only.

---

<div class="post-metadata">

### Author: ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)
#### Post date: [August 7, 2020, 4:22pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/8 "2020-08-07T16:22:22Z")

</div>

> [@mykolav](#):
>
> whole volume with vtkOpenGLGPUVolumeRayCastMapper and SetPartitions(2, 2, 2) : ~3fps  
> partitioned volume with vtkMultiBlockVolumeMapper 2x2x2 : ~70fps

`SetPartitions` should be analogous to the MultiBlockVolumeMapper approach as all it does it splits up the volume into the request number of textures and streams each texture to the GPU. The only additional step that paritioning with GPU volume mapper does over multiblock volume mapper is sorting the blocks before rendering. Having said that, I don’t think the SetPartitions logic is stress-tested enough. I am sure there are areas of improvement there.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [August 7, 2020, 4:46pm UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/9 "2020-08-07T16:46:00Z")

</div>

@sankhesh Thanks for the information.

@mykolav It would be great if you could do some profiling and debugging to see what causes the slowdown with partitioning (or if you don’t have time or expertise but you need this feature then you could contract Kitware or someone else to do this work for you).

If vtkMultiBlockVolumeMapper works fine and the only issue is that you don’t want to split in memory then you could check if there is an image file reader that can read a partial volume, specified by requested extent (maybe vtkMetaImageWriter can do it?) and if you don’t find any then implement it yourself. For large images, it could be more efficient anyway to store images in a tile-based file format, maybe also at different resolutions.

---

<div class="post-metadata">

### Author: ![codeling](https://discourse.vtk.org/user_avatar/discourse.vtk.org/codeling/32/3792_2.png) [@codeling](https://discourse.vtk.org/u/codeling)
#### Post date: [July 4, 2024, 11:06am UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/10 "2024-07-04T11:06:39Z")

</div>

I just experimented with SetPartitions as well as it would be the simplest solution for large volumes, but also noticed the slowdown. Haven’t tried vtkMultiBlockVolumeMapper yet.

@mykolav did you arrive at a satisfactory solution for your use case in the end? I’m hoping to get some inspiration for mine 😉

---

<div class="post-metadata">

### Author: ![WangTurbo](https://discourse.vtk.org/user_avatar/discourse.vtk.org/wangturbo/32/8653_2.png) [@WangTurbo](https://discourse.vtk.org/u/WangTurbo)
#### Post date: [February 26, 2026, 5:57am UTC](https://discourse.vtk.org/t/volume-rendering-invalid-texture-dimensions/3917/11 "2026-02-26T05:57:41Z")

</div>

I’ve hit the same roadblock. I was wondering if you’ve had any success in finding a solution?
