# Fill Geometry with points

**URL:** <https://discourse.threejs.org/t/fill-geometry-with-points/11020>\
**Category:** Questions\
**Tags:** materials, geometry\
**Created:** [November 25, 2019, 12:26am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020 "2019-11-25T00:26:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kashish-jain](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kashish-jain](https://discourse.threejs.org/u/kashish-jain)\
**Post date:** [November 25, 2019, 12:26am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/1 "2019-11-25T00:26:28Z")

</div>

Hi guys,  
I am very new to three.js and also to Javascript.

**What I am trying to do?**  
I am actually loading a 3d text with TextBufferGeometry and it works fine. But, I want to fill that geometry with points, probably using points material. I think the points material only gets applied to vertices. So, when I create a mesh using TextBufferGeometry and Points Material, I only see points on vertices. But I want to fill the whole geometry with points.

I came across some jsfiddles where somebody was using GeometryUtils.randomPointsInGeometry(). I am unable to use that function, probably it is not being bundled or something. As I said I am very new to this.

If somebody could please tell me how to import or use that function, that would be really appreciated. If what I am trying to achieve is not possible in this way, please point me in the right direction. Let me know if you need more clarification.

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [November 25, 2019, 1:14am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/2 "2019-11-25T01:14:32Z")

</div>

`GeometryUtils` is not in the core. You can find this function here:

> <https://github.com/mrdoob/three.js/blob/92db041e370f241f59aa1ea351b139cc0be997f4/examples/jsm/utils/GeometryUtils.js#L192>

You need to include this file seperately. Assuming two things:

1. You are using `BufferGeometry`
2. You are using the module version of the core from `build/three.module.js`

If you are using the older non-modular `build/three.js` then [the function is here](https://github.com/mrdoob/three.js/blob/92db041e370f241f59aa1ea351b139cc0be997f4/examples/js/utils/GeometryUtils.js#L187).

@Mugen87 I expected to find this function in `BufferGeometryUtils` rather than `GeometryUtils`. Do you know why it’s not in that file?

---

<div class="post-metadata">

**Author:** ![kashish-jain](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kashish-jain](https://discourse.threejs.org/u/kashish-jain)\
**Post date:** [November 25, 2019, 1:21am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/3 "2019-11-25T01:21:57Z")

</div>

Thanks for your reply.  
I am not using module version. I am doing "import \* as THREE from “three” " in my project. I am still not sure how can I import and use this function.

---

<div class="post-metadata">

**Author:** ![looeee](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/looeee/32/59_2.png) [@looeee](https://discourse.threejs.org/u/looeee)\
**Post date:** [November 25, 2019, 1:24am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/4 "2019-11-25T01:24:42Z")

</div>

> [@kashish-jain](#):
>
> I am doing "import \* as THREE from “three” " in my project

This means that you _are_ using the module version. `import/export` are the JavaScript modules keywords.

Here’s how to import `GeometryUtils`:

```js
import { GeometryUtils } from 'three.js/examples/jsm/utils/GeometryUtils.js'

```

---

<div class="post-metadata">

**Author:** ![kashish-jain](https://avatars.discourse-cdn.com/v4/letter/k/54ee81/32.png) [@kashish-jain](https://discourse.threejs.org/u/kashish-jain)\
**Post date:** [November 25, 2019, 1:28am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/5 "2019-11-25T01:28:14Z")

</div>

Appreciate that. It worked. I was trying to import it from three/examples/js and not from three/examples/jsm.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [November 25, 2019, 6:49am UTC](https://discourse.threejs.org/t/fill-geometry-with-points/11020/6 "2019-11-25T06:49:47Z")

</div>

@kashish-jain Just in case, if you need more ideas: [How fill a loaded STL mesh ( NOT SIMPLE SHAPES LIKE CUBE ETC) with random particles and animate with this geometry bound in three.js](https://discourse.threejs.org/t/how-fill-a-loaded-stl-mesh-not-simple-shapes-like-cube-etc-with-random-particles-and-animate-with-this-geometry-bound-in-three-js/4702/6)
