0
$\begingroup$

I created a bunch of hair in Blender and want to export them as hair card meshes for UE, but the cards themselves are not UV-unwrapped and the UVs are only affected by a mapping node in the material.

In Blender it works fine, but when I use the Object Info node on another object, reference the hair curve object, apply it, and then export it to UE, the hair texture does not map properly to the mesh.

These are the Geometry Nodes for the strands:

Geometry Nodes

And this is my shader:

Shader

What exactly can I do to fix this?

$\endgroup$
4
  • $\begingroup$ Hi and welcome! You can upload the images here on BSE and include them in your question so there is no extra link that can break and go offline. $\endgroup$
    – Blunder
    Oct 9, 2022 at 1:41
  • $\begingroup$ What does your hair card look like? Has it multiple strands? Why do you map (X, Z) to (U, V) and not (X, Y)? $\endgroup$
    – Blunder
    Oct 9, 2022 at 1:41
  • $\begingroup$ Nice trick to convert the hair curves into a mesh with a 2nd GN modifier and another object. To "bake" a UV map you need to combine the length and width attributes to a (UV) vector. When you have applied the 2nd GN modifier to the other object to convert the hair cards to a mesh you can go to the Object Data Properties panel > Attributes section and use there the drop-down menu to convert the UV map attribute to a true UV map. $\endgroup$
    – Blunder
    Oct 9, 2022 at 1:44
  • $\begingroup$ I really dont know about the xz or xy thing, i just copied everything i saw on a tutorial. I tried changing the mapping from xz to xy in the shader but it didnt do anything for the uv map. After i tried the conversion thing you suggested, i got a uv map that is just a bunch of points at this area of the uv map like in the picture. IRDK how i got this attribute even and where i can go to change it, if you could lmk that would be nice but yeah i dont know anything else that could be wrong. $\endgroup$
    – CurSe
    Oct 9, 2022 at 10:17

2 Answers 2

1
$\begingroup$

How To Create Hair Cards with Gemoetry Nodes

... and How To Convert a UV Map Calculated by Geometry Nodes To A Real UV Map

To make your example work you need to change two things:

  1. make the length and width attributes a vector attribute (my uv map) because only vectors can be converted into UV maps.
  2. convert the vector attribute into a UV after the hair cards have been converted to a mesh. And use the new UV map in the shader, of course.

1. Creating the Attribute "my uv map"

This is done quickly by combining the formerly length and width attributes to a vector with the Combine XYZ node. Set Z to 0. Then expose the vector via Geometry Nodes group output (or use a Store Named Attribute node.)

geometry nodes

In the Shader Editor you can use this vector attribute as a UV map. Here are the GN hair cards with a material: shader editor

2. Convert the GN Hair Cards For Export

2.1 Convert the Hair Cards to a Mesh

Converting the Geometry Nodes hair cards to a mesh is a bit weird in Blender 3.3 and might change in the future. Right now, the menu Object > Convert > Mesh does nothing. And when you try to apply the Geometry Nodes modifier of the hair curves object (Curves) you just get an error.

The workaround is

  • add a dummy object: A plane named Hair Cards to Export and place it where the head is (Suzanne)
  • add a Geometry Nodes modifier that just exports the geometry of the Curves object. Then apply this modifier and you have the mesh with the hair cards.

workaround

2.2 Create the UV Map

For Blender 3.5+ (quote from the documentation):

In order for Blender to recognize the created attribute as a UV map, it must be created with the Store Named Attribute Node on the Face Corner domain with the 2D Vector data type. This is necessary because there is no 2D Vector socket type.

See example here: How to convert UVMap attribute to UV map in blender 3.6


For previous versions (Blender 3.3 and 3.4):

Finally, convert the attribute my uv map into a UV map. This is done in the Object Data Properties panel. Select UV Map for Mode and press OK.

convert attribute to UV map


Last but not least, select the material and use the newly created UV map. Here is the material with the UV map:

material with uv map

Related question: Geometry Nodes, Hair, and UV Unwrap: How to make UV alpha cards along a strand for hair cards with multiple strand images.

$\endgroup$
0
$\begingroup$

Ok so basically I found an easy work-around, for the thing I wanted to do but im gonna post it anyway for anyone having the same problem as me.

Basically instead of having card shaped strands, I added the nodes in the picture which basically make the strand a spike shape.

Instead of using a spike like texture that will stretch throughout the entire strand, after making the hair into a mesh, I selected all the strands and UV unwrapped them > reset so all of the faces are scaled to bounds, and I used a square like strand texture that is just repeated over every face of the strand.

And because the strand gets smaller on the way down, it looks like actual hair and it can work in unreal just fine.

Thanks to blunder trying to help tho, I appreciate your time!

enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .