three.js

Accurate bounding box of an object

风流意气都作罢 提交于 2019-12-11 09:48:07
问题 I'm trying to create an accurate bounding box of an object, but it appears that if the object isn't aligned with the axis (I think) the box is not aligned with the object. For example: The pink and closer orange vertices are the Box3.min, Box3.max of this wall, but you see the red and green and blue are not on that wall. You can ignore the aqua vertices. This is the code that creates the bounding box (returns Box3): static getWorldBoundingBox(model, dbId) { return new Promise(async(resolve,

Create a background scene in three js

Deadly 提交于 2019-12-11 09:44:48
问题 Hi I am trying to add a background image to my Three JS experiment. The code is working but no background is being rendered. Below is my init function: function init(){ // Create new scene scene = new THREE.Scene(); var WIDTH = window.innerWidth, HEIGHT = window.innerHeight, BOXWIDTH = 20; // Renderer renderer = new THREE.WebGLRenderer({antialias:true}); renderer.setSize(WIDTH,HEIGHT); document.body.appendChild(renderer.domElement); // PerspectiveCamera (POV Angle, Aspect Ration, Near

three.js load multiple objects asynchronous issue

丶灬走出姿态 提交于 2019-12-11 09:43:51
问题 am loading multiple models on the same time to a scene, but it fails to load all the models, it only loading one model on the scene For example am having a building scene with the multiple objects like chairs, toys and so on inside that building, while loading those objects the only one object is loading, but somehow if i do a alert on end of the function all the models are loading Image1 what am getting now, Image2 what actually i want my code is follows function load_file(floor_number,x,y,z

Three.js loading order

夙愿已清 提交于 2019-12-11 09:42:46
问题 I have a problem with my Three.js Json-Loader. I have some object their path is saved in an array. Now I want to load them and sort them in a List so that I can select them. But the order they are loaded is a different than they are in my array after loading because they have different size so the small one are first and the bigger are last. So after loading them I don't know the name of the object ( the name is the path ). My code : for(var j=0;j<21;j++){ var path = objPath[j]; loader.load(

THREE.JS UV Mapping on ExtrudeGeometry

我的未来我决定 提交于 2019-12-11 09:37:51
问题 I need to apply a texture on a ExtrudeGeometry object. The shape is a circle and the extrude path is composed of 2 vectors : One for the top. One for the bottom. I didn't choose cylinderGeometry because I need to place top/bottom sections of my geometry at precise positions and because the geometry created will not be always purely vertical (like a oblique cylinder for example). Here is a picture of a section (one top vector, one bottom vector and a shape extruded between these 2 vectors).

UV mapping in THREE.js

巧了我就是萌 提交于 2019-12-11 09:32:31
问题 I'm trying to use SDF fonts in THREE.js, they come with a PNG map of characters and some character data such as each letters x offset, y offset, width, height and so on. Before I start using the character data with the offsets and widths and things for each character, I just wanted to simply try out mapping only a part of one of the example UV textures from the three.js/examples. JSFiddle: http://jsfiddle.net/b2zegeht/3/ So the image above is being rendered onto a quad, with the following

How to do Dynamic csg operation with three.js

独自空忆成欢 提交于 2019-12-11 09:19:11
问题 I'm trying to develop a 3D object editor with Three.js, where letting the user to perform CSG operations such as union, intersection, subtract, etc.I used source code from "Three.js Editor" for the main functions of loading the stl file, and rendering the object. And now, I'd like to add-in CSG functions for users to do dynamic CSG function. I found "CSG.js" and "JSModeler.js" for performing the CSG operations.My intention is to load the stl files, then customise(union, subtract) the objects

Color based on mesh height Three.js

柔情痞子 提交于 2019-12-11 09:18:56
问题 I am loading in an STL file with the STLLoader() in Three.js and am transforming it into a mesh. Now, I would like to color each cube of my mesh based on its height, as in the image attached here screenshot-color-by-height. Is this possible within Three.js and if so, what would be the best approach? The actual model is here: https://casagroupproject.github.io/subpage1.html 回答1: Just a concept of how you can make it with colors of vertices: var scene = new THREE.Scene(); var camera = new THREE

Change camera position.z with mouse wheel in threejs

你。 提交于 2019-12-11 09:18:55
问题 Has anyone any idea how to change the camera.position.z (with mouse wheel) of the camera, and make a scroll effect? When I try with a variable it does not work. 回答1: TrackballControls or OrbitControls from examples can be used enable zoom (and rotate and pan). See example https://threejs.org/examples/?q=contro#misc_controls_trackball Include one of the controls that you can find in downloaded package in three.js-master/examples/js/controls/ : <script src="three.js-master/examples/js/controls

Three js buffergeometry for spheres

若如初见. 提交于 2019-12-11 09:18:11
问题 Im trying to make a three js document which shows lots of spherical objects, the quickest way to do this is by using buffergeometry. From this post here I learned that I could convert normal geometry into buffergeometry using: var sphere = new THREE.SphereGeometry( 4, 0.05, 0.025 ); var geometry = THREE.BufferGeometryUtils.fromGeometry( sphere ); But this does not seem to work for me, the rest of the code that creates the object reads: var positions = new Float32Array( x_GAMA.length * 3 );