Tavurth Posted September 25, 2016 Share Posted September 25, 2016 When using chains of parent objects, especially with large distances, the camera jumps all over the place: http://www.babylonjs-playground.com/#NJMSC#4 Problem kicks in just after a distance of 10,000,000. This could perhaps be solved by utilising https://github.com/MikeMcl/bignumber.js/ Edit: Problem occurs when there's a large differential between the size and distance when using parent objects: http://www.babylonjs-playground.com/#NJMSC#5 Quote Link to comment Share on other sites More sharing options...
Tavurth Posted September 25, 2016 Author Share Posted September 25, 2016 Problem is evident even when there is only one sphere: http://www.babylonjs-playground.com/#1SSVBR#1 To normalise the bug, A sphere of size 1 with distance 250k from the origin causes uncontrollable and unworkable jitter. I'm guessing that this is a problem with the basic render engine, does anyone have any ideas? Quote Link to comment Share on other sites More sharing options...
Tavurth Posted September 25, 2016 Author Share Posted September 25, 2016 For comparison here is ThreeJS running with a size of 1 and a distance of 440 million from the origin. (Near upper limit) https://codepen.io/anon/pen/ORpZJE?editors=0010 Quote Link to comment Share on other sites More sharing options...
adam Posted September 26, 2016 Share Posted September 26, 2016 In the 3JS example you are just rotating the cube. Here it is with the camera rotating around the cube: https://codepen.io/anon/pen/JRNEgr?editors=0010 Quote Link to comment Share on other sites More sharing options...
Tavurth Posted September 26, 2016 Author Share Posted September 26, 2016 Thank you, yes you're right, my mistake. So to normalise, this would be a size of 1 at a distance of 250k: https://codepen.io/anon/pen/RGVgVQ?editors=0010 Is this just a problem with WebGL? I don't remember having it with OpenGL 3.0, when loaded through a window server. Is it assumed that everyone will use less than 250k units? Quote Link to comment Share on other sites More sharing options...
Tavurth Posted September 26, 2016 Author Share Posted September 26, 2016 As a workaround to this problem, I guess I'll use the currently viewed object as the origin, and re-compute the position of other objects, using the current as an offset. (Not ideal since it'll be calculation heavy). Another workaround would be to play with sizes and distances until I find something that works, although taking this route will likely end up giving me problems in the future. Thank you for your help) Edit: Relevant information here: http://stackoverflow.com/questions/14761595/three-js-objects-shimmering-at-large-distances Quote Link to comment Share on other sites More sharing options...
Tavurth Posted September 26, 2016 Author Share Posted September 26, 2016 So it was very simple to make the change: // Each object has it's own JS position vector // Here we assign new a mesh position based on a subtraction of // this mesh's position and the new origin's position // Save this object for use inside Object.each() var that = this; // Offset each of the meshes which belong to this object by an arbitrary position Object.each(this.meshes, function(mesh) { mesh.position = that.position.subtract(newOrigin.position); }); Using mootools for Object.each Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 2, 2016 Share Posted October 2, 2016 whoa whoa whoa, can you go back over this really quick? something is not right there is no reason for the camera to jitter given your explanation and there should be no work around. Ill take a look at the playground you posted and see what I can find Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted October 2, 2016 Share Posted October 2, 2016 ohh ok I got it... why is your camera maxZ so high? there is no point for that, set it to something reasonable, like 100 and scale your scene from there to do the ratio or size that you want. camera.maxZ = 10000000000000; is never going to work, in any engine. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.