I am so close to figuring out how to render a sphere with vertex colors, but I'm stuck on the normalization process. My goal is to calculate normals for each vertex by averaging face normals and then convert them to HSL values. The lines below should do that.
sphere.geometry.computeFaceNormals();
sphere.geometry.computeVertexNormals();
After normalization, I need to pass the values as Hue, Saturation, and Lightness using...
myGeometry.color.setHSL();
The challenge lies in normalizing and converting the values to x, y, z coordinates for HSL usage. Any guidance on this would be greatly appreciated! Here's a snippet of the code I have been working on.
var sphereBaked = new THREE.MeshPhongMaterial();
sphere = new THREE.Mesh(new THREE.SphereGeometry( 150, 32, 32),sphereBaked);
sphere.geometry.computeFaceNormals();
sphere.geometry.computeVertexNormals();
//sphereBaked.color.setHSL();
sphere.position.set(0,150,0);
scene.add(sphere);