Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use Float64Array instead of Float32Array in THREE.BufferGeometry

I am having some trouble with BufferGeometry since it uses Float32Array to specify positions. The values i need to plot ( Using THREE.Points ) are large numbers for example "2732124.760877" and i loose most of the precision when using Float32Array and when i tried to use Float64Array instead the plot gets all jumbled up. Is there a way i can use Float64Array instead of Float32Array.

If you want to see what happens when you change from Float32Array to Float64Array try changing the Float32Array into Float64Array in the following jsfiddle (line 43)

buffer_geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float64Array(lines * 3), 3 ));

buffer_geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array(lines * 3), 3 ));

http://jsfiddle.net/pulasthi/sr3r92hy/1/

like image 887
pulasthi Avatar asked May 10 '26 01:05

pulasthi


1 Answers

no, look at the WebGLRenderer implementation

when geometry attributes are parsed it checks with this condition

else if ( array instanceof Float64Array ) {
        console.warn("Unsupported data buffer format: Float64Array");
}

WebGL does not provide a way to pass double precision 64bit number arrays. if you really need that precision and your GPU supports double precision numbers

you could somehow pass 2 32bit numbers you created bit by bit and in shader convert them into a double, but i have never tried something like this..

like image 140
Derte Trdelnik Avatar answered May 12 '26 13:05

Derte Trdelnik