mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
101.8k stars 35.31k forks source link

DataTexture3D doesn't work with NRRD UINT8 Volume #24679

Closed jrmartin closed 1 year ago

jrmartin commented 1 year ago

Describe the bug

I want to load a NRRD file whose data is formatted as UINT8, but when I try to load it onto THREE.DataTexture3D I don't see it on the canvas, and don't see any errors on the console. If I try the same thing with a NRRD file formatted as FLoat32, it works and I see it on the canvas.

Expected behavior

I would expect to see the NRRD on the canvas.

Platform:

Mugen87 commented 1 year ago

Can you please share a NRRD file with UInt8 data for testing and development?

jrmartin commented 1 year ago

Hi @Mugen87 , here is one NRDD file as UINT8

https://v2.virtualflybrain.org/data/VFB/i/0010/1567/VFB_00101567/volume.nrrd

Mugen87 commented 1 year ago

I've imported the file in webgl2_materials_texture3d, removed texture.type = THREE.FloatType; from the 3D data texture configuration and updated the camera settings a bit. The model loads and renders as expected, see:

image
jrmartin commented 1 year ago

@Mugen87 Thanks for that, I will retry it. One thing I did different from the webgl2_material_texture3D, is that I use a perspective camera instead of orthogaphric camera, which I'm reading doesn't work well with the volume rendering.

https://github.com/mrdoob/three.js/blob/dev/examples/webgl2_materials_texture3d.html#L64

Mugen87 commented 1 year ago

Yes, there is an issue for tracking this problem: #19308

But that should not be responsible for any data type related issues in context of DataTexture3D.

jrmartin commented 1 year ago

Thanks for confirming this should work @Mugen87, save me some headaches. I tried it again and it worked, it threw me off at first that I didn't see it render but that was because my laptop's graphic's card doesn't support textures this big. I confirm it work on my phone. I'm closing the issue.