What would be a practicable way of generating huge numbers of realistically looking human faces? Randomizing 3D-models and rendering them would require a lot of computing power, especially as I'm needing them on an ad-hoc basis. Layering individual 2D-drawn parts requires some artistic talent, which I'm definitely lacking. Also, I'd like to parameterize as many aspects of the generational process as possible. Do you have any suggestions how to go about this?
This can certainly be done - Skyrim is a good example of a game that uses procedurally generated 3D faces. Basically they take a set of standard face models and describe different geometry morphs / colour changes that can be applied in different quantities to make all kinds of different combinations.
If you are just after simple 2D faces though, I think the layering approach would work best - hire an artist to draw lots of different face features, then combine them in different combinations to create lots of different random faces. Small random offsets to each of the components will also help create some extra variety.
Links that might also be fun:
- http://www.morphases.com/editor/ (photo-based face generator)
Steven's answer is a good one. Human brains are very well-versed in making fine judgements of faces, their construction as well as their facial gestures.
However, I want to pose a corollary question towards your idea. What is the state of facial recognition software? Can it reliably tell a human face from a CG one?
I'm curious as to the usefulness of hooking the output from a facial generator with a facial recognizer, with the goal of grading the humanness of the faces. Once you have a system that can produce faces and recognize the good, the bad and the ugly, is it not conceivable that the generated faces could improve over time?
I expect the implementation of this all would be challenging and complex. But I would love to see the results.
Mix existing photos of human faces into new ones.
There are millions of existing photos of faces available to you online. The approach I would take is to use well known feature-detection algorithms and blend together the features from different faces algorithmically.
This would give you the randomness and the realism.
In more details, I would create a processing pipeline for human faces, which would:
- Detect different features (eyes, mouth, ears, forehead, chin, jaw, cheekbone, etc...)
- Using the detected feature's locations, split the images into components.
- Randomise the parameters of a positional and size template.
- Place randomly selected components onto the generated template.
- Blend the features into one another. (edge smoothing, tone, color, etc...)
Some quickly found resources:
You'll also need to get a database of faces, which might come with some licensing issues, or gather them yourself from the web, which will be time consuming.
Be warned that this kind of problem is effectively active research. I don't even want to know how long it took the Skyrim folks to get their face generation system working. (And they had decades of experience since the days on Morrowind...)