I am working on a visualization comprised of thin slices of irregular shapes with a different color for each (short) face.
I have tried lots of things including creating the whole thing manually but using THREE.ExtrudeBufferGeometry(..) with a THREE.Shape(..) created from the source data seems like the best bet.
I have two issues though:
1/ Despite using a material with flat shading off, the object is flat shaded. A THREE.CylinerBufferGeometry with the same number of divisions and material looks perfectly smooth.
2/ Is there an easy way to assign a color to each face? I’ve tried doing it manually with varying levels of success and hoping I’m missing a useful built-in function that will help me
Thank you @Mugen87 - sounds like there will be something official in an upcoming release. In the meantime, I’ll use your suggestions.
You can user vertex colors for this. I’ve create an additional color attribute in the following fiddle and added it to the geometry.
Experimenting with this a bit in a later rev of the fiddle: BufferGeometry from Path vertex colors - JSFiddle - Code Playground and I wasn’t able to figure out the logic for setting each quad (vs triangle) to the same color but I expect I can work it that out by looking at the source or inspecting the object.
I increased the number of divisions to simulate my eventual use case where I will have a couple of hundred “slices” and noticed a big slowdown in performance via the Stats() meter I added. That is to be expected I imagine so might rule out using that approach for me.
The colors I will eventually use are along a spectrum so I think I can avoid having to work out how to color each triangle for now since adjacent ones will be very similar - a bit like this https://jsfiddle.net/callum/o64v1cwx/65/