3

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/

pulasthi
  • 1,730
  • 1
  • 17
  • 29

1 Answers1

3

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..

Community
  • 1
  • 1
Derte Trdelnik
  • 2,656
  • 1
  • 22
  • 26
  • Thanks for the information. I found a solution to my problem by reducing a calculated mean from each data point. – pulasthi Jul 21 '16 at 22:17
  • thanks @pulasthi, I'm working through a similar issue rendering 3D starfields, are there any links/resources or additional info you could provide about the implementation that worked for you? thanks so much. – user768680 Mar 27 '17 at 17:38
  • In my case the points where locations and i subtracted the mean of all the points from each point. This gave me smaller numbers to work with . I am not sure if that will be an option for you. let me know if you are still not clear regarding what i did. – pulasthi Mar 28 '17 at 16:26