Three.js is a JavaScript 3D Library which makes use of WebGL

learn more… | top users | synonyms (1)

2
votes
1answer
55 views

How do I make cars on a one-dimensional track avoid collisions?

Using three.js, I use a simple spline to represent a road. Cars can only move forward on the spline. A car should be able to slow-down behind a slow moving car. I know how to calculate the distance ...
2
votes
3answers
55 views

Merging geometry/mesh without losing benefits

In three.js we can simply merge geometry to limit the amount of draw calls and thus increase performance. In a simple test with one material, I could draw 50.000 cubes + shadows @ 60fps on my GTX660 ...
2
votes
1answer
103 views

Emscripten code and three.js

I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js ...
2
votes
1answer
191 views

Orthographic Camera and Raycasting in Three.js

I'm working on a test project porting a simple game from iOS to Javascript. I've got the orthographic camera working and it can view the objects in the scene and move up and down the tower of meshes ...
1
vote
0answers
45 views

Three.js camera turning leftside right

In Three.js I am trying to implement an orbiting camera can be rotated around the x and the y axis. I am using these two functions: function rotateX(rot) { var x = camera.position.x, ...
0
votes
1answer
67 views

How to make player rotate towards mouse [duplicate]

I'm making a top down shooter with Three.js and Box2d. I'm displaying all of the graphics in 3d, but all of the physics are done in 2d, so it's sort of like super smash bros in a way. Anyway, how can ...
3
votes
1answer
153 views

Most efficient way to implement delta time

Here's one way to implement delta time: /// init /// var duration = 5000, currentTime = Date.now(); // and create cube, scene, camera ect ////// function animate() { /// determine delta /// ...
-2
votes
1answer
63 views

List of GLSL ES built-in variables

I am writing an article on WebGL and three.js, I'm trying to search all the built-in variables available in the vertex and fragment shader. I've found many sites mentioning some, for example: ...
0
votes
2answers
90 views

what function creates rotation effect in three.js?

which part of the code is responsible for the rotation in this example? Is it the camera or the scene itself? http://threejs.org/examples/#canvas_camera_orthographic
0
votes
1answer
253 views

First person camera world matrix issue (in THREE.js and webGL)

I'm trying to create a Portal-like effect in webGL using THREE.js. I have two scenes connected by a pair of portals. The view of the 2nd scene in rendered inside the 1st portal using stencils and ...
0
votes
1answer
48 views

Is it possible or not to share a geometry among many meshes and applied a different shaderMaterial for each?

I instanciate one PlaneGeometry, then I instanciate 200 meshes sharing this geometry and with their own instance of a given shaderMaterial. Here is a simplified version of the code : ... var geom = ...
1
vote
2answers
2k views

How to load geometry/object/scene created in Clara.io with Three.js

Does anybody know how to load anything created in Clara.io into your Three.js scene? Clara.io allows export of ThreeJS geometry, object or scene. I tried all those in combination with all THREE ...
1
vote
1answer
112 views

Starting with shaders and particles

I'm working on a flow field with particle systems and starting to learn about shaders in three.js. Current state of my work is available here. As such amount of calculations is quite heavy for a big ...
0
votes
1answer
188 views

Particle movement in three Dimensions

I have created a particle system which movement is controlled by a flow field over perlin noise - Available here. I would be very thankful for any ideas and tips how to control their movement on the ...
0
votes
0answers
87 views

parametric 3D sphere unwrapping math for perfect 3D-textures

After some time looking or it on the internet I can't find the proper answer to my concern. I'm currently generating 3D textures on a shader for my planets to avoid sphere mapping issues (pole, ...
0
votes
1answer
64 views

How would one outline an alpha transparency layer in javscript and/or php? [duplicate]

I simply want an outline/edge detection of the character/item/object that is selected or doing something. I'm seeing lots of versions of this question for different languages, but I would appreciate ...
1
vote
1answer
439 views

How to compute tangent and bitangent vectors

I have a texture loaded in three.js, then passed to the shaders. In the vertex shader I compute the normal, and I save into a variable the uv vector. <script id="vertexShader" ...
0
votes
1answer
346 views

Reduce render time for a tiled map in ThreeJS

I'm working on a WebGL game using Three.js, its been a few days and I found my first issue, render time on big maps. The game runs great, there are even some AI mobs that run around randomly like ...
1
vote
1answer
210 views

Replace a div (with a ball picture in it) with a 3D canvas ball [closed]

I am trying to make a game where you have to keep the ball on a green platform. At this point the ball is a div with a ball image. You can move the ball over the field, all works great. See it in ...
1
vote
1answer
290 views

UV mapping issues while loading collada model exported with Sketchup

I load collada models, exported via Google Sketchup, into my Three.js (v63) scene with the Three.js collada loader. The models are loaded, but with some, textures aren't well mapped, like in the ...
1
vote
1answer
426 views

How can I implement a simple “jump” action with three.js and/or Physijs?

Assume I have a simple Physijs object like this car. How can I adapt something like this to "jump" (hydraulics ftw!) when pressing spacebar for instance? I'm currently thinking applyCentralImpulse ...
1
vote
1answer
291 views

How to manage frustum culling

I have a spherical clipmap based planet terrain. The entire planet is made from a ring geometry of 1 unit which the vertex shader moves to cover the entire planet of 6 million unit radius. But the ...
5
votes
1answer
219 views

Walking on a sphere

I'm working on a game which involves walking your character on the surface of a sphere. Using the answer to Arbitrary Rotation about a Sphere, I've written my code as: if (game.isKeyDown(37)) { // ...
0
votes
1answer
770 views

Three.js camera rotation and behavior

I'm just getting into Three.js and the camera is causing some problems. Basically, I want to implement spectator-like movement controls, so that I can move around freely in the scene. The problem is ...
2
votes
1answer
150 views

How good do I have to be at Math to create a 3D game using three.js? [closed]

A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. ...
1
vote
0answers
105 views

Is there an out-of-the-box way to create a custom non-convex polygon in three.js?

Does Three.js offer an out-of-the-box way to create custom non-convex polygon, or do I have to use THREE.Geometry and set faces manually? I'm guessing that ShapeGeometry has something to do with this, ...
4
votes
1answer
484 views

Why game engines usually don't offer a vector3.rotate method? [closed]

Game engines like Three.js, Ogre3d and Unity3d often don't provide a default rotate method on their vector class. You usually have to do something like: rotated = vector.applyQuaternion( new ...
2
votes
1answer
309 views

Particle systems on multiplayer games

I'm working on a 2D javascript/Three.js multiplayer game, using web sockets and an authoritative server currently written in Python. The combat mechanic will be similar to Geometry Wars however i'm ...
0
votes
1answer
284 views

best way of rendering more 3D models in three.js that not slow down page?

I am in the way of creating a 3D web game using threeJS library. This is a multi-player game that players are 3D human models in game, and I need to add a human 3D model for each player that enters ...
1
vote
2answers
3k views

How to handle 3D collisions using raycasting (with a reflection vector?)

I'm making a game using THREE.JS, and I want my character to walk on the terrain, and collide with static 3D objects (=AABB boxes) that are on that terrain. The problem is: THREE.JS has only a ...
2
votes
2answers
1k views

Quaternions - how to limit axis?

Is there any possibility to limit quaternions to move only in x & y axis (like in Eulers- yaw and pitch, without rolling)? I's there any equation or something similar to do this? Some example: ...
2
votes
2answers
969 views

How to rotate an object so it stands correctly (back always facing the camera)

I have the following scene: And I have two 3D vectors, the camera position, and the focus position. The focus vector is always behind the monster. I know how to rotate the camera around the focus ...
0
votes
2answers
201 views

Rotate 3D camera relative to what's on screen (in threejs)

I'm trying to have a camera in Threejs react to respective left/right/up/down/forward/backward keys, always based on the direction the camera is currently facing. It works fine left/right ...
1
vote
1answer
3k views

Translate object in world space usings it's local rotation

I'm using Three.JS to render some objects. I'm struggling with some very simple object rendering and translation. The scenario is that I spawn an object at 0,0,0 in world space with 0,0,0 rotation. ...