View Full Version : Aligning Pores and Hairs?

04 April 2003, 06:48 AM
Ok, in real life hairs usually come out of pores or indentations in the skin. I know some ways to render hairs, and some ways to render pores, but how do you align them?

Years ago, I once modeled a hippo that had all its hairs as polygon models, with pores in the skin attached to each one - but I hope that I can move beyond modeling each hair as a polygonal object.


04 April 2003, 07:33 AM
Hey Jeremy,

How dense are you talking with these pores/hairs? You could always use a really high-rez map to make displacments for the individual pores, and then use that same map to control the fur baldness.

....but I guess that wouldn't work if the density of the hairs was different in different areas of the surface, unless you also paint the densities wherever you accidentally got more than one hair per pore...

Is this for a polygon or a NURBS object? From my experience, fur is almost useless with polygons.


04 April 2003, 08:57 AM
If you don't mind getting down and dirty with some C, I think I know a way you could get it to work.

Assuming you're using displacement mapping to make the pores on a NURBS surface, make another image that is pure white and put a single pure black pixel everywhere you want a hair to appear. Save it out as a 32-bit TGA.

Then do something like the following in a C program:

#include "TGAimage.h"
#include <iostream>
#include <string.h>

using namespace std;

int main(int argc, char** argv)
char* iFilename = argv[1];
char* oFilename = strcat("hairCoords_", iFilename);

Image poreImage(iFilename);

//freopen(stdout, oFilename, "w")

GLubyte* pixel = poreImage.getImageData();

for (unsigned y = 0; y < poreImage.height(); y++)
for (unsigned x = 0; x < poreImage.width(); x++)
int score = 0;
score += pixel[((y*poreImage.width())+x)*poreImage.Bpp()];
score += pixel[((y*poreImage.width())+x)*poreImage.Bpp()+1];
score += pixel[((y*poreImage.width())+x)*poreImage.Bpp()+2];

if (!score)
double u = (double)x / (double)poreImage.width();
double v = (double)y / (double)poreImage.height();

cout << u << " " << v << endl << flush;


return 1;


Given a tga file as the first argument, this program will output the UV coords of all the black pixels to the terminal window. Uncomment the //freopen... line to output to a file.

You can then load those UV coords in with MEL quite easily and use them to drive a MEL command which you can use to get the world space position of a NURBS surface given UV coords (can't remember the name of any commands now but I know there's more than one).

If you're using poly's you can still do it but it's harder as you'll have to find the UV coords for each face and then interpolate them to get the right position on that face.

Given your world-space position, just use an expression to control a locator, then parent some instanced geometry or an RiCurve to it.

The code above should (unless there's some syntax errors there) compile and run, given my TGAimage class, which I can e-mail to you if you drop me an e-mail first.

Hope this helps!:)

04 April 2003, 09:10 AM
What if you created a map of the pores in 3d paint, or used the bump map, thats generating the pores to drive particle emmision. Have one particle emmit wherever you have a pore, then instance your hair geometry onto these particles with the Instancer.

04 April 2003, 09:40 PM

The problem of fur from a subD surface GreytheSkunk mentions is another I'm wrestling with, and is indeed slowing things down a bit.

I'm still doing tests on this, with different approaches. Because hair position is randomized, even withing a very small dot in a baldness map, I'm leaning towards working backwards: letting the hairs fall where they may on the surface, then making a very short version of the hairs and baking an occlusion map of their shadows to trigger the bump or displacement.


05 May 2003, 08:07 AM
aaaahhh! very clever.:)

05 May 2003, 05:54 PM
Well, I was imagining that the map would have enough resolution that the points on the baldness map would be as thin as or thinner than the actual hair. That way the randomness wouldn't have a noticeable effect....but on a big model that could mean some big-time maps, especially if we're talking about millions of hairs.

I've actually been working on a quasi-volumetric concept for hairs in Maya using a special polygon bounding object, but it still has a lot of work left on it. Unlike displacement and other volumetric approaches, this would be easily able to sculpt/comb/animate, and it would render in the Maya renderer or MR without any extra software.


05 May 2003, 06:44 PM
>>>I'm leaning towards working backwards: letting the hairs fall where they may on the surface, then making a very short version of the hairs and baking an occlusion map of their shadows to trigger the bump or displacement.

That sounds good.. but how will you use the occlusion map to trigger the bump and displacement? image processing?

05 May 2003, 10:54 PM
The baking the occlusion will give you dark patches around the base of the hairs: clean it up a bit and layer it on top of your skin texture displacement and boom! instant pores...

very clever...

CGTalk Moderation
01 January 2006, 01:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.