# Coloring a face in buffer geometry

**URL:** <https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567>\
**Category:** Questions\
**Tags:** buffergeometry\
**Created:** [March 17, 2020, 11:45am UTC](https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567 "2020-03-17T11:45:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashs](https://avatars.discourse-cdn.com/v4/letter/y/e495f1/32.png) [@yashs](https://discourse.threejs.org/u/yashs)\
**Post date:** [March 17, 2020, 11:45am UTC](https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567/1 "2020-03-17T11:45:23Z")

</div>

If I have created say a rectangular Pyramid not using cone geometry, but using buffer geometry and co-ordinates, how do i color it?

---

<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:** [March 17, 2020, 12:07pm UTC](https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567/2 "2020-03-17T12:07:53Z")

</div>

There are multiple examples which demonstrate how to add vertex colors to an instance of `BufferGeometry`. For example [webgl\_buffergeometry](https://threejs.org/examples/webgl_buffergeometry) or [webgl\_geometry\_colors](https://threejs.org/examples/webgl_geometry_colors).

I suggest you study the related code first. If you stuck, please your current work of progress as an editable live example.

---

<div class="post-metadata">

**Author:** ![hofk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hofk/32/44944_2.png) [@hofk](https://discourse.threejs.org/u/hofk)\
**Post date:** [March 17, 2020, 4:44pm UTC](https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567/3 "2020-03-17T16:44:30Z")

</div>

> [@yashs](#):
>
> how do i color it?

Take a look at the [Collection of examples from discourse.threejs.org](https://discourse.threejs.org/t/collection-of-examples-from-discourse-threejs-org/4315)

for instance

[https://hofk.de/main/discourse.threejs/2017/index2017.html](https://hofk.de/main/discourse.threejs/2017/index2017.html)

[https://hofk.de/main/discourse.threejs/2017/BufferGeometry/BufferGeometry.html](https://hofk.de/main/discourse.threejs/2017/BufferGeometry/BufferGeometry.html)  
[https://hofk.de/main/discourse.threejs/2017/Indexed%20BufferGeometry/Indexed%20BufferGeometry.html](https://hofk.de/main/discourse.threejs/2017/Indexed%20BufferGeometry/Indexed%20BufferGeometry.html)

* * *

[https://hofk.de/main/discourse.threejs/2018/index2018.html](https://hofk.de/main/discourse.threejs/2018/index2018.html)

[https://hofk.de/main/discourse.threejs/2018/BufferWithNormals/BufferWithNormals.html](https://hofk.de/main/discourse.threejs/2018/BufferWithNormals/BufferWithNormals.html)

* * *

[https://hofk.de/main/discourse.threejs/2019/index2019.html](https://hofk.de/main/discourse.threejs/2019/index2019.html)

[https://hofk.de/main/discourse.threejs/2019/ColorStripeChanging/ColorStripeChanging.html](https://hofk.de/main/discourse.threejs/2019/ColorStripeChanging/ColorStripeChanging.html)

Note!  
**.addAttribute** now is **.setAttribute**

---

<div class="post-metadata">

**Author:** ![yashs](https://avatars.discourse-cdn.com/v4/letter/y/e495f1/32.png) [@yashs](https://discourse.threejs.org/u/yashs)\
**Post date:** [March 17, 2020, 5:33pm UTC](https://discourse.threejs.org/t/coloring-a-face-in-buffer-geometry/13567/4 "2020-03-17T17:33:21Z")

</div>

I got my solution, Thank you.
