Getting the size of instanced geometry

   2859   8   1
User Avatar
Member
9 posts
Joined: 12月 2021
Offline
Hello guys, maybe this is a basic question but I've not been able to find the right node to do it:

I'm instancing a static mesh asset in Unreal Engine, using the unreal_instance attribute inside of Houdini. Now, I'd like to know the size of the asset in order to do some math in Houdini. However, since the static mesh is an instance, I do not have any real geometry in houdini, and hence I cannot extract any information about it.

Do you guys know any workaround to do this?

Thank you in advance!
User Avatar
Member
28 posts
Joined: 12月 2019
Online
You could either load the source .fbx into Houdini and analyze that, but that needs some way for you to match the two -- or you could hook the Unreal staticmesh asset as an input to your HDA, and that way you can get the unreal geometry into Houdini.

Or a combination of the two, set the staticmesh input on your HDA to bring in just the reference (cheap and fast) and that should give you the path to the source .fbx
User Avatar
Member
9 posts
Joined: 12月 2021
Offline
Thank you for your reply!

Eetu_Mainframe
You could either load the source .fbx into Houdini and analyze that, but that needs some way for you to match the two -- or you could hook the Unreal staticmesh asset as an input to your HDA, and that way you can get the unreal geometry into Houdini.

Indeed, that was my first approach. However, in the end of the process I need to instance the UE asset (and only that asset) using the Unreal_Instance attribute obtaned from the (since I want all the instances to have the collissions, Nanite, materials and other properties setted in the static mesh inside the editor).

Eetu_Mainframe
Or a combination of the two, set the staticmesh input on your HDA to bring in just the reference (cheap and fast) and that should give you the path to the source .fbx


That's the idea! But I think here is the main problem, right? AFAIK you cannot import with an HDA both asset geometry and reference at the same time. The moment you bring to Houdini an object with an Unreal_Instance reference attribute (either with Input or Object Merge), the geometry you get is empty, right?

Or is there an option of importing an object as a geometry with the instance reference attached to it? Because if that is the case that should solve all my problems!
Edited by Egalestrenge - 2022年1月17日 05:54:46
User Avatar
Member
28 posts
Joined: 12月 2019
Online
Egalestrenge
Or is there an option of importing an object as a geometry with the instance reference attached to it? Because if that is the case that should solve all my problems!

I'm not sure exactly what you're looking for, but can't you parse the instance reference from the unreal_actor_pathor unreal_input_mesh_name?

(I was originally thinking of it the other way round, if you could import just the reference point with the source file attribute, you could load the fbx and get the dimensions. But I remembered wrong, in reference mode the source file attribute is not added.)
User Avatar
Member
9 posts
Joined: 12月 2021
Offline
Thank for your quick response!

Eetu_Mainframe
I'm not sure exactly what you're looking for

My bad, I didn't explain it very well in the first post. I'm trying to do something very basic: I have a 3D grid and I'd like to instantiate UE assets in each grid position. The idea is to instantiate the asset such that its size is similar to the size of the grid cell. Say, for instance, that I have a grid of boxes, each box of size 1x2x1 meters. Then, I'd like to instantiate the asset inside of each box, scaling it such that the bounding box of the asset is 1x2x1. In order to do this, I need the original size of the asset, and then scale in x,y,z accordingly.

Eetu_Mainframe
can't you parse the instance reference from the unreal_actor_pathor unreal_input_mesh_name?

The asset is loaded to the HDA via a geometry input, where the input settings is "import imput as reference" in order to use the asset path inside the HDA and instanciate it in the box points using the unreal_instance attribute. At this point I do not have any geometry, just the path, because "import imput as reference" only show the asset path (i.e., not the actual geometry of the asset). By "parse" you mean I can get the geometry of the asset from the asset path?

Thank you?
Edited by Egalestrenge - 2022年1月17日 11:29:41
User Avatar
Member
28 posts
Joined: 12月 2019
Online
Here's a quickie example of what I meant. You can bring in the geo, and use its unreal_input_mesh_nameattribute to reconstruct a valid instance reference string. Essentially just s@unreal_instance = "StaticMesh'" + s@unreal_input_mesh_name + "'";
Attached HDA takes input meshes via a world outliner input, and outputs a grid of random instances, each scaled to fit 1x1x1 meters.

Attachments:
instance_scale_test.png (896.0 KB)
ee_instance_scale_test.hda (17.3 KB)

User Avatar
Member
28 posts
Joined: 12月 2019
Online
The above system does have the obvious drawback of needing to have the objects to be instanced in the same level.

For bigger systems I've used an "library level" which just has all the objects to be used as instances, and an HDA that they are all connected to. The librarian HDA stores the library of things as a .bgeo to disk - in the above case it would just have points with the instance reference paths and bbox sizes as attributes. In the actual level another HDA would read the library .bgeo and distribute the instances as it sees fit.
User Avatar
Member
9 posts
Joined: 12月 2021
Offline
Ohhh!! Now I got what you mean! I totally forgot that I can import the geometry with @unreal_input_mesh_name . The only thing I have to do is append "StaticMesh'" and instantiate it!

Thank you very much, this solves everything.
User Avatar
Member
606 posts
Joined: 5月 2007
Offline
Happy to help, good luck!
  • Quick Links