three.js

three.js use camera texture in different scenes/ div

混江龙づ霸主 提交于 2019-12-25 07:01:06
问题 at the moment, I am rendering a camera to a texture and put the texture on a plane mesh. This works, in the scene the texture was recorded from. When putting the same mesh into a different scene, which is running in a div, the mesh shows up, without texture. Same, when I put the texture on a mesh, which is created in the div- scene. The mesh seems to have a texture, because it is black and not red, as initialized. When leaving away the texture, it does show up in red. When I put the mesh into

texture wrapping is not repeating as it should be

孤街醉人 提交于 2019-12-25 06:49:24
问题 I'm trying to wrap a texture for the floor, but it doesn't work - the texture is not repeated 5 times as it should be. Here s the code I used: var floorTexture = new THREE.ImageUtils.loadTexture( 'textures/floor.jpg' ); floorTexture.wrapS = floorTexture.wrapT = THREE.RepeatWrapping; floorTexture.repeat.set( 5, 1 ); var floorMaterial = new THREE.MeshPhongMaterial( { map: floorTexture, side: THREE.DoubleSide } ); var floorGeometry = new THREE.PlaneGeometry( 45, 44.5 ); var floor = new THREE

loading texture issue, works with animation, blank without

你离开我真会死。 提交于 2019-12-25 06:39:21
问题 I am new to three.js, but am just coming off of a project using Java and JMonkeyEngine, so I know my way around 3d. My issue comes with loading a texture. I'm sure this question has come up quite a few times coming from the topics I've read, however the topics I have seen are older, and it didn't work with what I needed. I took an example from the site and tried editing it to my own needs. I was able to load my texture fine, and it spun around just like the example.... HOWEVER, when I removed

computeVertexNormals doesn't work with model from JsonLoader

混江龙づ霸主 提交于 2019-12-25 06:25:23
问题 Model always display in FlatShading even when I already have computeVertexNormals . Model is exported without normal for optimize purpose, loaded in 3JS by JsonLoader, and converted to BufferGeometry. Material is already SmoothShading . Please see this jsFiddle for better demonstration: http://jsfiddle.net/2w9Lkjbm/6/ 回答1: The method bufferGeometry.fromGeometry( geometry ); returns non-indexed BufferGeometry . Also known as "triangle soup", non-indexed BufferGeometry has no shared vertices,

threejs how to remove wireframe with WireframeHelper

冷暖自知 提交于 2019-12-25 06:22:51
问题 here i have function to add wireframe for the objects, so am using the following function to do it, on the first condition it is working and i can apply wireframe function wireframe(state){ if(state=='on') { var wfh = new THREE.WireframeHelper( mesh, 0xf00e0e ); wfh.material.wireframe = true; //wfh.material.linewidth = 1; // looks much better if your PC will support it scene.add( wfh ); } if(state=='off') { var wfh1 = new THREE.WireframeHelper( mesh,0xf00e0e ); wfh1.material.wireframe = false

How to create triangle faces for a real-world terrain in three.js?

陌路散爱 提交于 2019-12-25 05:25:18
问题 My goal is to create a scene similar to http://css.dzone.com/articles/threejs-render-real-world but using vector X,Y,Z points rather than a raster image. In this question I received some help in creating a three.js scene using real-world coordinates from a GIS. This showed that it is possible to use coordinates in meters. That question's answer said to create a face between 3 points: var face = new THREE.Face3(2, 1, 0); geometry.faces.push(face); How would I go about creating faces between

Bounding box doesn't include children? threejsr85

半腔热情 提交于 2019-12-25 05:02:52
问题 I am facing problem where bounding box doesn't include children of the mesh. I have tried all the solutions like calling update() of the BoxHelper but didn't got any success. Please help me with the solution Code for the bounding box:- var boxHelper = new THREE.BoxHelper(Object); // to remove the diagonals this.scene.add(boxHelper); boxHelper.material.color.set(0x00ff00); boxHelper.update(); 来源: https://stackoverflow.com/questions/43915580/bounding-box-doesnt-include-children-threejsr85

Which development environment for THREE.js, WebGL and HTML5?

廉价感情. 提交于 2019-12-25 04:55:27
问题 I'm using Eclipse but I have problems with it not showing any code hints or code completion for Javascript or any imported external scripts (Three.js). Are there any more suitable web development environments out there? 回答1: You can try Brackets with some plugins like JSLint 回答2: If you're wanting code-hints or code-completion, TernJS sounds like something you could try. It can be integrated into editors like Vim, Emacs or Sublime Text. When writing JS files, you'll be able to get the JS

Superimposing of color

99封情书 提交于 2019-12-25 04:53:40
问题 I want to paint cubes red color by means of a mouse. But thus the green cube (at the left) becomes not red, but black. The white cube (on the right) is colored normally. What to do? example here // init var material = new THREE.MeshLambertMaterial({ color: 0x00ff00, side: THREE.DoubleSide, vertexColors: THREE.FaceColors }); var geometry = new THREE.BoxGeometry(100, 100, 100, 4, 4, 4); var Cube = new THREE.Mesh(geometry, material); Cube.position.x = -100; scene.add(Cube); objects.push(Cube);

three.js not displaying all meshes

旧街凉风 提交于 2019-12-25 04:53:15
问题 weird issues with 3d max 2013 obj to three.js 59 rev, in my 3d max scene i have 5 objects , cubes ...Then when i import into three.js scene i now only have 3 cubes. also there pivot point shares to the middle of all objects: var loader = new THREE.OBJMTLLoader(); loader.load( 'models/cubes.obj') ; loader.addEventListener( 'load', function ( event ) { object = event.content; for(k in object.children){ group.add(object.children[k]); // console said there 5 objects } }); scene.add(group); Any