three.js

Three.js skybox not loading completely or at all

大城市里の小女人 提交于 2019-12-25 04:44:50
问题 I inserted a skybox in my Three.js canvas like this: // SkyBox var urls = [ themePath + 'assets/img/sky/pos-x.jpg', themePath + 'assets/img/sky/neg-x.jpg', themePath + 'assets/img/sky/pos-y.jpg', themePath + 'assets/img/sky/neg-y.jpg', themePath + 'assets/img/sky/pos-z.jpg', themePath + 'assets/img/sky/neg-z.jpg' ] window.cubemap = THREE.ImageUtils.loadTextureCube(urls); cubemap.format = THREE.RGBFormat; window.shader = THREE.ShaderLib['cube']; shader.uniforms['tCube'].value = cubemap; window

threejs collada model location

淺唱寂寞╮ 提交于 2019-12-25 04:43:27
问题 I have been working on THREEJS framework to render *.dae models. There are several dae models. I have a problem with the location of the models. When I render them, each model has a different location. I set their location dae.position.set(0,0,0); but unfortunately, it doesn't work perfectly. For example, for one model I have to set the location as dae.position.set(-2, -31, 6.5); and then model is on the location(0,0,0). I check it with AXES axes.position.set(0,0,0); . Do you have any idea,

THREE.js: Can you force a different order of operations for three.js?

谁都会走 提交于 2019-12-25 04:34:22
问题 See this question: Threejs Transform Matrix ordering I'm drawing the orbits of the planets and having problem with changing inertial reference frames (I chose to align the three.js world coordinates with the viewed planet's inertial reference frame). But I need to force three.js to apply operations in the order shown below so the orbit is properly displayed (presently the orbit stays at world (0,0,0) and spins crazily). The normal (physics) way to do this is to do the following in order: 1.

How can I change the Initial position of my geometry in Three.js?

淺唱寂寞╮ 提交于 2019-12-25 04:33:27
问题 I would like to change the initial position where my geometry appears; Right now it appears in the center of the canvas. I would like it to appear at the left upper corner. Can you help me? scene = new THREE.Scene(); camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); camera.position.z = 1000; Here is the full code: Three js example 回答1: Change the position of the cube using mesh.position.set(x, y, z) I used window.innerWidth and window.innerHeight to

Load PointerLockControl camera view to another camera

萝らか妹 提交于 2019-12-25 04:27:31
问题 I'm using the PointerLockControls to control my camera but how would I be able to load the rotation of the current view to another camera that is not attached to anything but the scene? I can get the yawObject position but the yawObject rotation does not show the exact view I had with the PointerLockControl camera. For example, if I output the following: yawObject position: 183.91,10.00,-204.16 yawObject rotation: 0.00,73.89,0.00 pitchObject position: 0.00,20.00,0.00 pitchObject rotation: -0

How to set the Object3D position and rotation same as the added mesh ? [three.js]

血红的双手。 提交于 2019-12-25 04:12:24
问题 When I create an Object3D model and add the meshes to it, how do I set the position and rotation of the added mesh to same as the Object3D model, like when I rotate and position the Object3D there should be no difference in angle of rotation between the Object3D and the added mesh. How do I achieve such result? 回答1: If your Object3D model is called obj , then after obj.add(mesh) any changes to obj (position/rotation/scale) will change mesh in the same way. If instead you don't want mesh to be

How to add reflectionMaterial for an object in threejs

让人想犯罪 __ 提交于 2019-12-25 03:58:14
问题 How to add reflectionMaterial with environment map, am using two cameras and two scene in order to achieve it, based on the webgl_materials_cubemap and am using Object that is loaded using OBJMTLLoder, i can see the both Environment map, and Object on my scene, but the reflection of environment is not working on the object.. find my code below : var urls = [ 'textures/cube/canary/pos-x.png', 'textures/cube/canary/neg-x.png', 'textures/cube/canary/pos-y.png', 'textures/cube/canary/neg-y.png',

A-Frame / THREE.js, no textures simplified gltf[glb] models

我只是一个虾纸丫 提交于 2019-12-25 03:55:31
问题 After simplifying glb successfully with the answer in this post. The textures in are not being applied to the model any more (it appears completely black and unreflective(no material) How would I programmatically get the textures to work with this new simplified geometry? I think its something to do with the uv's but im not to sure how to have it work according to simplified geometry, if even possible. 回答1: THREE.SimplifyModifier currently does not preserve UVs in the geometry, which you'll

Three .js object rotation on keypress

烈酒焚心 提交于 2019-12-25 03:40:34
问题 I'm desperate. been trying for so long to simply rotate an object on key press event. I can't just figure it, can anyone please show how to do it? this is my model https://www.dropbox.com/s/8yefhx3yc11zbik/b.obj?dl=0 i need to keep rotating it on x axis, as long as keyboard button "B" is pressed down, so that that the shadow from the spotlight or direct light would be changing. anyone? i need to do that with the whole alphabet (i've got all the models) what's the best way to do it? 回答1: You

An error when try to use mipmaping in three.js

人走茶凉 提交于 2019-12-25 03:26:38
问题 I'm trying to use mipmaps generation in three.js textures. When creating a texture I assign an image of size 512x512 to mipmaps[0]. Thus if my understanding is correct this image should be used by WebGL to generate smaller mipmaps textures. But then I see a black texture rendered and errors like this: in chrome WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is