Volume Rendering of CT Scan

Hi Trying to do volume rendering of CT Scan of NRRD file

Not sure what parameters need changing from example at

  1. What texture format and type to use for int type above ?
    // texture.format = THREE.RedFormat;
    // texture.type = THREE.FloatType;

  2. Can the same viridis colormap be reused ?

NRRD file is here

Header is:


Complete NRRD file format specification at:


type: int
dimension: 3
space: left-posterior-superior
sizes: 512 512 313
space directions: (1.3671880000000003,0,0) (0,1.3671880000000003,0) (0,0,3.2700195312500009)
kinds: domain domain domain
endian: little
encoding: gzip
space origin: (-350.00000000000006,-350.00000000000006,-1050.2399902343752)

visvis renders this ok

Importing the NRRD file into webgl_loader_nrrd seems to work fine.

It would be:

texture.internalFormat = 'R32I';
texture.format = THREE.RedIntegerFormat;
texture.type = THREE.IntType;
texture.minFilter = texture.magFilter = THREE.NearestFilter;

You can’t use the code from webgl2_materials_texture3d since the respective volume shader is not able to sample integer textures so far. E.g. instead of sampler3D the shader has to use isampler3D. Since integer values are sampled form the texture, subsequent logic also needs to be updated.