Skip to main content

Questions tagged [three.js]

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

Filter by
Sorted by
Tagged with
15 votes
1 answer
39k views

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. ...
Ramy Al Zuhouri's user avatar
13 votes
1 answer
4k views

I am developing an RTS game with boats, the boats can shoot very frequently and I am having a hard time dealing with the explosion sounds. I am using three.js and the audio API it has that uses the ...
Gabriel Machado's user avatar
11 votes
4 answers
10k views

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 ...
user990827's user avatar
6 votes
2 answers
2k views

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: ...
Tom Leese's user avatar
  • 163
5 votes
2 answers
8k views

FYI, I am trying to do something almost identical to the following: Merging geometry/mesh without losing benefits I essentially have a list of Three.object3D's. These objects are "merged" ...
AlvinfromDiaspar's user avatar
4 votes
4 answers
10k views

Okay, I think the problem that I'm having is that when I create my DirectionalLight with three.js, when I then rotate my object with ...
shan's user avatar
  • 191
4 votes
1 answer
776 views

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: ...
MaiaVictor's user avatar
  • 1,180
4 votes
1 answer
942 views

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 ...
mjanisz1's user avatar
  • 247
4 votes
2 answers
3k views

I'm trying to create a browser moba-like game using three.js. I'm using WASD for movement and the player rotation follows the mouse with mousemove then lookAt() the ...
Eptick's user avatar
  • 41
4 votes
1 answer
939 views

I'm using THREEjs's exporter to export a 2D polygon plane. The resulting JSON gives me the vertices. I'm trying to properly order these vertices as to make the actual polygon shape, without luck. ...
John's user avatar
  • 186
4 votes
1 answer
668 views

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 ...
user990827's user avatar
4 votes
1 answer
5k views

Here's one way to implement delta time: ...
Starkers's user avatar
  • 961
4 votes
2 answers
5k views

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 with ...
jcora's user avatar
  • 7,917
4 votes
1 answer
159 views

I'm using the Three.js JavaScript library to do some things in WebGL, and I wonder how the graphic aspects of timers are done on mobile. I was creating numbers with geometries and just replacing them ...
Kahless's user avatar
  • 141
4 votes
1 answer
7k views

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 ...
bazola's user avatar
  • 218
3 votes
1 answer
13k views

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. <...
Kwaak's user avatar
  • 133
3 votes
1 answer
4k views

I'm using three.js to make an animation of a box moving around the screen in 3 dimensions. It is moving pseudo-randomly, according to a noise function. So, I want to place an invisible wall just ...
Luke's user avatar
  • 187
3 votes
1 answer
3k views

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 ...
Jesuso Ortiz's user avatar
3 votes
2 answers
6k views

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: ...
Bartosz Walicki's user avatar
3 votes
1 answer
806 views

I'm currently working on a Three.js project, and I'm aiming to create a seamless cube map. To achieve this, I created six planes and assembled them into a cube. Then, I utilized a shader to generate ...
Miguel Myers's user avatar
3 votes
1 answer
8k views

Use case: I have a currentRotation quaternion and a targetRotation quaternion and need to calculate the relative rotation ...
AtiX's user avatar
  • 61
3 votes
0 answers
747 views

I am trying to move a ball mesh through a maze. The maze belongs to a parent object3d. My issue is that when I move the ball I can't detect collision right well because in the rotation, the axis ...
myhappycoding's user avatar
2 votes
2 answers
10k views

I've been doing some reading and can't seem to figure out a good way to do this.. I have a simple globe with a material on it like so: ...
shan's user avatar
  • 191
2 votes
1 answer
9k views

I'm new to THREE.js and I have a frustrating problem. I can't get my grass texture to size "normally" on the terrain. I get it, the terrain is steep, but that doesn't mean the grass should be ...
clickbait's user avatar
  • 257
2 votes
1 answer
91 views

I've played Metroid Blast on Wii U, and would like to build one of its features in a three.js game. The feature is: if an opponent is out of view, a guide is displayed showing the direction of the ...
Emil's user avatar
  • 21
2 votes
1 answer
3k views

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 ...
Micah Bolen's user avatar
2 votes
1 answer
1k views

I'm trying to understand if it's possible to create a game where the player can switch between 2d (strategic/bird view) and 3d (actual gameplay) using only the 3d supported JS/HTML5 game engine, like ...
Kata's user avatar
  • 123
