three.js

Three.js - ExtrudeGeometry using depth and a direction vector

强颜欢笑 提交于 2019-12-20 05:28:10
问题 I want to extrude a shape and create an ExtrudeGeometry , but the shape has to be extruded into a certain direction. I have a direction in a Vector3 The shape is drawn in in the x, y plane and normally the z is the extrude direction (extrusion depth). So a direction vector (0,0,1) would result in the default extrusion. But for example a (0,0,-1) would extrude the shape in the other direction. I first tried to use an extrude path to achieve this, but when using a path the shape is allowed to

Three.js - ExtrudeGeometry using depth and a direction vector

人盡茶涼 提交于 2019-12-20 05:28:08
问题 I want to extrude a shape and create an ExtrudeGeometry , but the shape has to be extruded into a certain direction. I have a direction in a Vector3 The shape is drawn in in the x, y plane and normally the z is the extrude direction (extrusion depth). So a direction vector (0,0,1) would result in the default extrusion. But for example a (0,0,-1) would extrude the shape in the other direction. I first tried to use an extrude path to achieve this, but when using a path the shape is allowed to

Three.js - Rotating a object around certain axis

﹥>﹥吖頭↗ 提交于 2019-12-20 04:28:42
问题 I've used THREE={REVISION:"68"} I've already done rotation (OBJECT_X) by axis "z" http://jsfiddle.net/eVkgs/39/ When I change position OBJECT_X: CubeGeometry.applyMatrix( new THREE.Matrix4().makeTranslation( 20,Cube_height/2, 0 ) ); http://jsfiddle.net/eVkgs/40/ Object is still rotate by axis "z" becouse I setup : OBJECT_X.rotation.z += 0.3*Math.PI/30; Question : how should look code that allow to rotate around axis which this object is placed ? 回答1: An object will rotate around its origin in

cubes created by three.js are interfere ,parts of those cubes become transparency when rotating the camera,

。_饼干妹妹 提交于 2019-12-20 04:19:01
问题 I create some cubes with three.js CanvasRender. I met an issue, parts of those cubes become transparency when rotating the camera,please see the image(http://imgur.com/fAY6B). When I change the CanvasRender to WebGLRender, the issue can't be reproduced. I have to use CanvasRender. Any ideas anyone? Any help will be much appreciated. for (....){ var material = new THREE.MeshPhongMaterial({ color: color.getHex(), shading: THREE.FlatShading, overdraw: true}); var geometry = new THREE

Faces invisible from one side using Three.js

我怕爱的太早我们不能终老 提交于 2019-12-20 03:30:07
问题 I have an OBJ file with JPG texture loaded into a page - from one side the faces are visible, but from the other they are invisible. Faces visible (a little dark - sorry!) Other side - faces not visible. I tried adding model.doubleSided = true; but that doesn't seem to change anything. 回答1: Add the double sided flag on the material. Assuming you have something like: material = new THREE.MeshLambertMaterial ({ color: 0xFF00FF }); add: material.side = THREE.DoubleSide; or when you create the

How to use the three.js SSAO shader?

元气小坏坏 提交于 2019-12-20 03:23:06
问题 I'm trying to render a scene with the SSAO post-processing shader. There aren't any errors but I can't see any difference between the scene rendered with and without the SSAO pass. I initialize the renderer like this: // Create WebGL Renderer var renderParameters = { antialias: false, alpha: false, clearColor: 0xFFFFFF }; renderer = new THREE.WebGLRenderer(renderParameters); renderer.autoClear = false; renderer.setSize(viewportWidth, viewportHeight); // Create render targets

Three.js: Get updated vertices with morph targets

纵饮孤独 提交于 2019-12-20 03:13:30
问题 I've got some morph targets working: https://jsfiddle.net/3wtwzuh3/2/ (Use the slider control to see the morph) However, I'd like to be able to access the new positions of the vertices after the morph. If you notice in the linked example, I am displaying the y coordinate of the first vertex of the cube and it is not updating! // This Y vertex doesn't seem to update! elInfo.innerHTML = geometry.vertices[0].y; Is it possible to get the new positions? I've tried setting all sorts of flags and

Unable to change camera position when using VRControls

一曲冷凌霜 提交于 2019-12-20 03:12:40
问题 I have the following code: ... camera = new THREE.PerspectiveCamera(75, screenRatio, 1, 10000 ); camera.position.z = -10; // position.set(0, 0, -10) also not working. controls = new THREE.VRControls( camera ); effect = new THREE.VREffect( renderer ); effect.setSize( window.innerWidth, window.innerHeight ); ... VRControls are working in sync with the accelerometer, but I can't change the cameras position. It seems stuck in the origin point (0,0,0). It was working just fine before applying

Why do two faces appear invisible in ThreeJs?

房东的猫 提交于 2019-12-20 03:10:18
问题 I've an object in Blender. Because I want to do some UV-unwrapping using ThreeJS (see here) I determined that I need merge two of the sides to correctly unwrap. So before exporting the .blend as a .obj object I selected the Tris to Quads face option to create a square face for the two sides as opposed to it being made up of two triangles. Here's what it looked like in Blender: But when I import the .obj and .mtl file into ThreeJs I get this: Is this a problem to do with me not updating the

Re-render object on mouse hover

时光总嘲笑我的痴心妄想 提交于 2019-12-20 03:01:26
问题 I'm setting up the threejs editor in electron, and I'm going to customize it. I'm trying to implement a "hover" object to change the color of faces, then select two faces of two objects and snap them (face-to-face). So now I'm implementing the hover effect, but it works not well: it updates quite randomly (and not now, when the mouse is hover). Where am I wrong? function onMouseMove( event ) { var mouse = new THREE.Vector2(), INTERSECTED; event.preventDefault(); mouse.x = ( event.clientX /