three.js

Famo.us, Three.js and Clara.io

不想你离开。 提交于 2019-12-21 04:14:38
问题 I found Famo.us and it seemed pretty exciting but their docs are closed. I am very curios about WebGL so I started looking for alternatives. I found Three.js and Clara.io. How do they differ from famo.us? What is the main objective of each framework? Thanks. Edit : Rephrased. 回答1: Three.js is a lightweight javascript library to create 3D visualisations (using WebGL, SVG, Canvas or another renderer). Clara.io is an online 3D modelling tool using WebGL. Famo.us is a javascript rendering engine

Three js raycasting OBJ

大憨熊 提交于 2019-12-21 04:08:58
问题 Hello! I ve got an three js and tried to use it with my project. The thing is - i needed to select my custom mesh loaded from OBJ file. I created simple raycaster, simple cube, and my model (which is cube also). The thing is - i can have cube raycasted but it doesn t see my model. Where can i have the problem? var container, stats; var camera, scene, projector, renderer; var particleMaterial; var textureLoader; var modelLoader; var objects = []; init(); animate(); function init() { container

How to find rotation matrix between two vectors in THREE.js

风流意气都作罢 提交于 2019-12-21 04:04:29
问题 I'm looking for the way to find rotation matrix between two defined vectors in THREE.js. For Example v1 = new THREE.Vector3(1, 1, 1) v2 = new THREE.Vector3(1, 1, -1) I need this rotation matrix to rotate whole object in next step. 回答1: You can define a rotation from two unit-length vectors v1 and v2 like so: var quaternion = new THREE.Quaternion(); // create one and reuse it quaternion.setFromUnitVectors( v1, v2 ); In your case, you need to normalize your vectors first. You can then apply

How to find rotation matrix between two vectors in THREE.js

丶灬走出姿态 提交于 2019-12-21 04:04:12
问题 I'm looking for the way to find rotation matrix between two defined vectors in THREE.js. For Example v1 = new THREE.Vector3(1, 1, 1) v2 = new THREE.Vector3(1, 1, -1) I need this rotation matrix to rotate whole object in next step. 回答1: You can define a rotation from two unit-length vectors v1 and v2 like so: var quaternion = new THREE.Quaternion(); // create one and reuse it quaternion.setFromUnitVectors( v1, v2 ); In your case, you need to normalize your vectors first. You can then apply

How to move camera along a simple path

旧街凉风 提交于 2019-12-21 02:53:33
问题 How can I move the camera along a simple path (created by an array of vertices/points)? I need to move it automatically, not by keyboard/mouse events, like in a first person shoter game? Looked for this example: http://threejs.org/examples/webgl_geometry_extrude_splines.html and it's realy good (and complex), but I need something simple, as a person who is just starting to learn Three.js 回答1: So, the best and simplest solution (based on my errors and researches - maybe you can find even a

how to map latitude and longitude to a 3D Sphere

99封情书 提交于 2019-12-21 02:36:08
问题 Trying to map coordinates with latitude and longitude onto a 3d sphere. I've tried three different sets of equations from the internet and none of them work. Does anyone know how to do it. These are the ones I tried that didn't work. var phi = (90-lat)*(Math.PI/180), theta = (lon+180)*(Math.PI/180), x = -((radius) * Math.sin(phi)*Math.cos(theta)), z = ((radius) * Math.sin(phi)*Math.sin(theta)), y = ((radius) * Math.cos(phi)); return new THREE.Vector3(x,y,z); var height = 600; var phi = (lat)

What is the URL for three.js to include it online?

雨燕双飞 提交于 2019-12-20 20:04:33
问题 I am trying to make a javascript application in google app engine using three.js but I am not getting the URL to include it online in my document. I dont want to upload the whole three.js package, which is very big in size. I wanted to know if there was a way I can get URL to include the library just like this one for jQuery : http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js If this question is already asked then please provide the link. 回答1: The search term for your question

Apply color gradient to material on mesh - three.js

和自甴很熟 提交于 2019-12-20 19:53:36
问题 I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. 回答1: Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38);

Apply color gradient to material on mesh - three.js

穿精又带淫゛_ 提交于 2019-12-20 19:52:41
问题 I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. 回答1: Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38);

Apply color gradient to material on mesh - three.js

穿精又带淫゛_ 提交于 2019-12-20 19:52:11
问题 I have an STL file loaded into my scene with a single colour applied to a phong material I'd like a way of applying two colours to this mesh's material with a gradient effect applied on the Z axis a like the example below.Gradient Vase]1 I have a feeling I may have to introduce shaders but I've not gotten this far with three.js. 回答1: Simple gradient shader, based on uvs: var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(60, 1, 1, 1000); camera.position.set(13, 25, 38);