rendereverything
May 26, 2021 06:14:26
Hi. Since 4.25 there is a feature to add custom float data per instance. Each instance can have several custom float attributes - these attributes can be accessed in shaders and blueprints and are super useful.
I think it would be nice to have ability to export them from Houdini as per-point/packed primitive attributes. Have some sort of naming convention - like "unreal_cdata_N" and export those to Unreal.
dpernuit
May 27, 2021 10:56:29
Hi,
Support for per-instance custom data has been added to the v2 plugin in Houdini 18.5.521:
The number of custom floats per instance can be set via the "unreal_num_custom_floats" attribute.
The custom data itself can be set on the instances via the "unreal_per_instance_custom_dataX" attributes, where X is the zero-based index of the custom float data.
rendereverything
June 1, 2021 04:58:44
Fantastic! Thank You!
Eche
Sept. 8, 2021 01:02:31
Hello, How do I read these custom data into a shader in Unreal?
Ok found it, there is a PerInstanceCustomData node in the material editor.
Btw Unreal will crash if the Houdini attribute indexing doesn't start at 0, as mentioned above.
Kaiserlicht
Oct. 26, 2021 15:55:29
Can somebody help me with this setup? I can't get this to work. I want to assign a random color to my instances. I'm using the attribute instancer with the unreal_instance attr. set on my points. Then I add an unreal_num_custom_floats integer attribute set to 3 and then three float attributes unreal_per_instance_custom_data0,1,2 set to different values.
Inside Unreal I'm using PerInstanceCustomData in my material assigned to the object I'm instancing. But apparently it doesn't contain any values, it's always black. Any help would be greatly appreciated!
Kaiserlicht
Oct. 29, 2021 07:36:31
No one? Or is the question too confusing
Siavash Tehrani
Oct. 29, 2021 17:29:20
Hey Kasierlicht, I know I had this working. I will try to doublecheck this weekend and post the setup.
Kaiserlicht
Oct. 29, 2021 18:07:20
Awesome, thank you!
Siavash Tehrani
Oct. 30, 2021 05:54:17
I have attached a little sample hda. It scatters some cubes onto points with the unreal_num_custom_floats and unreal_per_instance_custom_dataX attributes. In Unreal you apply a material to this asset that uses the PerInstanceCustomData nodes passed through a VertexInterpolator. This setup also works fine if you skip the Copy to Points bit in Houdini and use the unreal_instance attribute like you are doing.
Let me know if you have any questions.
Kaiserlicht
Nov. 2, 2021 07:22:24
Thanks again for the effort! I'm starting to feel stupid but I still can't get this to work. I apply my material to the "static mesh (instanced)" output of my instancer, correct? I had to rebuild your hda because engine won't allow me to import indie assets with a fx license. Can you try if the attached asset works for you?
Kaiserlicht
Nov. 2, 2021 07:25:20
Oh dear, forget about it. I was on 18.5.499 all the time. Sorry for being stupid, and thanks again for the help
Siavash Tehrani
Nov. 2, 2021 13:33:30
No worries, I'm glad it's sorted out!