three.js

Unable to change element colour in Viewer

大兔子大兔子 提交于 2019-12-13 04:26:33
问题 To test out a PoC, I'm trying to colour a selected element red. To do this I have created a class, as below, but nothing happens to the elements when I select them. I've tried a number of the examples around the web (including some which create a mesh proxy for the render proxy and add an overlay) but nothing works. How do I change the colour for a given element (either dbId or fragId )? I can't find API documentation for most of this in the Forge API, so I'm flying a little blind. /* global

How to make JSFiddle of sprites using THREE.JS source and image files from Github?

让人想犯罪 __ 提交于 2019-12-13 04:25:17
问题 Hi I am trying to make a JSFiddle based on the official THREE.js HUD Sprites example. The JSFiddle runs but it doesn't seem to load/apply the sprite images using the URL's in the original file:- //... URL's as in the Original file var mapA = THREE.ImageUtils.loadTexture ("textures/sprite0.png", undefined, createHUDSprites ); var mapB = THREE.ImageUtils.loadTexture ("textures/sprite1.jpg" ); mapC = THREE.ImageUtils.loadTexture ( "sprite2.png" ); I have tried various alternative URL's without

Three.js camera rotation issue

自古美人都是妖i 提交于 2019-12-13 04:22:22
问题 I want to rotate the camera around the x-axis on the y-z plane while looking at the (0, 0, 0) point. It turns out the lookAt function behaves weird. When after rotating 180°, the geometry jump to another side unexpectedly. Could you please explain why this happens, and how to avoid it? You can see the live demo on jsFiddle: http://jsfiddle.net/ysmood/dryEa/ class Stage constructor: -> window.requestAnimationFrame = window.requestAnimationFrame or window.webkitRequestAnimationFrame or window

gradient multicolor metaballs with threejs and marchingcubes

一个人想着一个人 提交于 2019-12-13 04:04:44
问题 I am looking on how to implement something similar than this work: https://vimeo.com/9121195 . But with explicitly attributing colors to each metaball from an array of given colors. As far as I can see, this is done entirely from the shader side in this example but I was wondering if this could not be implemented with Threejs and marchingcubes. By creating a new THREE.ShaderMaterial I assume I can pass positions of each metaball to the shader and then evaluate the distance of each vertex with

Procedurally generated texture for Particle with three.js

落爺英雄遲暮 提交于 2019-12-13 03:56:57
问题 My goal is to create a particle system that involve procedurally generated texture for each particle (vertices), but I find it difficult to create a prototype of such particle system that works under both Canvas and WebGL renderer with three.js Criteria I am trying to achieve: Renderer independent (ParticleCanvasMaterial won't work with WebGL) Circular texture (ParticleBasicMaterial does not like canvas texture; unable to make it output a circle shape) Procedurally generate those texture

three.js transparency renderring anomaly

夙愿已清 提交于 2019-12-13 03:53:49
问题 History: Working on Clara.io anatomy models exported from Mathematica https://forum.clara.io/t/transparency-artifact/6421 https://clara.io/player/v2/588449a8-1370-4433-8b30-544e34dba272?wait=true Some anomalies observed when surfaces are enclosing volumes or overlapping certain ways. In most cases it does not https://clara.io/player/v2/1e0c3009-dabc-4d0c-af91-8dec5b851263?wait=true Mostly happens when the surfaces bound a volume https://clara.io/player/v2/4d432c4e-2b0e-4c9c-9fee-18ff8517d6f8

WebAudio changing of orientation of Listener and/or Panner

隐身守侯 提交于 2019-12-13 03:53:32
问题 I am trying to understand how the WebAudio API would work. I have two objects; one representing the listener and one the source. And have used the below link as an example. I am able to move the source and the sound position changes. https://mdn.github.io/webaudio-examples/panner-node/ The command to change the orientation has been provided: viz this.panner.setOrientation or this.listener.setOrientation . The question I have is: if I have a source or listener object (in canvas mode using

Creating THREE.Points return Cannot convert undefined or null to object

浪尽此生 提交于 2019-12-13 03:49:07
问题 This is a part of the code. I tested the geometry and material variables on both return values. Removing these variables, the error disappear. var actionZ = 0; var rotationA = 1.1; var movementSpeed = 1; var totalObjects = 40000; var rotated = false; var container = document.createElement('div'); container.className = 'home-background'; document.body.appendChild( container ); var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight,1, 2000) camera.position.z = 2000;

Finding the index of a clicked object on the canvas

五迷三道 提交于 2019-12-13 03:47:14
问题 Edit: here is a simplified JSFiddle. The event listener is on line 60. I'm using js and three.js to animate moving dandelion seeds, and I need to stop a seed if it is clicked. I'm adding an event listener to each seed, like so: for (var i = 0; i < seeds.length; i++) { s=seeds[i]; domEvents.addEventListener(seeds[i].mesh, 'click', function(event){ s.clicked = true; console.log('you clicked on the mesh'); $('#id01').modal('show'); }, false); } The problem is that when a seed is clicked, the

How to load scene from dropdown box?

情到浓时终转凉″ 提交于 2019-12-13 03:46:13
问题 I need to be able to load a specific image into a scene, selected from a dropdown box. The dropdown box is written in html, and the scenes of course are with three.js. I have tried implementing an onClick listener, but I am having trouble translating it in order to be loaded into the scene. The javascript: var mySelect = document.getElementById('mySelect'); mySelect.onchange = function() { if(mySelect=="111"){ imgLink='images/111.jpg'; } if(mySelect=="222"){ imgLink='images/222.jpg'; } if