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

**URL:** <https://discourse.threejs.org/t/shadermaterial-showing-only-part-of-the-shape-but-shows-all-when-wireframe-true/32102>\
**Category:** Questions\
**Tags:** shader-material, fragment-shader, wireframe\
**Created:** [November 25, 2021, 8:46pm UTC](https://discourse.threejs.org/t/shadermaterial-showing-only-part-of-the-shape-but-shows-all-when-wireframe-true/32102 "2021-11-25T20:46:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nor\_three](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@nor\_three](https://discourse.threejs.org/u/nor_three)\
**Post date:** [November 25, 2021, 8:46pm UTC](https://discourse.threejs.org/t/shadermaterial-showing-only-part-of-the-shape-but-shows-all-when-wireframe-true/32102/1 "2021-11-25T20:46:37Z")

</div>

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](https://jsfiddle.net/sfqokx8h/1/) . You can change the wireframe mode in the first line.

Thanks.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [November 26, 2021, 1:54pm UTC](https://discourse.threejs.org/t/shadermaterial-showing-only-part-of-the-shape-but-shows-all-when-wireframe-true/32102/2 "2021-11-26T13:54:36Z")

</div>

Don’t create your index like that:

```javascript
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:

```javascript
geom.setIndex(indices);

```

[https://jsfiddle.net/udwzrj1f/](https://jsfiddle.net/udwzrj1f/)

---

<div class="post-metadata">

**Author:** ![nor\_three](https://avatars.discourse-cdn.com/v4/letter/n/e9c0ed/32.png) [@nor\_three](https://discourse.threejs.org/u/nor_three)\
**Post date:** [November 26, 2021, 2:27pm UTC](https://discourse.threejs.org/t/shadermaterial-showing-only-part-of-the-shape-but-shows-all-when-wireframe-true/32102/3 "2021-11-26T14:27:14Z")

</div>

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