I had deleted my other topic before figuring out the answer myself. My wind effects do not work properly or even on the same axis as the object position that the plants are generated in.
I built my wind to have a sway and instead it is moving everything up and down by the entire length of the plants and trees. Or causing them to glitch out altogether.
I have gone through multiple tutorials to figure this out and nobody has a wind effect that works with an instanced foliage actor.
I’m labeling this a bug report because of how broken it is. I can provide video and blueprints if needed.
I did have the bottom transform position already but apparently it needed an instanced position after the world position node. In other methods I only needed the lower transform position to make it work.
I made my wind with 2 output functions. A part that controls the basic wind movement and a sway function. I’m sure there’s a way to optimize it but I wouldn’t know where.
My next step is figuring out how to lerp the sway direction with a random effect in order to have them sway in different directions.
It worked alright. I had to move a few things around. I figured out that the World Position can connect directly to the Position input which simplifies it a bit. The pivot point is the calculation of the object positions relative to the world position.
The randomness gets built into the NormalizeRotationAxis input. It can also work without a time node if you connect it to the Wind node because it already has one in its function.
I probably have way more nodes than I need for customization options. That extra bit of math connected to the last multiply node isn’t really needed.
I think it’s good for now. I might play with the way it calculates the randomness and fix it so the bending movement is a little less stiff.
I think the object radius node is messing me up still. The blueprint works without it. But when I apply it the wind stops functioning properly in the InstancedFoliageActor. The issue with this node is that you cannot apply a transform position to it because it’s a different float value.
I tried to mask it to a component 3 vector. Then apply a transform but that only made it worse. Otherwise I’m on the right track. It works properly when previewing the model but not on my map.
I think their issue is with an older version. I’m going to see about finding a way to manually calculate it or a different way to get a similar effect. I have multiple tutorials that I’m following so one of them probably explains it in better detail.
I could also mask the plants and trees based on their height instead of their radius. I did it earlier by masking off the B channel from the world position and dividing it by the height of the object. I just find it odd that some tutorials don’t do that when it’s the easier method with less nodes to follow.
I figured out one of my issues from earlier was because my pivot point wasn’t at the base of the object thanks to the confusion of having to apply transform nodes. It made a wonky effect where the sway was happening from the middle of the trees and the top went one direction while the bottom branches went the opposite. The world position doesn’t need a transform. Just the rest of the object referencing nodes.
This was my initial world and object position mask. It turns out I already had the answer and all I needed to do was to multiply this into the end of the equation to mask it. It can also be lerped but it’s a static effect.
Both transform positions are required when working with instances so the origin axis faces in the same direction for all instances.
That part is working properly for the world position transforms. I’m trying to figure out how to make the plants blow in other directions now. It seems like the movement is locked to a 0-1 range of motion.
Is that world position node giving you the location of the whole foliage actor though?
You can always use the debug node trick, to see what is coming back from those nodes ( although you’ll need to change your mesh to a cube or similar to be able to read it ).
I assumed it was the actual world position of everything. Since applying transforms to it breaks the location of the pivot points.
The rest of the equation is set up to calculate the distance of the effect based on the pivot point of the plant. The pivot point requires the transform node to know where the instance of each plant is.
I am able to visualize some parts of it by plugging into the color input of the materials. I’m pretty much past that point though since I’ve already figured out how the world space is affected by the transform points.
It’s how I figured out the height mask in my previous screenshot. I tried different combinations of transform nodes between the world position and the object local bounds until the colors all pointed in the same direction. The mask will break the RotateAboutAxis node if applied to the pivot points since it changes the world and pivot point positions, so I multiplied it at the very end.
I looked everywhere and watched every tutorial about wind sway. Some of them even make mistakes which wouldn’t matter if the objects are not instanced this way.
I have also tried every single way to generate plants onto my landscape that works in the most natural way possible. From the foliage painter to PCG spawning. (PCG is terrible and breaks when alternating locations in the same volume. It also prevents the plants from spawning naturally since it’s all based on a grid.)
The InstancedFoliageActor happens to be fairly new for the most part. It’s what they’re using for newer projects and games like The Witcher along with their new built in speed tree generator.
Personally I think there are no tutorials because they probably couldn’t figure it out. You also can’t successfully apply an object radius node without it breaking. (It’s not compatible with a transform node) As well as figuring out that mask. Some tutorials apply the mask into the pivot point.
The way I got around the object radius was to multiply the whole effect with itself which allows for a nice bending near the top of the plants. Then applying the mask at the end gives it an adjustable gradient to keep it all in place. This probably lowers the processing requirements since it doesn’t have to calculate a physical distance into an object radius of each instance.
I think I figured it out. Every single tutorial tells us to cross reference the Normalized Wind Vector with the NormalizedRotationAxis. Unplugging that immediately allowed me to rotate the pivot angle based on the rotation axis.
Figuring this out made me think WTF, since it is mildly infuriating that they would lock the rotation angle to a static input.
This frees it up so now I can add some randomness directly into the rotation axis. I think I’m going to get rid of the Wind node and plug the Time node into the windspeed instead.