I figured out how to make a vector based direction map using Paint shop Pro's picture tubes a few years ago and realized I needed to get around to sharing it. So here you go, free to use. *edit* now with example video thanks to Kurt Russel Fan Club making a modded Xoliul shader.
This is really cool. We have a program at work that you just load your diffuse map into and it will analyze the directionality of the stokes and generate a vector map. Unfortunately it doesn't work on complicated styles with a lot of overlap, like braids. But, it works great for stuff like your example and hair planes. I will have to give this a shot. Is there no way to archive a similar effect in photoshop? I don't know much about the brush system.
This is really cool. We have a program at work that you just load your diffuse map into and it will analyze the directionality of the stokes and generate a vector map. Unfortunately it doesn't work on complicated styles with a lot of overlap, like braids. But, it works great for stuff like your example and hair planes. I will have to give this a shot. Is there no way to archive a similar effect in photoshop? I don't know much about the brush system.
Well, when I put this together 4 years ago, Photoshop had no equivalent of picture tubes, I'm pretty sure it still doesn't, but would love to be surprised. PsP is cheap enough that if a studio were to take up this technique you'd just get one license, and it takes maybe 10 minutes to make a comb map, so someone could just bang them all out really quickly.
Well, when I put this together 4 years ago, Photoshop had no equivalent of picture tubes, I'm pretty sure it still doesn't, but would love to be surprised. PsP is cheap enough that if a studio were to take up this technique you'd just get one license, and it takes maybe 10 minutes to make a comb map, so someone could just bang them all out really quickly.
hmm, i am wondering if you can modulate color based on stroke direction? doesn't seem like too hard of thing to accomplish. i know psp is cheap i just like streamlining my workflow between as few programs as possible. i do most of my texture work now in mudbox, i will dig into the brush settings today and see what i can do. thanks for this tip tho, i wanted to blow my brains out with a character recently whose entire hair style was braided braids, tied together with braids.
The only thing in Photoshop is to set the Foreground/Background jitter to be affected by Rotation (under Color Dynamics). But I don't think that would be too helpful.
It's kinda sad that we're in the year 2012 and we still have to 'wing' it when it comes to Directional Maps, when a simple 'flow' direction based upon gravity would do wonders just to fake it.
But yeah, awesome tutorial, and no, the shader wouldn't be too difficult to translate at all, although it would take some time.
Excuse my lack of knowledge. But what is a comb map and what is it used for. First time ever hearing about these things. Looks super cool though lol whatever it is
This is really awesome Poop, I tried for a few hours a while back to make a program to generate flow but ran out of time for the project and just fluffed in a bad solution. This looks better than both my ideas.
Here's a shader mod for Xoliul that lets you use anisotropic specular. Under spec, select "Anisotropic" and then beneath the Normal Map area there's some new values to enter your Tangent map (the flow map). Here's how it looks with your flow map and a simple desat for the spec map:
Edit: It almost certainly won't work with the new shader interface so I'd keep it separate from your default shader and just use it manually when you need to.
Excuse my lack of knowledge. But what is a comb map and what is it used for. First time ever hearing about these things. Looks super cool though lol whatever it is
I'll answer this later today with an illustration as several people have been confused on this.
This is really awesome Poop, I tried for a few hours a while back to make a program to generate flow but ran out of time for the project and just fluffed in a bad solution. This looks better than both my ideas.
Here's a shader mod for Xoliul that lets you use anisotropic specular. Under spec, select "Anisotropic" and then beneath the Normal Map area there's some new values to enter your Tangent map (the flow map). Here's how it looks with your flow map and a simple desat for the spec map:
Edit: It almost certainly won't work with the new shader interface so I'd keep it separate from your default shader and just use it manually when you need to.
That's awesome, but I can't seem to get it to work. Check this screenshot. With anisotropic unchecked, specular is in the right position for a blinn/phong type. When I tick anisotropic (with the comb map in the tangent slot) it turns into a fresnel type look. What am I doing wrong? I tried all combinations of flip green/red under tangent as well. Even before entering any maps, if I toggle "anisotropic" it will flip from a phong type correct specular hotspot to this fresnel ish specular.
Too right, sorry about that -- I didn't do a quick check from scrach. There's a bug in there where if you don't have a normal map set then the tangents aren't corrected so you get those rubbish normals.
Here's an updated version. Just make sure that also once you assign your tangent map you click that "tangent map" checkbox. All other settings should be okay this time.
Excuse my lack of knowledge. But what is a comb map and what is it used for. First time ever hearing about these things. Looks super cool though lol whatever it is
To simply further, let's look at a braid. This is a photograph, a braid texture would never have such strong highlights painted in, but it shows clearly how the anisotropy flows in different directions based on the hair orientation. Imagine this is your diffuse texture.
Now let's pretent this photo is a texture, and we have assigned the 3d model an anistropic shader with only a single global value. The green arrow represents the angle I chose. The highlights look great on the hair chunks going from upper left to lower right, but are completely wrong on the chunks going from upper right to lower left. If we rotated the direction to make it fit for them, the first chunks would break. In this example we have no comb map, simply a normal anisotropic shader with a global numerical input value in the form of an angle (0-360).
But with a comb map, we can use a different orientation value per-pixel! This will allow for the anisotropy to correctly follow the diffuse and normal map directions. In the same way a shader reads the value of a normal map pixel to determine what angle it should light the object, a shader that uses a comb map to control anisotropy will read the angle from the pixel in the comb map to determine anisotropy angle. This would be what your comb map would look like, the values correspond to the "direction" the hair is flowing. The shader can read this and correctly orient the anisotropic highlight.
Too right, sorry about that -- I didn't do a quick check from scrach. There's a bug in there where if you don't have a normal map set then the tangents aren't corrected so you get those rubbish normals.
Here's an updated version. Just make sure that also once you assign your tangent map you click that "tangent map" checkbox. All other settings should be okay this time.
Awesome, got it to work. Just made a quick video showing with and without on the actual Delilah model. Uploading now. This is great, exactly what I was looking for! Thanks so much dude. Do you mind if I host this shader file and link to it within the tutorial page?
this really just looks like a blurred and then roughed out object space normal map to me
It contains angle information the same way a normal map does yes. The point is how to make it in a human way. There isn't a way to get a comb map from baking a tangent space normal map off a high poly, if that's what you were thinking.
hi guys,
here's a quick aniso shader with tangent map - thanks for the xoliul version - using the whole tangent map in the same way as TS normal map was simpler for me to get than the approach I had taken from "Scheuermann_HairRendering.pdf"
I guess I was too late to really help much, but I will add the secondary specular highlight after Scheuermann and see how it looks in the next days. You can put a channel in the alpha of spec map which allows to shift the spec a bit up and down the surface. It might be hard to do this in the tangent map when authoring - again it is ust ripped from Scheuermann so I claim no credit, just exploring the area.
I've pondered this authoring quagmire a few times over the last 12 months at work, and my plan is thus:
1) create hair on a reference model based off asset but posibly higher poly count
2) comb, style, coiffure etc.
3) run script, (as yet not created) which could:
a) snapshot splines from hair
b) matchup spline knots and poly verts from styling cage
c) project spline onto tangent space of vert to get a relative direction of strand per vert
d) store this info somehow (texture, vertex colour, something)
e) post process into something usable.
It might just work? any other ideas I'm willing to have a pop!
This is awesome Poop thanks! I'm going to have to give it a try in one of my future girls!
You need to use it on your Hikune character, especially once Maph gets this shader working , as the double specular will really help sell her blue hair.
When I was at 8ml we had a little app that let you "comb" directly on a model in 3d, and it would spit out a direction map. Unfortunately the source was lost and the app stopped working due to code rot. Hopefully someday it will get re-integrated into marmoset.
You guys should try loading these into toolbag, the content looks pretty similar to what our app spit out and I believe the anisotropic shader still supports these direction maps.
I was actually thinking about that. I think I saw a horse comb map from you at one point which is what got me thinking on how to make one of these with off the shelf software.
This is great, In gears3 we just limited the anisotropic direction to the V direction in UV space and just oriented our planes accordingly but being able to paint it would be really nice!
The -only- problem I see with a 2d solution is seams, painting anything in tangent space gets hairy on seams.
This is great, In gears3 we just limited the anisotropic direction to the V direction in UV space and just oriented our planes accordingly but being able to paint it would be really nice!
The -only- problem I see with a 2d solution is seams, painting anything in tangent space gets hairy on seams.
I wonder if there is a "paint on the model" way this could be done so you paint over seams?
I guess one work around would be to plot seams along the natural hair grain, which most people probably already do? It wouldn't be as good as painting over seams on the model but it would help disguise the discrepancies.
It's not exactly tangent space, so you can actually paint it seamless. The comb map follows the hair's visual direction, so you won't have a color change across the seam like a true tangent map. Shouldn't be a problem unless the shader is poor.
I was actually thinking about that. I think I saw a horse comb map from you at one point which is what got me thinking on how to make one of these with off the shelf software.
How would one go about loading this into toolbag?
Yep that was the one, funnily enough it was the only asset that was made with the tool and made it in game.
If you open toolbag, you can assign a anisotropic shader from the shader dropdown, which should give you the option to load a direction map, sorry don't have it installed here so I can't be more specific, you should figure it out though.
this is some cool stuff Ben, did you come up with this on your own, or is this some sort of realtime adaptation of a method used for pre-rendered work?
I'm not sure I follow with the two highlights thing. What's the secondary streak for? Is it to simulate the hair's subsurface scattering?
Yes, you'll notice in most photos of hair, the highlight also has a surrounding bit that is closer to the hair's actual color but a bit more saturated. Sells the "hair-ness" of it.
this is some cool stuff Ben, did you come up with this on your own, or is this some sort of realtime adaptation of a method used for pre-rendered work?
Coming up with the picture tube to create a comb map to control anisotropy direction was all me, but I was pretty sure someone, somewhere was also using a per pixel map, most likely generated with proprietary in house tools, and I wanted something off the shelf.
Yeah there are a variety of shaders that use a direction map for aniso I'm sure, but a good workflow for creating it, especially outside of weird proprietary apps is in dire need.
Replies
Well, when I put this together 4 years ago, Photoshop had no equivalent of picture tubes, I'm pretty sure it still doesn't, but would love to be surprised. PsP is cheap enough that if a studio were to take up this technique you'd just get one license, and it takes maybe 10 minutes to make a comb map, so someone could just bang them all out really quickly.
http://www.unifycommunity.com/wiki/index.php?title=Anisotropic_Highlight_Shader
hmm, i am wondering if you can modulate color based on stroke direction? doesn't seem like too hard of thing to accomplish. i know psp is cheap i just like streamlining my workflow between as few programs as possible. i do most of my texture work now in mudbox, i will dig into the brush settings today and see what i can do. thanks for this tip tho, i wanted to blow my brains out with a character recently whose entire hair style was braided braids, tied together with braids.
I do have unity, but not pro. Any chance this can be ported to max?
But yeah, awesome tutorial, and no, the shader wouldn't be too difficult to translate at all, although it would take some time.
Here's a shader mod for Xoliul that lets you use anisotropic specular. Under spec, select "Anisotropic" and then beneath the Normal Map area there's some new values to enter your Tangent map (the flow map). Here's how it looks with your flow map and a simple desat for the spec map:
Edit: It almost certainly won't work with the new shader interface so I'd keep it separate from your default shader and just use it manually when you need to.
Edit 2: Updated shader so it's much better
I'll answer this later today with an illustration as several people have been confused on this.
That's awesome, but I can't seem to get it to work. Check this screenshot. With anisotropic unchecked, specular is in the right position for a blinn/phong type. When I tick anisotropic (with the comb map in the tangent slot) it turns into a fresnel type look. What am I doing wrong? I tried all combinations of flip green/red under tangent as well. Even before entering any maps, if I toggle "anisotropic" it will flip from a phong type correct specular hotspot to this fresnel ish specular.
Here's an updated version. Just make sure that also once you assign your tangent map you click that "tangent map" checkbox. All other settings should be okay this time.
Updated the original tutorial to explain better: http://www.poopinmymouth.com/process/hair_tutorial/ng_hair.html
To simply further, let's look at a braid. This is a photograph, a braid texture would never have such strong highlights painted in, but it shows clearly how the anisotropy flows in different directions based on the hair orientation. Imagine this is your diffuse texture.
Now let's pretent this photo is a texture, and we have assigned the 3d model an anistropic shader with only a single global value. The green arrow represents the angle I chose. The highlights look great on the hair chunks going from upper left to lower right, but are completely wrong on the chunks going from upper right to lower left. If we rotated the direction to make it fit for them, the first chunks would break. In this example we have no comb map, simply a normal anisotropic shader with a global numerical input value in the form of an angle (0-360).
But with a comb map, we can use a different orientation value per-pixel! This will allow for the anisotropy to correctly follow the diffuse and normal map directions. In the same way a shader reads the value of a normal map pixel to determine what angle it should light the object, a shader that uses a comb map to control anisotropy will read the angle from the pixel in the comb map to determine anisotropy angle. This would be what your comb map would look like, the values correspond to the "direction" the hair is flowing. The shader can read this and correctly orient the anisotropic highlight.
Awesome, got it to work. Just made a quick video showing with and without on the actual Delilah model. Uploading now. This is great, exactly what I was looking for! Thanks so much dude. Do you mind if I host this shader file and link to it within the tutorial page?
No problem - I don't mind if you host it at all, but because it's basically the Xoliul shader I'd ask Laurens first.
[ame=http://www.youtube.com/watch?v=YBR--OTtBD4&hd=1]"anisotropic comb map example"[/ame]
!
It contains angle information the same way a normal map does yes. The point is how to make it in a human way. There isn't a way to get a comb map from baking a tangent space normal map off a high poly, if that's what you were thinking.
I added a new wiki page with this and some more stuff.
http://wiki.polycount.com/FlowMap
here's a quick aniso shader with tangent map - thanks for the xoliul version - using the whole tangent map in the same way as TS normal map was simpler for me to get than the approach I had taken from "Scheuermann_HairRendering.pdf"
here's the link http://dl.dropbox.com/u/5440025/aniso.fx
I guess I was too late to really help much, but I will add the secondary specular highlight after Scheuermann and see how it looks in the next days. You can put a channel in the alpha of spec map which allows to shift the spec a bit up and down the surface. It might be hard to do this in the tangent map when authoring - again it is ust ripped from Scheuermann so I claim no credit, just exploring the area.
I've pondered this authoring quagmire a few times over the last 12 months at work, and my plan is thus:
1) create hair on a reference model based off asset but posibly higher poly count
2) comb, style, coiffure etc.
3) run script, (as yet not created) which could:
a) snapshot splines from hair
b) matchup spline knots and poly verts from styling cage
c) project spline onto tangent space of vert to get a relative direction of strand per vert
d) store this info somehow (texture, vertex colour, something)
e) post process into something usable.
It might just work? any other ideas I'm willing to have a pop!
http://www.polycount.com/forum/showthread.php?p=1582749#post1582749
Thanks for the inspiration, poop!
[ame="http://www.youtube.com/watch?v=K7sEFQvzP8M"]Hair Shader WIP - YouTube[/ame]
You need to use it on your Hikune character, especially once Maph gets this shader working , as the double specular will really help sell her blue hair.
You guys should try loading these into toolbag, the content looks pretty similar to what our app spit out and I believe the anisotropic shader still supports these direction maps.
How would one go about loading this into toolbag?
The -only- problem I see with a 2d solution is seams, painting anything in tangent space gets hairy on seams.
Here try it out:
http://dl.dropbox.com/u/2336353/AnisoComp_Anim.mov
I guess one work around would be to plot seams along the natural hair grain, which most people probably already do? It wouldn't be as good as painting over seams on the model but it would help disguise the discrepancies.
Yep that was the one, funnily enough it was the only asset that was made with the tool and made it in game.
If you open toolbag, you can assign a anisotropic shader from the shader dropdown, which should give you the option to load a direction map, sorry don't have it installed here so I can't be more specific, you should figure it out though.
Yes, you'll notice in most photos of hair, the highlight also has a surrounding bit that is closer to the hair's actual color but a bit more saturated. Sells the "hair-ness" of it.
Coming up with the picture tube to create a comb map to control anisotropy direction was all me, but I was pretty sure someone, somewhere was also using a per pixel map, most likely generated with proprietary in house tools, and I wanted something off the shelf.
This looks great so far!