Face effects for calculating skin tone

Hi all, I’m working on an app in which we need to determine the skin tone (in RGB) of a person’s face. can we use 8thwall face effects for that?

Hi Himanshu! I believe it’s possible but it would be a fairly technical solution since we don’t have any out-of-the-box way to query the face pixels directly.

You can use our face morph sample project as a starting point, particularly the animate-face component, I grab the camera feed texture from our engine and map it onto a new material so that I can apply it to a 3D model of the user’s face. I can then manipulate the 3D model to make it look like you’re morphing the user’s actual face.

The camera feed fits well to the user’s face because I also apply our vertices, UVs, and normals to the material as well. I imagine you could approach getting the skin tone in 2 ways:

  1. Apply the camera feed to a 3D model of a face with appropriate vertices, UVs, and normals (like the sample project) and then query the rgb values of the 3D model.
  2. Write a shader that uses our UVs to mask out the camera feed so that only face pixels remain and then query those pixels.

Feel free to let me know if you have any questions!

1 Like