Coloring a face in buffer geometry

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

There are multiple examples which demonstrate how to add vertex colors to an instance of BufferGeometry. For example webgl_buffergeometry or 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.

1 Like

Take a look at the Collection of examples from discourse.threejs.org

for instance

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/Indexed%20BufferGeometry/Indexed%20BufferGeometry.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/2019/index2019.html

https://hofk.de/main/discourse.threejs/2019/ColorStripeChanging/ColorStripeChanging.html

Note!
.addAttribute now is .setAttribute

I got my solution, Thank you.