# My Gap won't render!

**URL:** <https://talk.code3dgames.com/t/my-gap-wont-render/381>\
**Category:** Uncategorized\
**Created:** [September 1, 2021, 1:14am UTC](https://talk.code3dgames.com/t/my-gap-wont-render/381 "2021-09-01T01:14:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/martin/32/41_2.png) [@Martin](https://talk.code3dgames.com/u/Martin)\
**Post date:** [September 1, 2021, 1:14am UTC](https://talk.code3dgames.com/t/my-gap-wont-render/381/1 "2021-09-01T01:14:45Z")

</div>

Idk why its not working, pls help me  
Url:  
[https://is.gd/wPMYQA](https://is.gd/wPMYQA)

---

<div class="post-metadata">

**Author:** ![chris](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/chris/32/5_2.png) [@chris](https://talk.code3dgames.com/u/chris)\
**Post date:** [September 1, 2021, 1:34am UTC](https://talk.code3dgames.com/t/my-gap-wont-render/381/2 "2021-09-01T01:34:00Z")

</div>

Very sorry for the delayed reply!

The gap loop is in the wrong place. Right now it is above the noise loop:

```javascript
function addGround() {
  var faces = 99;
  var shape = new THREE.PlaneGeometry(10, 20, faces, faces);
  for(var j=50; j<numVertices; j+=100) {
  shape.vertices[j].z = -1;
  }
  var numVertices = shape.vertices.length;
  var noiseMaker = new SimplexNoise();
  for(var i=0; i<numVertices; i++) {
    var vertex = shape.vertices[i];
    var noise = 0.25 * noiseMaker.noise(vertex.x, vertex.y);
    vertex.z = noise;
  }
  
  shape.computeFaceNormals();
  shape.computeVertexNormals();
  // more code here...
}

```

Instead, it needs to go _below_ the noise loop (and above the compute method calls):

```javascript
function addGround() {
  var faces = 99;
  var shape = new THREE.PlaneGeometry(10, 20, faces, faces);
  var numVertices = shape.vertices.length;
  var noiseMaker = new SimplexNoise();
  for(var i=0; i<numVertices; i++) {
    var vertex = shape.vertices[i];
    var noise = 0.25 * noiseMaker.noise(vertex.x, vertex.y);
    vertex.z = noise;
  }
  
  for(var j=50; j<numVertices; j+=100) {
    shape.vertices[j].z = -1;
  }

  shape.computeFaceNormals();
  shape.computeVertexNormals();
  // more code here...
}

```

That should get the gap in place. Sorry again for the slowness of my reply!

-Chris

---

<div class="post-metadata">

**Author:** ![Martin](https://talk.code3dgames.com/user_avatar/talk.code3dgames.com/martin/32/41_2.png) [@Martin](https://talk.code3dgames.com/u/Martin)\
**Post date:** [September 1, 2021, 12:05pm UTC](https://talk.code3dgames.com/t/my-gap-wont-render/381/3 "2021-09-01T12:05:04Z")

</div>

No problem because of the Reply, now the code works. Thx
