three.js

Three.js - Arranging cubes in a grid

左心房为你撑大大i 提交于 2019-12-12 03:59:27
问题 I would like to position cubes in a rectangular/square like grid. I'm having trouble trying to create some methodology in depending on what I pick through an HTML form input (checkboxes) to have it arrange left to right and up to down, a series of cubes, in a prearranged grid all on the same plane. What measurement units is three.js in? Right now, I'm setting up my shapes using the built-in geometries, for instance. var planeGeometry = new THREE.PlaneGeometry(4, 1, 1, 1); The 4 and 1; I'm

Three.js Z fighting

断了今生、忘了曾经 提交于 2019-12-12 03:54:50
问题 While moving and zooming a model I am facing this problem.Looking weird. Tried setting logarithmicDepthBuffer:true in webgl renderer and near value of perspective camera to higher as suggested(1000).But the result is not fruitful. Can anyone help me with different answer. Any suggestion is welcome Thanks in advance 来源: https://stackoverflow.com/questions/41462145/three-js-z-fighting

three.js: sceneLoader & rays issue

时间秒杀一切 提交于 2019-12-12 03:53:55
问题 Issue: Rays doesn't work with models loaded via sceneLoader Problem explanation: I used to load my model with JSONLoader, but needed to import all information of scene, so I tried sceneLoader(). Everything loads fine, but raycasters intersectObject() function doesn't find intersections. Old version with JSONLoader (cca line 350): http://golem.fjfi.cvut.cz/virtual/matusu/BakalarkaMM/Bakalarka.html New version with sceneLoader (cca line 900): https://www.dropbox.com/s/ikpobra4bo5iz2y/BMM.html

How to draw walls in ThreeJS from path or 2d array?

人走茶凉 提交于 2019-12-12 03:53:48
问题 I need to draw a 3d house model (walls only) from a 2d path or array (explained later) I receive from FabricJS editor I've built. The type of data sent from 2d to 3d views doesn't matter. My first (and only quite close to what I want to get) attempt was to create the array of 1s and zeros based on the room I want to draw, and then render it in ThreeJS as one cuboid per 'grid'. I based this approach on this ThreeJS game demo. So if the array look like this: var map = [ //1 2 3 4 5 6 7 8 [1, 1,

Is it possible to use 2 textures (one on top of the other) as a Material without using custom Shaders?

时光怂恿深爱的人放手 提交于 2019-12-12 03:42:52
问题 I'm learning three.js and I've done a few a examples on it and basic shaders (One being Codrop's "the aviator" tutorial), but right now I'm stumped trying to create a simple cube with 2 textures at once. I would like to use 2 transparent .png textures at the same time for each of the square's face. Is this possible without recurring to custom shaders? I already saw this answer, but I've had no success getting it to work correctly because of it's complexity and being rather new to shaders. For

Three.js load Multiple obj files one after another

試著忘記壹切 提交于 2019-12-12 03:42:16
问题 I'm using the obj/mtl loader provided by three.js to load several obj files including mtl. Now I need to load multiple objs. But I need to load them one after another. I already used THREE.DefaultLoadingManager.onProgress to add a "Loading Screen". But how can I check for loaded === total within the loop for adding new objs. Or should I use a recursive function? Hope you can help me. Thanks 回答1: There is a callback function that is called when an object is loaded. There you can trigger the

Three.js Orbit Controls with Two (Toggled) Cameras

时光总嘲笑我的痴心妄想 提交于 2019-12-12 03:36:41
问题 I have two cameras in one scene and one viewport and one renderer. I toggle (using html buttons) between cameras. THE PROBLEMS Problem 1 For camera1 there is no response from moving the mouse. When I toggle to camera2 the orbit control works fine. Toggling back to camera1 there is still no response from moving the mouse. jsfiddle v1 Original (no response from camera1) jsfiddle.net/steveow/xu0k1z75/ UPDATE: Problem 1, Fixed by Stallion - avoid setting camera position to (0,0,0). Problem 2 For

Sprite scaling causes incorrect positioning and rotation in three.js

依然范特西╮ 提交于 2019-12-12 03:33:54
问题 I'm trying to create a sprite with text. I'm not using TextGeometry for performance reasons. var fontsize = 18; var borderThickness = 4; var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); context.font = "Bold " + fontsize + "px Arial"; context.fillText( message, borderThickness, fontsize + borderThickness); var texture = new THREE.Texture(canvas) texture.needsUpdate = true; var spriteMaterial = new THREE.SpriteMaterial({ map: texture}); var sprite = new

camera and terrain collision on three.js

核能气质少年 提交于 2019-12-12 03:33:33
问题 I have a building model created with sketchup, exported as collada file and loaded to three.js with colladaloader. Everything works fine except that the camera can pass through walls. How do I prevent this? So far I have tried with Raycasting, but I think something is wrong. this is how the model is loaded loader.options.convertUpAxis = true; loader.load( 'model/cityhall.dae', function ( collada ) { dae = collada.scene; skin = collada.skins[ 0 ]; model_geometry = collada.scene.children[ 0 ]

Is there a way to curve an element?

不羁的心 提交于 2019-12-12 03:32:23
问题 is there a way (probably with webGL, maybe also with three.js) to curve an html element inwards? (So it looks like the new panoramic samsung TV, for example). Just to be clear - I do not want to create a curved plane and use an image as a texture. It's a dynamic div - a video player, with an interactive skin to be exact, and I want to curved inward) THANKS! :) 回答1: Not sure if there is a direct way , but here is a hack with :before and :after pseudo element to achieve an inward curve. #video