Skip to main content

Questions tagged [three.js]

Three.js is a lightweight cross-browser JavaScript library/API used to create and display animated 3D computer graphics on a Web browser. Three.js scripts may be used in conjunction with the HTML5 canvas element, SVG or WebGL.

0 votes
1 answer
43 views

Slice a volume in GLSL using raymarching

I'm currently visualizing scientific data as volumes using Three and GLSL. I have a raymarching script that is pretty standard and colors based on a colormap I feed into the shader. It looks like this ...
TheJeran's user avatar
  • 121
1 vote
0 answers
167 views

GLSL : Extremely slow compilation when using loop

I am making multiple gradients with GLSL. However, when I started using a loop instead of a lengthy else if condition, the compile time jumped from 2-4sec to 40sec !...
Ambroise Rabier's user avatar
1 vote
0 answers
26 views

How can I see the whole shader's text content, with all the prepended code by Three.js, when using ShaderMaterial or RawShaderMaterial (r148)?

I know that Three.js prepends the shader text you provide with some code that includes definitions etc. I am not a big fan of "magic" and I would like to be able to see the final text ...
Michael Kolesidis's user avatar
2 votes
0 answers
42 views

How to add HemisphereLight to a simple threejs scene?

I'm trying to add light and see its changes in a simple scene in threejs but no matter the intensity or the color I set for the light, I see no change in a scene. Actually, if I don't include the ...
Jonas's user avatar
  • 31
1 vote
0 answers
36 views

How to make elevated parts of a steep plane seem darker than the lower surface? [GLSL]

I made a plane in THREEjs using Mesh, PlaneGeometry and ShaderMaterial. It's a very simple/basic form. I applied a simple phormula to make the plain more steep. Now I'm trying to make the lower ...
Jonas's user avatar
  • 111
1 vote
0 answers
44 views

ThreeJS multicolor material

How can I have a multicolor material in ThreeJS? I'm looking for a way to have a single material and use one or more b/w masks to color the surface of the model with the same amount of colors; the ...
fudo's user avatar
  • 121
1 vote
1 answer
221 views

ThreeJS OutlinePass error on Vertex shader not compiled

Trying to replicate ThreeJS outline postprocessing example, but I'm facing an error on some uncompiled Vertex shader. I actually just copy/pasted source code with some small adjustment (removed the on-...
fudo's user avatar
  • 121
4 votes
1 answer
599 views

Which provides better intuition: THREE.Geometry or THREE.BufferGeometry?

THREE.js recently dropped support for THREE.Geometry in favor of exclusively THREE.BufferGeometry. I'm trying to decide which paradigm to teach in my computer graphics course to best provide students ...
TomKern's user avatar
  • 251
2 votes
1 answer
109 views

Finding a texture pixel (X,Y) on a Sphere

I'm using three.js combined with face recognition, I want to rotate a sphere that displays my input video according to the detected eye location, the face recognition gives me a X,Y on the texture ...
nirhere's user avatar
  • 23
1 vote
0 answers
109 views

Blur calculation in shader with fixed CoC

I have just started learning how to use and create shaders in ThreeJS and, while going through some shaders in the example folder, I have come across a bokeh shader. Inside the shader, blur is ...
Francesco Maltagliati's user avatar
0 votes
1 answer
2k views

THREEjs: updating an object's matrix doesnt change it's position and rotation params

I want to set a transformation matrix to an object upon creation and then control it by position, rotation and scale, but while changing the matrix does change the object in world space, it's position ...
Roman's user avatar
  • 3
1 vote
0 answers
129 views

Draw Line on Arbitrary Surface

I'm working on a 3D modeling tool and we use data from OpenLayers to construct a 3D mesh of some land. I want this behavior: you click on the mesh and it puts a point where you clicked on the mesh. ...
Valentin Molina's user avatar
1 vote
0 answers
153 views

How to use MTLLoader in THREE.js

I'm a student in computer science and I have a project where I need to create a 3d scene with a train. I loaded the model correctly but the texture is a .mtl file. So I looked the official ...
Marco87's user avatar
  • 11
1 vote
0 answers
373 views

How to hide a part of a geometry dynamically using a shader in three.js

I have a very big geometry in three.js and I want to hide a section of that geometry along an axis (for example every vertex with a Z>N must be hidden). My idea is to create a custom shader in GLSL ...
Nicolò Monica's user avatar
0 votes
1 answer
338 views

Using depth texture to mask local pixels

I have a scene with camera facing billboards drawn with depth write off so they appear on top of other objects. I would like to draw each sprite so that any obscured pixels are drawn with a very low ...
Snicklefritz's user avatar

15 30 50 per page