three.js

Transparency of ShaderMaterial in Three.js

爱⌒轻易说出口 提交于 2019-12-11 10:49:13
问题 I tried to create my own GLSL script by extending shaders in ShaderLib (e.g. ShaderLib.basic), but unfortunately bumped into some transparency problems: In the picture below, it looks normal by using MeshBasicMaterial directly. var material = new THREE.MeshBasicMaterial( params ); // color and opacity are set in params but when I used ShaderMaterial, "some" furnitures inside are invisible from outside of window (that's a weird part ...), var myShader = THREE.ShaderLib.basic; var uniforms =

Three.js Cross Origin Error Loading Related Collada File Texture

穿精又带淫゛_ 提交于 2019-12-11 10:46:44
问题 I have a Collada file being loaded by three.js. The file has an associated texture named Texture_0.png. My Collada file is loaded via a Web service as it and the texture are stored in the same blob with REST Web Service access. CORS is enabled so the Collada file loads as expected, but since the Collada file is looking for a direct reference to the texture file, it calls it as well (since it is referenced in its XML). However, when it calls this related file, I get the following error and the

Objects with big speed are flickering/jumping

我的梦境 提交于 2019-12-11 10:43:55
问题 I have a container that contains three objects, when the container is moving with big speed it's children start to flicker and then jumping after some time, why is that so? function init() { // ... geometry = new THREE.CubeGeometry(100, 100, 100); mesh = new THREE.Mesh(geometry, material); container.add(mesh); geometry = new THREE.CubeGeometry(50, 50, 50); mesh = new THREE.Mesh(geometry, material); mesh.position.z = 75; container.add(mesh); geometry = new THREE.CubeGeometry(25, 25, 50); mesh

Three.js Restrict the mouse movement to Scene only

我们两清 提交于 2019-12-11 10:38:18
问题 I am working on the cube example from three.js (webgl_interactive_cubes_gpu.html). I realized that events goes to the entire html page. I mean i can rotate, zoom in or zoom out, even if the mouse pointer is not inside the scene.. I google a little bit and found some answers (Allow mouse control of three.js scene only when mouse is over canvas) but they do not work for me..Below is my code... var container, stats; var camera, controls, scene, renderer; var pickingData = [], pickingTexture,

Importing SnappyTree (proctree) model

左心房为你撑大大i 提交于 2019-12-11 10:38:17
问题 I'm trying to display a model created by SnappyTree/Proctree ( http://www.snappytree.com/ ). Proctree is designed to work with GLGE, but I'm nearly there in using the library generated data in Three.js. Basically I construct a custom json object, add proctree data to it and use JSONLoader to generate the final geometry. What I suspect is happening, the vertices (pointcloud) are imported correctly, but the array faces refer to wrong vertices or are otherwise interpreted wrong. var tree = new

Why is RenderingContext.drawElements clearing the screen before it draws?

陌路散爱 提交于 2019-12-11 10:27:00
问题 Is RenderingContext.drawElements correct when it clears the screen before it draws? Consider these screenshots that show a step across a call to drawElements with the object already drawn being erased. 回答1: WebGL effectively clears the screen after the page has been composited. When you're stepping through stuff one line at a time it's going to be composited every time you stop. If you don't want it to be cleared ask for preserveDrawingBuffer: true when you create the WebGL context as in gl =

Setting New Dimension using Jquery or Javascript for CylinderGeometry from Three.js

巧了我就是萌 提交于 2019-12-11 10:22:11
问题 I am trying to change the Dimension at Run time for cylinder created from the examples of Three.js. and the code I am trying is not working: Here is my code: HTML <script src="http://www.html5canvastutorials.com/libraries/three.min.js"></script> <div id="container"></div> <div class="inputRow clear" id="dimensionsNotRound" data-role="tooltip"> <label class="grid-8">Dimensions (pixels):</label> <br/> <br/> <div> <span>Length</span> <input class="numeric-textbox" id="inp-cylLength" type="text">

Exporting blender animations: can't reproduce three.js example

﹥>﹥吖頭↗ 提交于 2019-12-11 10:09:47
问题 I'm using three.js r73. I'm looking at one of the examples, examples/webgl_skinning_simple.html. As is it works fine. The model used in the example lives in examples/models/skinned/simple/. In this directory is the .js file imported by the example as well as the .blend file used to create it. The problem I'm having is that if I load the blend file in blender and then export it I don't get usable JSON. Just loading the blend file and then exporting (enabling the Bones and Skinning checkboxes

Loaded texture appears blurred, or like a single color. How to make the texture crisp and sharp

*爱你&永不变心* 提交于 2019-12-11 10:08:40
问题 I am using three.js to make some basic 3D, I am loading a jpeg image as texture to apply on a custome geometry as shown: var floor = new THREE.Shape([ new THREE.Vector2 (300, 50), new THREE.Vector2 (450, 100), new THREE.Vector2 (650, 80), new THREE.Vector2 (700, 180), new THREE.Vector2 (980, 280), new THREE.Vector2 (900, 420), new THREE.Vector2 (850, 560), new THREE.Vector2 (600, 590), new THREE.Vector2 (500, 500), new THREE.Vector2 (370, 570), new THREE.Vector2 (200, 410), new THREE.Vector2

Three.js Raycaster not detecting scene mesh

别等时光非礼了梦想. 提交于 2019-12-11 09:57:10
问题 I am using three.js r67 in Chrome Version 35.0.1916.153 m I am attempting to intersect some custom meshes that I have created in my scene. The raycaster does not appear to be registering the meshes although they exist within scene.children . Mesh creation code: if (modelVertices != null && modelVertices.length >= 3) { triangles = THREE.Shape.Utils.triangulateShape ( modelVertices, holes ); for( var i = 0; i < triangles.length; i++ ){ modelGeometry.faces.push( new THREE.Face3( triangles[i][0],