Search - User list
Full Version: Instance size affecting spline resample length
Root » Houdini Engine for Unreal » Instance size affecting spline resample length
Hello, a simple question from a new Houdini user

I am placing instances along a spline in Unreal, and I am having trouble on getting the resample length to adapt to the bounding box of the instance used inside Unreal. Ideally when I change to an instance with a different size, the resample length of the spline should change as well. Any ideas on how to do this?
You can use [] to find out about the size of the thing you want to instance, and then it's a matter of dividing the length of the spline by th result to find out how many points you want on the spline. Also probably need to truncate that number (round off) and make sure the last point of the spline is removed, or something like that. Depends on what behaviour you actually want.
You will probably also want to look into the polyframe SOP to allign the normals of the points on the spline along the spline, so you can orient the instances along the spline…
I have all that working in Houdini, but when I change the instance in Unreal, the resample length doesn't change.
Have you tried to force a recompute/another bake?

- If you could share your file (or a simplified version), it would be easier to debug.
I guess I am doing things in the wrong order?
As far as I understand, you assign a new mesh (instead of the default box) to the HDA in Unreal. What this does is, it puts the new mesh onto the instance points, instead of the old mesh. Now here's the problem. You scale your box to make it fit along the spline segments, but you are not scaling the mesh you assign in Unreal. To do this, you need to analyze the size of the input mesh. You can get the input mesh from Unreal into the HDA with an object merge node with the “Object 1” parameter promoted to the UI of your HDA. You make a check in switchnode, to see if there is anything coming in from this merge node. If not, you just use your default box. Then you analyze the size of this thing and then calculate a scale factor. Basically: size of box along the axis that aligns with the curve edge times scale factor equals curve segment lenght.
Then you create a point vector attribute “scale” with each of the three value slots equal your scale factor. That needs to happen on your instance points, so basically you can do it in the same node where you create the instance attribute.
You will also want to put a polyframe node after that. Untick “Normal Name”, replace “tangentu” with “N” (no quotation marks) and set Entity to “First Edge”. That way you get normals along the spline. These normals and the scale attribute are both interpreted by the instance node to do specific things with the instanced mesh. The normals will rotate it and the scale will scale it.
In unreal this then gets translated into a Instance static mesh node in Blueprints (when you bake to blueprints) and that blueprint node does the exact same thing as Houdini's instance node. Note that in Unreal negative scale on instances will lead to undesirable results, so don't do it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB