Hair UV and Material setup¶
Default Hair Material¶
Hair Tool comes with built-in hair shader named HT_Defautl_Material
. It was made to look best in real-time renderer EEVEE.
This default material is using single texture with:
- RGB channels holding depth pass
- alpha channel for opacity
In most cases it will be assigned automatically by add-on (when generating hair, adding profile etc), but you can also assign it manually with: Ctrl+Shift+H Pie Menu > Import Default Hair material. It will assign default UV data too.
demo of build in Hair Tool Default material
Note: If you want to plug in your own texture into Hair Material, make sure its UV input is connected to
HTool_UV
node. It will properly UV map your Hair Strands.
Attributes¶
Default material can use several attributes to change material look (or debug hair information):
Factor | Random | UVDebugCol
Require: Profile > Other > Generate Curve Attribute:
- Factor - black and white gradient.
- Random - Random B&W color assigned per strand.
- SampledUV - Sample UVs from source mesh. Requires: Requires 'Sampled UV' to be set. Example setup in here
- SampledCol - Sample Vertex Color from source mesh. Requires 'Sampled Color' to be set.
SampledUV | SampledColor | SystemColor
Require: Profile > Other > UV Debug Colors
- UVDebugCol - Visualize UV Boxes by colors. You can set uv box color using Hair UV operator.
Requires Color Set deformer
- SystemColor - Display SystemColor attribute.
Requires Generate AO modifier
- AO - Visualize generated hair AO attribute.
AO attribute
Hair System UV's¶
UV data holds information about: number and shapes of rectangular UV Boxes/Regions that describes where to sample the texture.
UV Data does not tell which UV Regions should be assigned to which hair strand - for that use UV Regions Distribute deformer (for procedural strands) or Set UV Regions operator (for 'real' strands).
In Hair Tool, UV Data is attached to Hair System Profile.
Compared to Blender mesh object, where each mesh holds its own UV map, Hair Tool UV Data can be shared (instanced) between multiple hair objects. This means you don't have to create the same UV map over and over again if you want to use it on multiple hair objects.
Note1: Do not use Blender's built-in 'Convert To Mesh' operator on curve hair, or your output mesh UVs will be messed up. Instead, use Curve ribbons to mesh ribbons. This way curve Material UVs will be properly, converted to mesh UVs.
Defining Hair UV's¶
Using Hair UV
button in UV image editor
To add/modify Hair System UVs:
- open UV Image Editor and press Hair UV button located in top header bar - on far right
- Left Click and drag to define UV rectangular shape, for texture mapping. Drag corners of existing UV box to adjust its shape.
- [G,S] - keys to move and scale uvs boxes. [Delete] - do delete UV Box, [ENTER] - save and finish
-
[Shift + Delete] To reset all UVs
-
Make sure Material is assigned in 'Profile' panel (or use Import Default Material)
- Material should contain
HTool_UV
node and be linked to your texture - without it UVs won't work (transparent hair). After converting Hair System to mesh, you can use 'normal' mesh uvs
If you are generating hair procedurally - make sure UV Region Distribute Deformer has been added
To use UV Offset
hover you mouse over UV box and scroll with MMB.
Material / UV Refresh¶
Helper Button that will automatically assign last used Hair Material, and UVs. If they are not found, it will assign Default Hair Tool Material and UVs.
Set UV region¶
After you generated UVs, you can assign individual UV Regions to 'real' hair strands using 'Set UV region' operator. If you selected multiple UV Regions (Shift+Click), then they will be distributed randomly to each selected strand.
- If you have hair curve object selected, that contains 'real' geometry strands, then UV Region ID will be stored directly in curve attribute
- If selected object (mesh or curve) has Hair System attached, then UV Region Distribute deformer will be created (unless one already exists) - to distribute UVs Boxes onto strands
Assigning UV regions to selected strands using Set UV Region
. [Shift+click] to assign multiple UV regions
Set Profile IDs¶
Note: This operator is not strictly linked to the hair material or UVs, but its purpose is similar to the set UV region operator
When using Mesh Profile or Multi Curve Profile you can tell which strand will receive which profile object with Set Profile IDs operator. It will assign 'Profile_ID' attribute to each strand and so it will then be meshed with matching profile object.
Assigning profile objects to selected strands using Set Profile IDs
. Shift click on multiple profile objects to assign them randomly
For procedurally generated hair strands, you can use Profile Distribute deformer to assign profile objects to hair strands.
Offset UV¶
It moves UV points more toward the root or tip on hair strand. As a result you can stretch UVs and change texture look. See video below:
Auto UV¶
If you have 'real' curve hair object with Hair Profile attached, then you can use Enable Auto UV
to automatically assign UV regions to hair strands - without having to use Set UV Region manually, each time add or remove hair curve.
Auto UV - will randomly assign selected UV Regions/materials to hair strands.
In this example we Created few UV Regions. They are automatically assigned to hair strands thanks to Enable Auto UV
feature
Enable Auto UV - is located in UV Image Editor -> Right side panel -> Hair Tool tab