three.js

THREE.js - Billboard Vertex Shader

风流意气都作罢 提交于 2019-12-12 07:22:29
问题 I have the need to orientate an instance of THREE.Mesh to always face the camera. I know I could just use the [THREE.Mesh].lookAt() method, but I'm trying to work on my GLSL chops a bit more and want to be able to do this in a vertex shader. I've read through NeHe's Billboarding tutorial, and it makes sense to me. Well, all apart from the bit where one applies these orientation vectors to each vertex. I feel like I'm very close to getting this working, but as it stands at the moment, my

Three.js r71 is showing black screen when trying to load json object

时光总嘲笑我的痴心妄想 提交于 2019-12-12 07:05:15
问题 i will enumerate what i did until now: I have a file "pre.obj" converted to "pre.js" using convert_obj_three.py script "pre.obj" uses "pre.mtl" because it has material of image "specular.jpg" "pre.obj" ,"pre.mtl" and "specular.jpg" can be looked at here respectivily xsportfit.com/threejs/pre.obj xsportfit.com/threejs/pre.mtl xsportfit.com/threejs/specular.jpg I have tried to load "pre.js" file using three.js library of this way: var scene = new THREE.Scene(); var camera = new THREE

Display texts at different-different coordinates using three.js

青春壹個敷衍的年華 提交于 2019-12-12 06:57:57
问题 I want to display different texts at different-different coordinates using three js . And I want to show the text like in the following image file at different-different location. I want that function should display text at different-different location as like in linked image file Javascript var container, camera, scene, renderer, controls; var text2; init(); animate(); function init(){ camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 1000 ); camera

Problems in finding univocal coordinates from inside a sphere

假装没事ソ 提交于 2019-12-12 06:45:34
问题 I'm working with Three.js [r78] and I'm pretty a noob both on this and JavaScript in general I finally managed to broadcast a ray from a perspective cam in the centre of a sphere with radius equal to 500 and the results for the intersections when I checked with the browser were good but not really satisfactory. I would need to exactly individuate the coordinates of a point cartesian or spherical doesn't matter together with lat e lon of the same point. When I select a specific point I get

Trackball controls doesn't work in new build of three.js

£可爱£侵袭症+ 提交于 2019-12-12 06:34:07
问题 I'm trying to make a simulation consisting of many lines. Up until now I had Three.js v45 and Trackball Controls and it worked fine. I then tried to implement my lines in a buffer geometry (as in this example: http://fzwoch.project-sheol.org/three.js/examples/webgl_buffergeometry_lines.html) but for that I needed to update to the newer Three.js build. And Trackball Controls doesn't work anymore! Am I missing something? How can I get both to work? Thank you, Kasia 回答1: First have you noticed

Drawing lines between the Icosahedron vertices without wireframe material and with some line width using WEBGLRenderer

烈酒焚心 提交于 2019-12-12 06:16:37
问题 I'm new to threejs I need to draw a sphere connected with triangles. I use Icosahedron to construct the sphere in the following way var material = new THREE.MeshPhongMaterial({ emissive : 0xffffff, transparent: true, opacity : 0.5, wireframe : true }); var icogeo = new THREE.IcosahedronGeometry(80,2); var mesh = new THREE.Mesh(icogeo, material); scean.add(mesh); But i need the width of the line to be more but line width won't show up in windows so i taught of looping through the vertices and

Atmosphere Scattering for Earth from space and on the ground

心不动则不痛 提交于 2019-12-12 06:15:37
问题 Please provide prompt how to make the atmosphere of the Earth so that it is visible from space and from the ground (as shown in the image) a model of the earth: Earth = new THREE.Mesh(new THREE.SphereGeometry(6700,32,32),ShaderMaterialEarth); model of the cosmos: cosmos= new THREE.Mesh(new THREE.SphereGeometry(50000,32,32),ShaderMaterialCosmos); and a light source: sun = new THREE.DirectionalLight(); where to start, just I do not know. Perhaps this should do ShaderMaterialCosmos , where to

Threejs and orbitcontrol

有些话、适合烂在心里 提交于 2019-12-12 06:04:35
问题 I don't understand if it is a pure javascript mistake or not. In the class function below I added an eventListener that return me this error: Uncaught TypeError: Cannot read property 'call' of undefined I want to clarify that all the function called are correctly defined. function OrbitController(v){ var that = this; this.view = v; this.controls = new THREE.OrbitControls(this.view.getCamera(),this.view.renderer.domElement); this.controls.addEventListener( 'change', that.view.show());//

Three.js ColladaLoader bumpScale/weighting? Way to adjust bump map intensity

给你一囗甜甜゛ 提交于 2019-12-12 05:53:16
问题 In the current ColladaLoader.js I don't see anything that reads or applies the Collada standard's "weighting" value (0.0-1.0) that indicates bump intensity or "bumpScale" in Three.js Phong material. I noticed that when I export my collada from Blender it picks up the bump materials instantly in three.js (which is amazingly simple - YAY!) but my materials always get an exaggerated bumpScale of default 1.0. It gives the materials an exaggerated bumpiness. I managed to edit my ColladaLoader a

Animating a Carpet Rolling Out with Three.JS - any ideas?

雨燕双飞 提交于 2019-12-12 05:49:15
问题 I am beginner to medium skills, I can create mesh with many polygons, I need to texture map it, those i can handle, but, how to make it Roll Up and UnRoll (I can handle the keyframe animation - but, i just don't know what to do to make the carpet unroll or rollup. Can be carpet or roll of paper towels, just need to know how to do the effect? There are tutorials how to do it with Cinema 4D or Maya - but, i want to do it on the website within the Three.js framework. Any ideas ??? Or is there a