Monday, 15 September 2014

javascript - Three.js Scene Violently Shaking -



javascript - Three.js Scene Violently Shaking -

i working on project involves working big , little distances using three.js

i having issue on smaller side of scene, 'scene' start violently shaking.

at first assumed problem z-buffer, have written little snippet changes near , far properties of photographic camera every time new area entered. helped issues of 'shimmering' having before, scene still moves dramatically @ little distances.

one of conditions under happens follows

camera.near = .0133333 camera.far = 12 positiontoobjects = 6

this should mean z resolution around : .0001, sense should enough, shaking occurs much more this.

the objects range everywhere -200000 - 200000 in 'global' position, scenes not alter position

the other thing thinking photographic camera controls have been using (abbrviated) follows

if(mouseisdown == true){ if(this.movementspeed < this.maxspeed){ this.movementspeed += this.acceleration }else{ this.movementspeed = this.maxspeed } }else{ if(this.movementspeed > this.minspeed){ this.movementspeed = this.movementspeed/this.deceleration }else{ this.movementspeed = this.minspeed } }

where this.minspeed = 0, , this.movementspeed used move photographic camera so:

var actualspeed = delta * this.movementspeed; this.object.translatez( -actualspeed * forwardorauto ); this.object.translatex( actualspeed * sidespeed ); this.object.translatey( actualspeed * upspeed );

however, when photographic camera not moving (up 8 decimal places) scene still violently shaking

are there reasons cannot think of create scene this?

please allow me know if there more info can/should provide, , give thanks in advance time.

may suggest utilize values near , far not small? (specifically near)

near used divider internally, if you're using little number (<1) might lose precision , end violent movements, range of values you're moving around way smaller if used larger near , far values.

that's why you'll find default value near 0.1: https://github.com/mrdoob/three.js/blob/r55/src/cameras/perspectivecamera.js#l13

... although utilize 1 near.

also, online illustration when asking help in visual matters :-)

javascript graphics three.js webgl

No comments:

Post a Comment