I recently added a new importer to the TressFX project. This new importer can get used to import blender hair particles into TressFX Unity.
In this article i will explain how to create the hair particles in blender and import them into unity.
First, open up your blender (I’m using version 2.76).
Add a new particle system to any object in the scene (I’m using the cube that’s always added on a new scene).
Your scene should now look like this:
I will leave the hair now just as it is, since i’m not very familar with blender and it’s all we need in order to demonstrate the import workflow 😛
The next step is converting the hairs into an actual mesh we can export, in order to do so we need to add a modifier, which can be done at the modifier tab:
Press the “Convert” button to convert your particle system into a mesh. Now your scene should contain a new object:
Now, remove all unnecessary things from your scene (the light, camera and the cube) and export the hair mesh as Wavefront OBJ file:
Now, we are almost done.
In order to import this hair into unity now we need to customize the TressFX import settings a bit. To do so, open up the TressFX Window (Window > TressFX).
First, you need to tick normalize vertex count in order to normalize the hair strands to 16 vertices per strand (this is only needed in order to use simulation).
The follow hair max radius around guidance hairs is ways too high for this kind of hair aswell. It controls the radius around the hairs you import where additional hairs are added to make the hair more dense. I used 0.025 here:
Now right click in the project explorer, select “Create > TressFX > Hair from OBJ” and let unity import the obj file.
After that you are done importing the hair mesh into unity. Yay 🙂
Now, creating an example scene is pretty straightforward.
Create a new gameobject and add the TressFXRender and TressFXSimulation script to the gameobject.
Assign the “Shadow Shader” and “Hair Material” to the TressFXRender (The shader is located in Assets/TressFX/Shaders/TressFXShadow.shader, the material must use the shader “TressFX/Surface”).
Now, assign the “Simulation Shader” of the TressFXSimulation component and the “Hair Data” of the TressFX Behaviour.
Finally it should look like this:
The last step now is setting up the simulation parameters for the hair, click the hair asset and configure them as you like.
Here is my example config:
Press “Save”, and you’re done 🙂
If you hit the start button, it should get rendered like this now:
That’s it 🙂
Have a nice day!