About root uv of abc groom

Hello
This may not be the story to discuss here,
but is there a way to use blender to set root uvs in the groom?
Or is there such a function in UE4 alone?

I spent all day doing this, but nothing progressed.
I found a tutorial like this,

XGen Guidelines for Hair Creation | Unreal Engine Documentation

but it looks like a technique that can only be used in MAYA.
Can you share any trivial information to do the same thing in blender?
thank you.

2 Likes

I’m trying to find the same. The Maya script is assigning UV data to each strand based on a given geometry (calculated by proximity) and then including that data as a custom attribute named groom_root_uv in the Alembic file. This attribute then can be retrieved in the material in UE. Probably a script needs to be made in Blender to achieve the same.

1 Like

I’ve been trying to find something similar, but no luck. Commenting to bump the thread, and admiting that I don’t know enough to script it myself. I founded this thread https://developer.blender.org/T83838

3 Likes

Right now this post addresses the situation quite well Adding uv data to alembic on export - #2 by flowb - Other Development Topics - Blender Developer Talk

1 Like

The issue is quite complex, and ultimately boils down to the blender alembic exporter needing to be more configurable to play nicely with other tools (see links above). This is because different tools use different custom geometry parameter names and formats.

Interestingly it looks like Alembic OCurves has native support for UV data - Blender does actually export this. Consequently it might be possible to uplift the UE5 groom importer with out-of-the-box root uv support from blender. I’ll have a look at this some time this week. See: alembic/OCurves.h at master · alembic/alembic · GitHub

If you want a temporary workaround for a sane workflow I’ve patched support for UE5’s groom_root_uv param into a fork of blender: GitHub - Callum17/blender at feature/alembic_improvements_for_ue5_groom

Not yet decided if I care enough to look at adding support for guide hairs. Having access to per hair UVs should be sufficient for most use cases.

You will have to build blender as per norm:
https://wiki.blender.org/wiki/Building_Blender/Windows

If people are interested, the full set of custom geometry parameters UE5 takes (but blender does not support) are listed bottom of page:

Don’t know if this helps… but after watching the tutorial on youtube about this (UE4 - Hair Color with Blender - Unreal Engine Groom Color 4.26 - YouTube), I asked this exact thing and the creator (Marvel Master, amazing ue5 tuts btw) said that recently, an addon to blender was created to export root uvs and groups in gumroad.
Hope this helps, cause if anyone manages to find this add-on, please link it!! I cannot find it anywhere :frowning:

Quick search turned this up:

I made the blender addon; I expect it’s useful for you, I will maintain the addon until Blender has native alembic attribute export. Some patches are on revision.

1 Like

I was having a play with your plugin yesterday - really appreciate the effort you’ve put into it (and it has prompted me to properly learn blender’s new curve entity / geometry node system - something I have been putting off :smiley:). It makes exporting the hair attribute data to UE5 extremely easy.

However I was running into an issue where the groom origin was incorrect once exported to UE5, and hence would fail to bind to the skeletal mesh asset. Looks like the blender surface mesh’s origin is not being taken into account by the plugin?

The state of interoperability between blender’s existing alembic exporter and unreal is not great: I’m not hopeful of seeing meaningful progress anytime soon given the amount of work that is needed to rewrite pretty much all of the C++ custom attribute logic, and add new UI features.

I got it! Rly helpful. Thnk u very much!
Is there anyway to export color maps with the add-on as well? I’m having a bit of trouble getting my Substance maps to match inside UE5, since I painted fur rather than hair, and the color need to match the UV coordinates. Is there a way the add-on can help with that?

A little ashamed to admit I have no idea how to work the fork blender file you posted. Guess I’m just too n00b still for it.
Did you ever found a solution for the alembic root problem?

Sorry to hear you have an issue.
I want more information about the issue, to replicate on my side if possible and correct.
The curve has an origin but I take the origin of the surface and apply a difference to the locations.
surface_origin

The addon only exports geometry and attributes assigned to the data, you can have a color per vertex on the hair, and unreal can use it.
(On geometry nodes you can apply data from a texture on the geometry.)

Maybe I am confused but I understand you want to use a texture color on the length of the hair.
(This case is completely unique to the artist, doable but you need to understand the hair Material Attributes.)

If it’s a color from the UV, the addon doesn’t have any problem if the hair has been assigned to that specific surface UV.

Having the same problem while trying to use the ‘Root UV’ input on a hair attributes node on the hair material in unreal. I’m honestly not sure if this is the correct setup, but I imagine it is. The idea is to drive the hair color from sampling the texture at the hair Root UV location.

In Blender a similar setup looks fine:

When I import the alembic file into unreal it does say that the file ‘Has Root UV’
But with the material setup from the first image, the hair color does not render as expected.

Got to the bottom of the origin problem.

It’s a result of a difference between origins in the FBX exporter, and your groom exporter. The FBX exporter uses the world co-ordinates, but the groom-exporter uses co-ordinates relative to the origin of your armature (i.e. your root bone).

If you setup your root bone correctly (i.e. starting on the world origin), this shouldn’t be an issue.

@CoolSmek I also managed to reproduce this issue with the groom_root_uvs. The surface_coordinate_data looked fine in blender, and UE5 seemed to find them on import. But the UV data itself is either corrupted or zeroed within UE5.

import_attr

UVs don’t looked right if viewed directly in the UE5 groom editor.

The color attribute seems to come through fine though.
e.g.
This is where I baked the color attribute in blender (via geometry nodes) to achieve the same effect.

For reference - this was in UE 5.1.0
As a sanity check I loaded the groom mesh into 4.27.2 - same issue with the root UVs.

I found and fixed the issue, ironically my version of unreal 5.1 was refusing to render all the groom assets.

Was the name of a single variable, it’s solved now.
Probably was made on the last minor version, because was working before that.

Later I see a problem I don’t remember exactly but Unreal and Blender have different UVs coordinates and made a custom parameter to activate an auto-correction on the coordinates on the export.

The fix will be on Gumroad today.

Pd: Thank you for the clear data captures, made my work easier.

Clarification on the UV coordinates.
It’s the expected behavior of Blender,


Here I exported the ue4 logo from unreal to Blender, the object UV coordinates are “rotated”.

The settings selected to export.

The imported Groom Asset on Unreal has the same UV direction.
[My initial assumption was to solve the rotation, but the groom asset needs to have the exact UV of the mesh to apply a correct bind, for that doesn’t need a “correction”]

Thank you for the update! That has solved the root uv issue, I can now swap base color textures on instanced materials to get different hair color patterns! Very awesome!!

2 Likes

@turbocheke 0.13 fixed root_uv issues for me too.

1 Like

Have no idea how you guys are getting to this. Does any good soul could record a step by step how to do this?

1 Like