three.js

Three.js & Dat.gui - TrackballControls renderer.domElement disables rotate and pan

强颜欢笑 提交于 2020-01-11 10:54:52
问题 I am trying to use dat.gui with a very simple three.js (r73) scene but am running into an issue with rotate and pan not working after adding "renderer.domElement" to the trackballControls initialization. Zoom works as expected. Without renderer.domElement, I get a working rotate, zoom, pan functionality but the dat.gui interface sliders "latch" when clicked, which is just annoying and not functional. The issue as described here: Issue while using dat.GUI in a three.js example. Looked over

threejs canvas todataurl is blank

霸气de小男生 提交于 2020-01-11 09:27:12
问题 Okay, I know that canvas.toDataUrl() will produce an image in png format. However, when I try to get the image from http://threejs.org/examples/#webgl_lines_sphere. All I see is a black image on chrome. To replicate the steps - 1) Open dev console and select the canvas element. 2) canvas = $0 3) context = canvas.getContext('webgl', {preserveDrawingBuffer: true}) 4) img = canvas.toDataUrl() 5) document.write('<img src="'+img+'"/>') The image is blank. However, I tried with a different canvas

SSAO artefacts in Three

百般思念 提交于 2020-01-11 07:10:51
问题 I'm really struggling to fix an issue with my SSAO shader and could desperately use some help. Basically the shader seems to work on some objects, but looks really bad on others. From the below you can see the sphere looks correct, but the cube seems to be doing occlusion on normals that it shouldn't. Here is a screenshot: I am basing my shaders off of this tutorial: http://devmaster.net/posts/3095/shader-effects-screen-space-ambient-occlusion In my render chain I render 2 render targets

SSAO artefacts in Three

99封情书 提交于 2020-01-11 07:10:43
问题 I'm really struggling to fix an issue with my SSAO shader and could desperately use some help. Basically the shader seems to work on some objects, but looks really bad on others. From the below you can see the sphere looks correct, but the cube seems to be doing occlusion on normals that it shouldn't. Here is a screenshot: I am basing my shaders off of this tutorial: http://devmaster.net/posts/3095/shader-effects-screen-space-ambient-occlusion In my render chain I render 2 render targets

Inertia in OrbitControls from ThreeJS

心不动则不痛 提交于 2020-01-11 06:32:11
问题 I am using THREE.OrbitControls for rotating my objects. However I would like to add some innertia for camera rotation (if someone stops moving mouse, camera stops after a while). How can I accomplish that? 回答1: Here is a very simple way to add inertia in OrbitControls.js: At the end of the update function (Lines 271-272 currently) you will see the following two variables set to zero: thetaDelta = 0; phiDelta = 0; Change this so that instead of immediately going to zero, they just get smaller

How to animate the drawing of a mesh in three.js

泪湿孤枕 提交于 2020-01-11 04:12:51
问题 I've got a ribbon-like mesh made out of a buffer geometry, the faces of which are invisible. I'm using a custom shader for this -- gl_FragColor = vec4(1.0,1.0,1.0,0.0) . As a 3DObject is moved along the ribbon, I raycast the index of the faces over which it is, and update the shader making them. I'm not satisfied with the effect since it results in a pretty chunky animation. If I add more faces, then I get a serious performance hit. Would there be any way for me to update the fragment's alpha

gpu picking - invisible pixels around sprites

﹥>﹥吖頭↗ 提交于 2020-01-11 04:06:08
问题 I'm rendering a picking scene that contains sprites. As my cursor gets close to the sprite, it registers as a color and gets "picked". This invisible border gets larger closer you zoom into the sprites. Open up your console to see the IDs printed in real time. Move your cursor closer and further away to large and small sprites. You'll see that sprites get selected on an invisible border. This behavior does not happen with regular geometry, just with sprites. It's weird because I'm rendering

Can't get three.js EffectComposer to work

坚强是说给别人听的谎言 提交于 2020-01-11 03:41:10
问题 I want to start doing some postprocessing on my renders with the EffectComposer but I can't get the most basic setup to render to the screen. It just stays blank. I must be looking over something. Does anybody have an idea? <!doctype html> <html> <head> <title>game</title> <style type="text/css"> html, body { margin: 0px; width: 100%; height: 100%; } canvas { display: block; } </style> </head> <body> <canvas id="viewport"></canvas> <script type="text/javascript" src="three.js"></script>

Is there a way to wait for THREE.TextureLoader.load() to finish?

拈花ヽ惹草 提交于 2020-01-10 05:19:12
问题 I'm working with release R73. My current task is to fill an array with materials. The content of this array is supposed to be used later. That usage depends on all materials to me completely loaded. By now I loop through an array of JSON information and call this code for every element: TLoader.load( BASE_ODB_URL + jsonMat.pic, function (texture) { texture.wrapS = THREE.RepeatWrapping; texture.wrapT = THREE.RepeatWrapping; texture.repeat.set(jsonMat.scaleu, jsonMat.scalev); Mat = new THREE

Is it possible to use custom markers?

大城市里の小女人 提交于 2020-01-09 08:09:08
问题 Is it possible to use bespoke markers that do not resemble the "Hiro" marker like below. Could I potentially use a random shape (a solid red oval for example) as a marker? If this is not currently supported, could someone point me into the right direction to where I might start building this functionality? 回答1: AR.js supports custom markers. Make any silly image with the marker generator. Let ar.js know that you want to use your marker: <a-marker type="pattern" url="patterns/mypattern.patt">