three.js

Three.js Rotate Texture

非 Y 不嫁゛ 提交于 2020-01-09 05:18:26
问题 I have a texture applied to a mesh I can change the offset with mesh.material.map.offset.set I can change the scaling with mesh.material.repeat.set so my question is, how can I rotate texture inside a plane? Example: From This: To this Thanks. 回答1: use 2D canvas as a texture demo: https://dl.dropboxusercontent.com/u/1236764/temp/stackoverflow_20130525/index.html example code var camera, scene, renderer, mesh; var width = window.innerWidth; var height = window.innerHeight; scene = new THREE

Three JS Pivot point

放肆的年华 提交于 2020-01-09 02:18:24
问题 What I'm trying to achieve is a rotation of the geometry around pivot point and make that the new definition of the geometry. I do not want te keep editing the rotationZ but I want to have the current rotationZ to be the new rotationZ 0. This way when I create a new rotation task, it will start from the new given pivot point and the newly given rad. What I've tried, but then the rotation point moves: // Add cube to do calculations var box = new THREE.Box3().setFromObject( o ); var size = box

How to add a mesh to forge viewer v6 using Typescript?

我怕爱的太早我们不能终老 提交于 2020-01-07 09:47:44
问题 I need to know how to add meshes to Forge Viewer v6 using Type script. I went through all the topics and articles and it was working with v4. Now when I try the following code: private wallGeometry: THREE.BoxBufferGeometry; drawWalls() { this.wallGeometry = new THREE.BoxBufferGeometry(4000, 4000, 100, 1, 1, 1); console.log('creating wall geometry'); this.wallGeometry = new THREE.BoxBufferGeometry(4000, 4000, 100, 1, 1, 1); console.log('creating wall material'); let wallMaterial = new THREE

three.js loading meshes as a proxy

强颜欢笑 提交于 2020-01-07 03:49:16
问题 I'm not sure that this is a good way of doing this (in fact i think it is not) but for convenience sake i tried to do something with the JSONLoader, thats similar to what TextureLoader does: var loader = (function(){ var cache = {}; var loader = new THREE.JSONLoader(); function getGeometry( url ) { enter code here //if there is something in the cache just return that if( cache[ url ] ) return cache[ url ]; //if not, create an instance of geometry cache[url] = new THREE.Geometry(); //start

How to turn off shadows in MaskPass?

一曲冷凌霜 提交于 2020-01-07 03:05:50
问题 I have a MaskPass that uses separate scene for a picked object. I'd like the object to be lit the same way as in the original scene, preferably without copying all the lights into the second scene and updating their positions as well. In r65 it was default behavior of the WebGLRenderer and it seems it was considered a bug and removed. Any ideas how to reproduce the original behavior? (It only occurs when shadowMap is enabled, which I need to have) 回答1: Got it. MaskPass.render calls

How to turn off shadows in MaskPass?

*爱你&永不变心* 提交于 2020-01-07 03:05:18
问题 I have a MaskPass that uses separate scene for a picked object. I'd like the object to be lit the same way as in the original scene, preferably without copying all the lights into the second scene and updating their positions as well. In r65 it was default behavior of the WebGLRenderer and it seems it was considered a bug and removed. Any ideas how to reproduce the original behavior? (It only occurs when shadowMap is enabled, which I need to have) 回答1: Got it. MaskPass.render calls

How can I draw geoJSON in three.js as a mesh and not a line, and fill with color?

牧云@^-^@ 提交于 2020-01-07 02:51:26
问题 I'm making a globe in three.js and will be adding some data layers. All of the layers will be created from geoJSON. I have set it up so that the globe (the first data file, which is of countries) shows up as lines. This uses ThreeGeoJSON. However, I do not want just outlines. I'd like to fill the countries with color. My current project can be seen here: http://bl.ocks.org/jhubley/321232d4ccefefcdc53218fd0adccac5 The code is here: https://gist.github.com/jhubley

RequireJS and THREE.js Orbit Controls

我只是一个虾纸丫 提交于 2020-01-07 02:35:29
问题 I am using THREEjs r83 in a requirejs build. No matter what I do, the OrbitControl is loading & running before THREEjs initiates so I get the persistant error: Uncaught ReferenceError: THREE is not defined Here is the initial part of my file where you can see THREE is required as a shim for the OrbitControl. I've gone over the code repeatedly & cannot work out a solution. Can anyone help me out? requirejs.config({ paths: { three: 'lib/three' }, shim: { 'three': ["lib/FloatFix"], 'lib

How can a 3D box with unequal sides fill the viewport, no matter its orientation in perspective?

爷,独闯天下 提交于 2020-01-07 00:34:28
问题 As shown in the included (three.js) live snippet (also at jsfiddle.net/gpolyn/une6tst5/21) *, I have a box with unequal sides that a viewer may re-position by dragging. The extreme left, right, top or bottom box corners in the viewport are dynamically indicated by green square dots. My modeling challenge is as follows: For a given viewport, present my box so that through all positions the dots with the longest window distance between them are at their respective viewport edges . So, for one

Prevent decal from showing on inside of mesh

别来无恙 提交于 2020-01-06 21:09:47
问题 I'm looking at the example here: http://threejs.org/examples/#webgl_decals If I shoot a decal on the lips, adjust the orbital controls minimum distance, and go inside the mesh, I can see the decal on the inside of the mesh. Is there a way to prevent this? I'm trying to use the decal for something else where it is not desireable to have the decal show on both sides. Since THREE.DoubleSide is not the default, I'm not sure how this is happening. 回答1: When you create your material, simply set