three.js

three.js how to get scene by id(name)

北城余情 提交于 2019-12-13 07:21:17
问题 I created a scene; How can I get it by id(name)? Like jquery(#test) ? In three.js doc,I just find the scene.getObjectById() to get children obj. 回答1: Did you even search? There is a getObjectByName method for this here in the Object3D class. And here it is also mentioned in the documentation. Update Both the getObjectByName and the getObjectById methods are to find children objects inside a parent object. A scene doesn't have a parent so finding scene by id or finding scene by name doesn't

THREEjs can't use the material on the JSON Model when initializing. Gives me WebGL errors

独自空忆成欢 提交于 2019-12-13 07:08:29
问题 I am simply trying to get a material on a mesh that I exported from blender. The mesh shows up no problem when I use the JSONLoader, but I cant get the material I exported. I looked everywhere for an answer but no luck. Here is my code: function init() { renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild( renderer.domElement ); camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );

Recommended format to export 3D models for WebGL from a Java web app

时光毁灭记忆、已成空白 提交于 2019-12-13 07:02:04
问题 I have a web application that manipulates a 3D model on the server and allows the user to view the model. Using Java is a hard requirement for the web application, but the way the WebGL viewer interfaces with the application is still to be implemented. What is the recommended format/method to export 3D models from Java to something easily usable in WebGL? You can assume I use the Java 3D library on the server side and Three.js on the client side. 回答1: My preferred pipeline is export to JSON

Changing opacity with OBJMTLoader

梦想与她 提交于 2019-12-13 06:42:25
问题 I am currently working on a project with three.js which include the usage of the OBJMTLloader.js, loading the obj and the mtl file Here is my code: var loader = new THREE.OBJMTLLoader(); loader.load( './three/obj/Colonne/Vertebres.obj','./three/obj/Colonne/Vertebres.mtl', function ( object ) { object.position.y = - 70; scene.add( object ); } ); I want to know if it is possible to change the opacity of the object/material once it's loaded. Thank you. 回答1: In your loader callback, you can use a

how to do particles texture mapping with three.js shaderMaterial?

我与影子孤独终老i 提交于 2019-12-13 06:14:09
问题 what I'm trying to achieve is having a particle system where each particle have a portion of a given texture. Below is a example of a particles's buffergeometry using a shader material. so far I can make it look almost as it should, nonetheless, I dont know how to properly program the fragment shader in order to have the correct offset of the texture on each particle. the texture is 500x500px which is the same amount of particles. http://www.pruebasmemo.co.nf/ fragment shader code: uniform

Three.JS plugin for Blender not working

末鹿安然 提交于 2019-12-13 06:12:28
问题 I cannot install the Three.js plugin for Blender. I have a Fedora with Blender 2.69, I created the directory io_mesh_threejs in /usr/share/Blender ... /addon and copied the 3 .py files into but the plugin doesn't appear in the user preference. I also tried with a downloaded 2.65 version of Blender with no success. I did it for another library (Babylon.js) and it worked fine so I guess it comes from the python files ? 回答1: Here is what I did to get it to work with Win 7 - may work for you also

Three.js r72 - Texture marked for update but image is undefined?

不问归期 提交于 2019-12-13 06:02:39
问题 Three.js r72 I'm trying to use the same texture with different offsets and repeats, but after I clone the texture and apply needsUpdate I keep getting an error "Texture marked for update but image is undefined". I check the cloned texture and the image property is undefined. Shouldn't the clone method have referenced the source image from the texture in the textures Object. var textures = {} var materials = {} textures.skin = THREE.ImageUtils.loadTexture('skin.png'); textures.skin.minFilter =

Three.js - Drag Collada Files

北战南征 提交于 2019-12-13 05:59:05
问题 My objects are moving on the XZ axis through drag and drop. Unfortunately the collada files doesn't act like them... Here is my code: var container; var camera, controls, scene, renderer; var objects = [], plane; var raycaster = new THREE.Raycaster(); var mouse = new THREE.Vector2(), offset = new THREE.Vector3(), INTERSECTED, SELECTED; init(); animate(); function init() { container = document.createElement( 'div' ); document.body.appendChild( container ); camera = new THREE.PerspectiveCamera(

Three.js wireframe model from .vtk file

允我心安 提交于 2019-12-13 05:53:21
问题 I've been trying to replicate the results of Three.js's WireframeHelper using shaders. I want to display a wireframe using only geometry information. I am using the VTKLoader used in the examples, and have been basing my code off of a jsfiddle example. I have created a jsfiddle example to highlight my problem. The model loads correctly, but the shader only seems to draw the edges of select faces. I have not been able to figure out why some triangles are not drawn with edges. Is this because I

Displaying only overlapping parts

一世执手 提交于 2019-12-13 05:43:49
问题 I guess it's basic stuff, but can't find any solution. Say, I have 2 objects and want to display only their overlapping parts (i.e. their intersection). Any hints? 回答1: Take a look at: Constructive Solid Geometries. Intro here: http://learningthreejs.com/blog/2011/12/10/constructive-solid-geometry-with-csg-js/ 回答2: One way is to turn on the stencil. Draw the first object, updating the stencil buffer, then draw the second object with the stencil test set to only draw where the first object set