three.js

How to apply texture to mesh without specifying UV's in geometry using three.js?

試著忘記壹切 提交于 2019-12-12 01:26:00
问题 Is it possible to apply texture to mesh without specifying UV's in geometry in three.js ? 回答1: There are classes such as THREE.CubeGeometry, THREE.SphereGeometry, etc. that automatically generate the UV coordinates for you. However, if you are creating your own geometry from scratch (i.e., specifying vertex locations, creating faces, etc.) then the answer is no. Either you need to set the UV coordinates manually when creating the geometry, or you need to write a custom shader which determines

How to rotate a model on a plane?

半腔热情 提交于 2019-12-12 01:25:37
问题 I am using a plane geometry to represent a terrain model with different "y" values(altitude). Also using the raycaster function I am able to move the model on the plane. I need a way to rotate the model a be parallel with the current face its on without changing its path orientation. Is there a way to define rotation by a face of a geometry? 回答1: theCorrect me if I'm wrong here, it sounds like you want to have both local (on the face) and global (in the direction of your "path orientation")

Three.JS - Child object rotation in it's place

删除回忆录丶 提交于 2019-12-12 01:07:49
问题 I tried absolutely everything, and it's second day that I can't move an child mesh around it's center. https://github.com/mrdoob/three.js/issues/1219 - This doesn't work for me. I think I can't create correctly the position matrix between the child and the parent center points. I'd like to set the object central point, in the place the object is on the scene, and rotate by any axis with it staying in it's place. Any help is most welcome...I'm getting frustrated by that ;/ 回答1: If you want

Shift texture on sphere Three.js

雨燕双飞 提交于 2019-12-12 01:05:44
问题 I have a sphere with a map on it using Three.js , the image dimensions are 1024*2048. Here is the issue : I have CircleGeometries on my sphere indicating some places of interest, but when I just load the image on sphere it isn't well placed, and my points of interest aren't above the right country. the idea is to rotate a bit my map so it fits the points of interest, but I can't get it to work. I tried to use texture.offset.x = 0.5; Math.PI / (2 * Math.PI) = 0.5 as I want to rotate half a

three.js r75 pointLight shadows in wrong places

不羁岁月 提交于 2019-12-12 01:04:45
问题 I have a jsfiddle containing a fixed Sun and Moons and a moving planet Earth which orbits the Sun. Here is the code for the two Lights (Ambient and Point) and example objects. var light2 = new THREE.AmbientLight(0x444444);//... for lighting the Sun and other MeshBasicMaterial meshes. scene.add(light2); //... PointLight // http://threejs.org/docs/#Reference/Lights/PointLight var light3 = new THREE.PointLight( 0xffffff, 10, 150000,1); light3.castShadow = true; light3.shadow.camera.near = 1;

Shadows in three.js : r71 vs r76

拈花ヽ惹草 提交于 2019-12-12 00:41:18
问题 I'm building a 3D environment using three.js , r76 . I can't seem to get the shadows right. In r71 , I was pretty happy with the result, but it doesn't work the same in r76 . A fiddle to illustrate my problem: r71 : https://jsfiddle.net/sq2w15xy/ r76 : https://jsfiddle.net/9uuq6s56/ As you can see, the shadow is black and pixelated in the newest revision. What changed since then? What can I do the get the same smooth shadow as in r71 ? 回答1: I suppose the light's shadow.mapSize must be set

Render error with edges helper and semi transparent object

江枫思渺然 提交于 2019-12-12 00:31:43
问题 I am trying to create an earth with three js like this example which is an upgrade from this one. The problem i have is that even thought in the code i add to the scene first the sky , after the earth and at the end the atmosphere the render seams not to understand this order a respondes with this Now when i zoom in and get near the earth object the render is working correct giving this responce. The problem as you can see is also with the THREE.EdgesHelper when in long zoom level it gets

THREE.JS loading an array of STL Meshes

隐身守侯 提交于 2019-12-11 23:54:07
问题 So, I have a data base which contains a file reference column and any references to sub STL files that are needed for it. I can load one or two models into a THREE.js viewer so all of that works without issue but when I load an array of four or so things start getting hairy and the assigned Mesh Id's start to get a bit odd and multiple mesh's get the same ID. So since it works with two files I know the array kind of works and is passing data correctly. I was wondering if my loader.load method

Three.js Updating DataTextures with a renderTarget's image data

久未见 提交于 2019-12-11 23:49:46
问题 I am working on a motion detection program in Three.js which uses the difference between the current and previous frame. For now, before the subtraction, the current and the previous frame are both blurred using a Three.EffectComposer each. The main problem is : Instead of having to blur the previous frame again, I want to use the previously blurred "current" frame as the texture in the subtraction process. The closest I have managed to do is by using the function below to update the image

Difficulty in sprite texture alignment

馋奶兔 提交于 2019-12-11 23:37:25
问题 I have some code similar to the following... this.texture = new THREE.ImageUtils.loadTexture( 'spritesheet.png' ); this.material = new THREE.MeshBasicMaterial( { map: this.texture, side:THREE.DoubleSide } ); this.geometry = new THREE.PlaneGeometry(32, 32, 1, 1); this.sprite = new THREE.Mesh( this.geometry, this.material ); game.scene.add( this.sprite ); I've also tried along the lines of... this.material = new THREE.SpriteMaterial( { map: image, useScreenCoordinates: true, alignment: THREE