three.js

Zoom in and Zoom out Threejs

≯℡__Kan透↙ 提交于 2020-01-06 20:17:24
问题 I have added sphere to the scene and also some plane geometry to the scene when i zoom in I want the plane geometry look smaller and when i zoom out the plane geometry should appear bigger I don't know how to solve this problem can someone please help me with this problem. 回答1: Yes! You should animate the camera in this case. I'm assuming your objects are in the middle at 0, 0, 0. var zoomingIn = true; function render() { if (zoomingIn && camera.position.z > 10) { camera.position.z -= 0.1; }

Issue upgrading threejs with shaders

冷暖自知 提交于 2020-01-06 19:10:26
问题 I am working on a 3d dataviz. I need to show a world with data on it and I using the chrome experiments (chromeexperiments.com/globe) as a guide. The issue is that this visualizations are made with Threejs r40 and it is hard to find docs about it so I tried to upgrade to r71. I solved the compatibility issues rendering the world but cant make it show the atmosphere, in fact, when I try to show the atmosphere nothing is shown (is like the atmosphere is rendered black and it hides the world). I

Issue upgrading threejs with shaders

£可爱£侵袭症+ 提交于 2020-01-06 19:09:53
问题 I am working on a 3d dataviz. I need to show a world with data on it and I using the chrome experiments (chromeexperiments.com/globe) as a guide. The issue is that this visualizations are made with Threejs r40 and it is hard to find docs about it so I tried to upgrade to r71. I solved the compatibility issues rendering the world but cant make it show the atmosphere, in fact, when I try to show the atmosphere nothing is shown (is like the atmosphere is rendered black and it hides the world). I

Three.js Loader callback issues in loop - only receive last value?

非 Y 不嫁゛ 提交于 2020-01-06 17:57:05
问题 I need to load model in loop, the results I want to achieve is the first model with material[0], the second model with material[1]... But my results are all models have the final material. I think because when the function create mesh got called so variable "i" is already in the last value. I came across Closure in loop question, but does not seem to apply. Any help? Here the code: var loader = new THREE.CTMLoader(); var material = [new THREE.MeshLambertMaterial( { color: 0xffaa00 } ), new

Loading textures with JSONloader

那年仲夏 提交于 2020-01-06 15:49:32
问题 I'm a newbie, and I think I missed something. Could someone check, please? HTML page: http://xalien95.altervista.org/pkmnxy_engine/alisopoli.html MODEL and TEXTURES: http://xalien95.altervista.org/pkmnxy_engine/alisopoli/ I can see the model (with weird colors), but not the textures (it's a mesh with multiple materials). Thanks in advance! EDIT: I tried with all the materials types: THREE.MeshBasicMaterial THREE.MeshDepthMaterial THREE.MeshLambertMaterial THREE.MeshNormalMaterial THREE

Three.js Loading Same Objects

做~自己de王妃 提交于 2020-01-06 15:29:33
问题 I want to load multiple objects with THREE OBJLoader. But I don't know how to do it. I'm using this code: for(var i=0;i<10;i++){ loader.load('suzanne.obj', function(event) { var object = event; object.traverse(function(child) { if ( child instanceof THREE.Mesh) { child.material.map = texture; } }); object.position.set(3 * i, 0.5,3); scene.add(object); }); } I don't know what i'm doing wrong but it had to be something with async loading objects... I should wait for object to load then add it

How to merge multiple lines with gaps in threejs

[亡魂溺海] 提交于 2020-01-06 14:19:12
问题 I am successfully loading a dataset with polygon data that represent buildings in a city. So every polygon represents a single building. In Threejs I can successfully represent them, but when I try to merg the separate lines into one geometry, all the lines are connected (I understand why this makes sense, since all the vertices are added to the same collection). But how do I merge those separate building polygons into a single geometry without having the lines of the separate building

Forge Autodesk model's transform matrix

∥☆過路亽.° 提交于 2020-01-06 07:27:11
问题 I would like to know what are the two matrix below and what they are used for : placementTransform (1 x 12) refPointTransform (1 x 16) Does anyone know what they are used ? I think it has to do with translation(Tx, Ty, Tz)/rotation (Rx, Ry, Rz) of 3D objects but there are too many parameters in each vector... 回答1: The placementTransform sets the position-offset and scale of a model during loading. refPointTransform is similar (but contains rotation), but is applied (multiplied) after the

Forge Autodesk model's transform matrix

纵然是瞬间 提交于 2020-01-06 07:27:05
问题 I would like to know what are the two matrix below and what they are used for : placementTransform (1 x 12) refPointTransform (1 x 16) Does anyone know what they are used ? I think it has to do with translation(Tx, Ty, Tz)/rotation (Rx, Ry, Rz) of 3D objects but there are too many parameters in each vector... 回答1: The placementTransform sets the position-offset and scale of a model during loading. refPointTransform is similar (but contains rotation), but is applied (multiplied) after the

Using Tween to animate a camera

风流意气都作罢 提交于 2020-01-06 07:15:11
问题 I'm trying to ease camera rotation to look at a selected object in a graph. So far, I have fourd.render_loop.push(() => TWEEN.update()); fourd.intersect_callback = function(vertex){ console.log(vertex); var camera = fourd._internals.camera; var start = new THREE.Euler().copy(camera.rotation); camera.lookAt(vertex.position); var end = new THREE.Euler().copy(camera.rotation); camera.rotation.copy(start); var tween = new TWEEN.Tween(camera.rotation) .to(end, 600) .easing(TWEEN.Easing.Quadratic