three.js

Exporting a three.js mesh as an OBJ or STL

和自甴很熟 提交于 2019-12-20 12:47:06
问题 I would like to create an export as OBJ or STL link for a parametric Three.js mesh object. Just like the export option on http://www.3dtin.com Any advice would be appreciated. 回答1: To get mesh in .obj format I use this simple function: THREE.saveGeometryToObj = function (geometry) { var s = ''; for (i = 0; i < geometry.vertices.length; i++) { s+= 'v '+(geometry.vertices[i].x) + ' ' + geometry.vertices[i].y + ' '+ geometry.vertices[i].z + '\n'; } for (i = 0; i < geometry.faces.length; i++) { s

Three.js - How to rotate an object to lookAt one point and orient towards another

≡放荡痞女 提交于 2019-12-20 12:32:39
问题 I'm new to three.js and 3d programming in general, so this may seem like a very simple question. Ideally, I hope the answer can help me understand the underlying principles. I have an object that needs to "point" at another point (the origin, in this case, for simplicity), which can be done easily with the Object3D.lookAt(point) function. This points the Z axis of the object at the point nicely. I also want to rotate my object, called looker , around its Z axis such that its X axis points

Threejs - How to pick all objects in area?

雨燕双飞 提交于 2019-12-20 10:58:07
问题 I'm using Three.js and I wonder how to get all objects in a given area? For example, get all objects that found in the green-square: Solution: getEntitiesInSelection: function(x, z, width, height, inGroup) { var self = this, entitiesMap = [], color = 0, colors = [], ids = [], pickingGeometry = new THREE.Geometry(), pickingMaterial = new THREE.MeshBasicMaterial( { vertexColors: THREE.VertexColors } ), pickingScene = new THREE.Scene(), pickingTexture = new THREE.WebGLRenderTarget( this.

Need .js and HTML example for displaying .STL 3D objects in a web page

岁酱吖の 提交于 2019-12-20 09:24:20
问题 Can anybody produce a clean "for dummies" example of HTML for using STLLoader.js to display ASCII (not binary) .stl object files in a web page? Result should let users manipulate object in current HTML5 browsers and with no fancy visuals beyond a grayscale object surface and background. STLLoader.js might need the help of three.js or three.min.js but I wouldn't know. STLLoader.js contains below usage example but did not include an HTML wrapper. Usage example inside STLLoader.js /** * Usage: *

refresh dat.gui with new values

隐身守侯 提交于 2019-12-20 09:17:35
问题 I would like to refresh the dat.gui menu with new values. I have loaded a model and display in folder the name of the objects inside a gui folder. How can I display the new object name when I reload a other model ? Or it's possible to reset/clear the gui. 回答1: Basically, you have to set the controllers to "listen" for input when you add them, for example, gui = new dat.GUI(); var guiX = gui.add( parameters, 'x' ).min(0).max(200).listen(); For documentation, see: http://workshop

Import model from 3dStudioMax into THREE.js

痴心易碎 提交于 2019-12-20 09:07:12
问题 I know that THREE.js has importers from various 3d graphics formats. Is there an importer suitable to display a model created in 3dStudioMax? And if there is not one, is there a way to convert a 3dStudioMax model in something that can be imported in THREE.js? 回答1: Below is a MAXScript script that will convert a selected object's mesh into JSON. At the time of this post, it was available in the SVN of the 3ds Max developer community at Google code hosting. tmesh = snapshotAsMesh selection[1]

Three.js Full Screen Issue

北城余情 提交于 2019-12-20 08:57:55
问题 I've read through the Three.js API, read through the questions here on StackOverflow, I've debugged the code using firebug and chrome's debugger, I've stripped out everything I can, but I am still getting this irritating full screen error, where the renderer view port is larger than my screen thus causing scroll bars to appear. It's a visible error that does not affect rendering, or other operations, I am just trying to control the size of the view port so that it matches available screen

Is there at TWO JS counterpart to THREE JS [closed]

不羁岁月 提交于 2019-12-20 08:40:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am moving along well learning ThreeJS as an interface to WebGL. Thank you all for your previous help. I am developing a new approach to 3D Dynamics and would like a 3D component to the textbook. Examples are found here: http://eon.sdsu.edu/~impellus/DMF/ They are not the best, but I am learning. In parallel, I

Extending - THREE.MeshBasicMaterial

亡梦爱人 提交于 2019-12-20 07:42:32
问题 I am looking to make a copy of THREE.MeshBasicMaterial, and create my own modified material based on it. I will need to edit the shader a little, and add some uniforms ( but I can deal with that ) . For a start I would like to have the material work just like MeshBasicMaterial and take things from there. This is my poor attempt (where I started), which is not working: https://gist.github.com/karimbeyrouti/80c00a6b3731f52fe173 How do you create a new material based on MeshBasicMaterial in

Extending - THREE.MeshBasicMaterial

安稳与你 提交于 2019-12-20 07:42:05
问题 I am looking to make a copy of THREE.MeshBasicMaterial, and create my own modified material based on it. I will need to edit the shader a little, and add some uniforms ( but I can deal with that ) . For a start I would like to have the material work just like MeshBasicMaterial and take things from there. This is my poor attempt (where I started), which is not working: https://gist.github.com/karimbeyrouti/80c00a6b3731f52fe173 How do you create a new material based on MeshBasicMaterial in