three.js

Graphing 2d plane in 3d space using equation and/or vectors

心不动则不痛 提交于 2019-12-12 03:24:23
问题 I'm trying to make a linear regression plane visualization tool for a math project. Currently I have the math parts completed, but I am not sure how to graph the plane. I have a equation in the form of z=C+xD+yE, where C, D, and E are known constants. How do I graph the plane using these information? Thanks. github page: https://saxocellphone.github.io/LAProject/ 回答1: z=C+xD+yE This equation gives full information about the plane. What else you need to graph (plot, draw?) it? Probably it

Camera lookAt not working with stereoeffect

一曲冷凌霜 提交于 2019-12-12 03:24:11
问题 When I use stereoeffect using the following code, how should I get my camera to lookAt a certain Vector3? function animate() { var elapsedSeconds = clock.getElapsedTime(); requestAnimationFrame(animate); update(clock.getDelta()); render(clock.getDelta()); } function update(dt) { resize(); camera.updateProjectionMatrix(); controls.update(dt); } function render(dt) { effect.render(scene, camera); } I added camera.lookAt in my initialization code but I understand the render(..) function is

Three.js Error with THREE.ObjectLoader

只谈情不闲聊 提交于 2019-12-12 03:15:43
问题 I seem to be having issues with Three.ObjectLoader. I am exporting a scene in JSON Format 4.3. This scene includes geometries, materials, and lights. The scene opens in the Three.js Editor just fine without any errors. I am working on firefox with Three.js r70 master. Here is a link to the generated json: https://gist.github.com/fraguada/d86637f7987096b361ea In the viewer I am trying to write I am using the following code for the loading: var manager = new THREE.LoadingManager(); manager

Three.js Pointerlockcontrols shooting along y-axis

怎甘沉沦 提交于 2019-12-12 03:14:05
问题 Currently I am developing a FPS with three.js and pointerlockcontrols. Using the code below I can shoot into any horizontal direction: var direction = new THREE.Vector3( 0, 0, -1 ); var rotation = new THREE.Euler( 0, 0, 0, "XYZ" ); var cameraDirection = new THREE.Vector3(this.game.usermodel.root.children[0].position.x, this.game.usermodel.root.children[0].rotation._x, this.game.usermodel.root.children[0].position.z); cameraDirection.copy( direction ).applyEuler( this.game.user.rotation ); var

Three.js particles load insanely slow? What's causing the slowness and massive cut in FPS? (From 60+ fps to 1-2 fps)

99封情书 提交于 2019-12-12 03:03:13
问题 I can't figure out what's slowing down my visualization. Ideally, I would like 60 fps. Not 1 fps or 2 fps. Here are the repositories. For the first one, inside LeapVis1.2, if you open index.html with Firefox after you download the folder the vis should load. Non-Particles For the repository that uses particles, open canvas_particles_random.html in Firefox. Particles (Even slower) 回答1: First of all this is continuation of this question. The reason of its slowness is because your are using

How I can turn a figure that is upside down?

放肆的年华 提交于 2019-12-12 02:52:31
问题 I am creating a map using a json file. of d3.js to Three.js. When shown, it is shown upside down. As I can turn him?. I'm not sure which is the best way to flip. I want to recommend it as best he could do, since I'm new to d3 and Three.js not sure what to do. Here you can see how it looks: http://imgur.com/IFZ8F8h so I need: http://vignette3.wikia.nocookie.net/inciclopedia/images/b/b4/Mapamundi.png/revision/20130430135955 my code is this: mercator = d3.geo.equirectangular(); path = d3.geo

How to use AmbientLight in combination with MeshStandardMaterial?

雨燕双飞 提交于 2019-12-12 02:49:18
问题 I'm currently implementing the new MeshStandardMaterial in ViziCities and I've managed to get things looking great, so long as I remove the AmbientLight from the scene. In the scene is a base layer which has a texture map and has metalness set to 0 and roughness set to 1. If I leave the AmbientLight in the scene then the mesh that I want to reflect the environment map is not only far too bright, it doesn't reflect anything at all. The only way I've been able to keep the AmbientLight in the

Duplicate existing Three.js materials to add displacement calculations

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 02:36:18
问题 I need to do vertex displacements using a texture map in Three.js. Is there an existing material that supports that? If not, what is the best way to duplicate an existing Three.js shader so that I can add in some vertex displacement calculations? I would like to keep existing functionalities such as shadows and wireframe on the material. 回答1: Vertex displacements using a texture map are supported by THREE.ShaderTerrain[ "terrain" ] and THREE.ShaderLib[ "normalmap" ] . Examples of their use

How to hide or show scene in three.js

风格不统一 提交于 2019-12-12 02:33:14
问题 I am creating scene using Three.js webgl library. I am having a texture in the first scene. Clicking on this texture, i am trying to navigate to the next scene. I have written a function to handle this scenario to move to the next scene. Clicking on this texture, it is moving to the second scene as expected,but nothing is visible in it. So, i would like to know How to programmatically show or hide scenes.Here is the code where the first scene calls the second scene ' <script> function

Three.js/WebGL and 2D Canvas — Passing getImageData() array into Three.DataTexture()

只愿长相守 提交于 2019-12-12 02:19:24
问题 I'm new to WebGL (and 3D graphics in general) and am using three.js. What I want to do is create multiple textures from a 2D canvas, and use them to render multiple meshes, each with a different texture. If I just pass the canvas to a new THREE.Texture() prototype, the texture will change to whatever the canvas currently is. So all my objects have the same texture. My solution was to store each canvas array using getImageData() and create a new texture by passing that data to a new THREE