GameDev LOD Hierarchy+Custom Collision for UE4

   8009   5   2
User Avatar
Member
18 posts
Joined: 9月 2017
Offline
Hello, my first post on the forums!

I've been trying out the LOD Hiearchy from the GameDev Toolset but I'm struggling to find out if its possible to export my lod group and a custom collision shape for UE4.

For custom collisions in UE4 I usually create a Geo node with the same name as my mesh with the “UCX_” prefix and make it as a child of said mesh, that way UE4 FBX importer reconizes the Geo as custom collision.

It would be neat to be able to export a lod group and a custom collision in one go, but I don't know where I should put that collision node and what name should it be after the prefix. There are several options based on how the LOD node was built but nothing that I tried seemed to work. Any ideas?

Attachments:
LODH.PNG (36.0 KB)

User Avatar
Member
18 posts
Joined: 9月 2017
Offline
Update.

I figured it out by reading an old thread about the FBX update. I solved by building my own LOD group chain with support for custom collision, something that I couldnt achieve with the standard LOD Hierarchy Group Node.

Attachments:
LODH.PNG (363.8 KB)
LODH1.png (581.9 KB)

User Avatar
Member
6 posts
Joined: 10月 2008
Offline
I thought to write my few cents here as a summary. It took me few hours to make all this work they way I wanted, I also never used Maya in gamedev context (and not much in any other context tbh) so I am writing it from purely Houdini mindset.

I wanted to export all LODs and Collisions in one click without additional python scripts. As FBX is all we have for the moment there are some not obvious rules that we need to follow in order it to work and Unreal is also quite shy in describing what is happening after import with out geometry.

  1. You need to put your geometries in OBJ context. I tried to simply put it into groups and smartly send it in SOP context and it does not work. There is this: option in ROP_FBX but I couldn't make it to work. So the easy way to go is to simply build hierarchy like this and object merge target geometries respectively.

  2. For collisions you need separate OBJ nodes which name with UCX_ prefix and then LOD0 or LOD1 etc.. (it actually will not assign different collisions to different LODs). This will be loaded as Simple Collision ONLY if this is a SINGLE convex shape. So if treat your geometry with Convex Decomposition node then you will probably have more then one convex shape. In that case you need to send each one to different OBJ node (like I did in the picture above(UCX_LOD0_01, UCX_LOD0_02, UCX_LOD0_03). If you build your own export tool you can have spare empty UCX_LOD0_xx and they will simply not get exported. Then in Unreal you will see all them loaded and counted Convex Decomposition node have a tendency to crash in Unreal scale so it is safer to scale meshes down before using it. Also it's result is quite noisy with unnecessary tris so I simply PolyReduce it further.

  3. All this work when you reference entire OBJ_network in ROP_FBX and your LOD1, LOD2, LOD3 are parented to Null OBJ called "LODGroup", collision OBJs can fly around freely as long as you export entire network.

  4. There is probably no way to embed a material relative path in FBX file, you can send it using HDAs in Houdini Engine but not via FBX. If you assign a MAT/SHOP to LOD0 OBJ in the OBJ level (assigning it on SOP level will not work) will produce a slot name according to your MAT/SHOP name but you will anyway need to manually assign material once the geometry is imported in Unreal (which surprisingly surprises only me apparently )

To me Unreal Editor is much more on the clicking side then I initially assumed. So building pipeline bridges will surely involve a lot of python scripting. And FBX is one of those misfortunes in our industry with which we simply need to live for the time being.
Take care everybody!

Attachments:
Screenshot 2021-03-07 001916.png (3.6 KB)
Screenshot 2021-03-07 002310.png (42.7 KB)
Screenshot 2021-03-07 003759.png (13.1 KB)
Screenshot 2021-03-07 004439.png (60.4 KB)
Screenshot 2021-03-07 010121.png (10.6 KB)

User Avatar
Member
6 posts
Joined: 10月 2008
Offline
So few month have past since my initial reply. There are few additional things to say.

In UE5 there seems to be not convex collision meshes limit, you can put 1000 So there is no need to monitor what convexde composition SOP is generating.

The other thing is that you can actually export from SOP context with rop_fbx. You simply add primitive string attribute "name" with correct names per LOD stream.

"LODGroup/LOD0"
"LODGroup/LOD1"
"LODGroup/LOD2"
"LODGroup/LOD3"

and

"UCX_LOD0_0"
"UCX_LOD0_1"
"UCX_LOD0_2"

for convex collision shapes where the number at the end corresponds to segment attribute from convex decomposition SOP.
You can put a primitive wrangle after it and put
@name = "UCX_LOD0_" + itoa(i@segment);

During save don't for to toggle "Build Hierarchy from Path Attribute" in the rop_fbx and change standard "path" to "name".
When importing in unreal toggle "Import Mesh LODs" in the importing dialog (Mesh section).
User Avatar
Member
12 posts
Joined: 10月 2019
Offline
Marek_Netzel
So few month have past since my initial reply. There are few additional things to say.

In UE5 there seems to be not convex collision meshes limit, you can put 1000 So there is no need to monitor what convexde composition SOP is generating.

The other thing is that you can actually export from SOP context with rop_fbx. You simply add primitive string attribute "name" with correct names per LOD stream.

"LODGroup/LOD0"
"LODGroup/LOD1"
"LODGroup/LOD2"
"LODGroup/LOD3"

and

"UCX_LOD0_0"
"UCX_LOD0_1"
"UCX_LOD0_2"

for convex collision shapes where the number at the end corresponds to segment attribute from convex decomposition SOP.
You can put a primitive wrangle after it and put
@name = "UCX_LOD0_" + itoa(i@segment);

During save don't for to toggle "Build Hierarchy from Path Attribute" in the rop_fbx and change standard "path" to "name".
When importing in unreal toggle "Import Mesh LODs" in the importing dialog (Mesh section).
Thanks for sharing!
Best regards,
Faxcorp
User Avatar
Member
10 posts
Joined: 3月 2019
Offline
Marek_Netzel
The other thing is that you can actually export from SOP context with rop_fbx. You simply add primitive string attribute "name" with correct names per LOD stream.

"LODGroup/LOD0"
"LODGroup/LOD1"
"LODGroup/LOD2"
"LODGroup/LOD3"

This is one of the most astoundingly helpful things I have ever read
Every couple of months I come back to trying to get multiple meshes with their own custom lods to export for unreal in a single FBX and every time I try to fangle about with the ROP context FBX exporter and nested obj networks and it was this easy alll along...

Thanks so much for sharing!!
  • Quick Links