2 votes
1 answer
2k views

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 ...
samleo's user avatar
  • 31
2 votes
1 answer
3k views

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: ...
Gerharddc's user avatar
  • 392
2 votes
1 answer
610 views

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 ...
Nathan's user avatar
  • 153
2 votes
2 answers
10k views

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 ...
Nick's user avatar
  • 1,605
2 votes
1 answer
935 views

I'm having trouble getting sprites to display on top of a 3D mesh. My requirements are as follows: Sprite should billboard Sprite should not clip into the mesh Sprite should be hidden when on the ...
Cobertos's user avatar
  • 1,644
2 votes
3 answers
1k views

I'm making a 3D game where the player can walk across the surface of a planet. I am having a problem correctly rotating the camera's frame of reference, so that the camera is oriented correctly ...
peterjwest's user avatar
2 votes
1 answer
470 views

I have a hexagon tiled geometry I created in Blender Which I then load in WebGL, using THREE.js library. Below is the loading code, I've cut the code of creating scene, lights, etc. I create rendered ...
user1617735's user avatar
2 votes
1 answer
260 views

I instantiate one PlaneGeometry, then I instantiate 200 meshes sharing this geometry and with their own instance of a given shaderMaterial. Here is a simplified version of the code : ...
Eturcim's user avatar
  • 141
2 votes
1 answer
294 views

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. ...
jskidd3's user avatar
  • 141
2 votes
0 answers
614 views

I created a ShaderMaterial to draw a box in three.js using the following key code: ...
samm's user avatar
  • 121
2 votes
0 answers
389 views

I'm trying to create a visual effect where an arbitrary part of the main scene is either clipped out by or cropped to an arbitrary volume. That is to say, I might want to draw just the area of the ...
John Laxson's user avatar
1 vote
2 answers
6k views

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 ...
lot's user avatar
  • 223
1 vote
2 answers
9k views

For example, an object is located at (x,y,z) in world space. Now how to calculate the offset translation, I mean no rotation, that will be applied to the camera so as to place the object at the center ...
zwcloud's user avatar
  • 163
1 vote
1 answer
238 views

I have an engine that uses either three.js (3D WebGL rendering library) or pixi.js (2D rendering library) depending on the game. ...
nialna2's user avatar
  • 930
1 vote
1 answer
1k views

I need to have one object that is always visible/rendered (a lens flare, to be exact). I don't want to set the camera far plane to the maximum possible distance between camera and the sun (performance ...
tomi.lee.jones's user avatar
1 vote
2 answers
4k views

I have a three.js (REVISION: '68') issue with the lighting of THREE.Geometry objects: I'm using the THREE.Geometry class to build up objects using vertices and faces, then I computeFaceNormals() and ...
DavidWaugh's user avatar
1 vote
1 answer
1k views

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 ...
RodgerDodger's user avatar
1 vote
2 answers
394 views

I would like to develop a simple and small game for WebXR so that Quest, Index, etc. can play it. I would eventually like to be able to put it on the Quest store and Steam. Is there a way to publish a ...
Imperial A's user avatar
1 vote
1 answer
667 views

When I rotate the camera some of my blender models become transparent from different angles. They are gltf models Here is the Python to save the gltfs ...
Zack Younger's user avatar
1 vote
1 answer
2k views

I am trying to understand a way in THREE.JS (and the mathematical foundation) to get the direction an object should rotate to lookAt other but without actually rotate it. I've tried to use ...
Rui d'Orey's user avatar
1 vote
1 answer
387 views

I am creating a FPS game online. I want the user to be able to use a sensitivity they are familiar with from games they've played. In this case, I want them to use their Fortnite sensitivity. I am ...
Ben Stallwood's user avatar
1 vote
1 answer
3k views

I'm trying to make a 3rd person camera for a game with THREE.js and Physijs (if that's important), and so far I have set it up so that the camera follows behind the player using cos and sin etc. but I ...
B''H Bi'ezras -- Boruch Hashem's user avatar
1 vote
1 answer
921 views

I have a question, I need a formula to calculate the distance and a force based on the speed that drags the finger up on the phone. And is there any way I can get a look? And also shows the trajectory ...
Lucas's user avatar
  • 31