question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Precision issue with r49

See original GitHub issue

I updated my Three lib to r49 but i’m dealing with many precision issue when rendering my old scene (it was working fine with r48).

The issues only occur when rendering far away from the world origin (further than 2 000 000 on some axis).

1st : my ground is formed of many Meshs built with PlaneGeometry and i now have some 1 pixel width holes between my meshs when moving the camera.

2nd : i’m dealing with a strong precision issue (>50 world unit error) when using projector and Matrix / Vector multiplication.

I tried to revert the Matrix optimization stuff but i didn’t manage to get it working with all the function change in this release 😕

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:28 (25 by maintainers)

github_iconTop GitHub Comments

1reaction
mshopfcommented, Jan 8, 2017

@m-schuetz: Thanks for your analysis - I had the same issue with in a similar setting. I was already thinking about more complex solutions (like in http://github.prideout.net/emulating-double-precision ), but it doesn’t seem to be required in my case as well.

I’d just suggest to use a local conversion Float32Array, so that you don’t need to create a new Object every time; also I think the use of || is wrong in your code (I might have missunderstood it, though):

 +    var convert32Array16= new Float32Array(16);
 [...]
      function setValue4fm( gl, v ) {
 -       gl.uniformMatrix4fv( this.addr, false, v.elements || v );
 +        convert32Array16.set (v.elements || v);
 +       gl.uniformMatrix4fv( this.addr, false, convert32Array16 );
      }
1reaction
m-schuetzcommented, Nov 28, 2016

@cipri-tom

In Matrix4.js, replace

this.elements = new Float32Array( [

with

this.elements = new Float64Array( [

and in WebGLUniforms.js replace

gl.uniformMatrix4fv( this.addr, false, v.elements || v );

with

gl.uniformMatrix4fv( this.addr, false, new Float32Array(v.elements) || v );

Seems to work for me. The matrices are converted to single precision float for the shaders which is fine because the translational terms of the world and the view matrices tend to cancel each other out. Make sure to use the combined “modelViewMatrix” in your shader.

On a related note, I’m just now switching to using Float64Array for the matrices in order to avoid confusing floating origin transformations. I can do a comparison for my use case when I’m done. Kind of glad to see that you just have to modify 2 lines to get double precision math on the CPU side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rolex Oyster Precision for R49 758 for sale from a ... - Chrono24
Rolex Oyster Precision. 6466 ; Caliber. Movement, Manual winding ; Case. Case material, Steel ; Dial, Silver ; Dial numerals, No numerals ;...
Read more >
15. Floating Point Arithmetic: Issues and Limitations — Python ...
Unfortunately, most decimal fractions cannot be represented exactly as binary fractions. A consequence is that, in general, the decimal floating-point numbers ...
Read more >
Is floating point math broken? - Stack Overflow
This causes precision errors when doing floating point (decimal) calculations, in short, due to computers working in Base 2 while decimal is Base...
Read more >
kenwood 5 disk cd player
I had the same problem with mine, had to buy a new player. ... will be impressed with a high-precision, multi-bit D/A converter...
Read more >
Metal slug tank toy - La Bina Travel Designer
Precision manufacturing, handcrafted elegance, consistency, and pride are words that are ... "Metal Slug Tank Capsule Toys" Topic.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found