I am trying to pass "volume._data" to my fragment shader in threeJS. It is a Float32Array and it can contain up to: 512x512x512x4 elements.
var mat = new THREE.ShaderMaterial({
uniforms: {
color: {type: 'f', value: 1.0},
ijk: {type: '??', value: volume._data},
dimensions: {type: 'vec3', value: volume._dimensions},
ijktoras: {type: 'mat4', value: volume._RASToIJK}
},
vertexShader: document.
getElementById('vertShader').text,
fragmentShader: document.
getElementById('fragShader').text
});
The problem is that I do not know which type to give it. Or is the best option to pass a 2D texture?
My concern with the texture is that it will be too big to be passed to the shader.
Is there any workaround to pass this amount of information to the shader?
My overall goal is, in the fragment shader, to map the screen pixel position to the object world's coordinate. And then map this world coordinate to my volume._data (ijk space) to display on the screen a specific color.
Thank you, Nicolas