ShaderMaterial showing only part of the shape (but shows all when wireframe == true)

Hi, I’ve created a simple shader to show a curve. My problem is that only part of the curve (the beginning) shows up on the screen.
However when I set the wireframe mode, then I can see all the triangles.

Is it an issue with my fragment shader? What causes WebGL to choose on what fragments the fragment shader gets called.

I tried putting the camera behind the curve, and I still don’t see the hidden part.

Reproduction here: Edit fiddle - JSFiddle - Code Playground . You can change the wireframe mode in the first line.


Don’t create your index like that:

geom.setIndex(new THREE.Uint32BufferAttribute(Uint32Array.from(indices), 3));

First of all, the itemSize of an index is 1 not 3. Besides, let the engine decide what type of buffer attribute should be used. Just do:



Thanks! Would be nice to add to the docs the fact that we can give classic arrays to setIndex.