Hey everyone! I have a vertex offset question that is giving me some trouble in Unreal. Does anyone know how to set up vertex offset that is local to the mesh instead of world space? I want to offset verts by vertex normal local to the mesh if that makes sense, so that when I rotate an object in the world the vertex offset rotates and stays consistent to the mesh. Right now, if I rotate the object that has the vertex offset, that vertex offset will change and go in different directions based on the objects rotation/position which is great for some things, but not when I want to have this offset applied to the same objects in a scene all rotated at different angles.
To provide an example, say I am using a vector 3 with some sin waves plugged into x and I want that vertex offset to stay consistent no matter the rotation of the mesh.
Does anyone have a solution to this? I tried a transform vector (world to local) node receiving VertexNormalWS but that didn’t seem to do the trick for me.
Yeah I can grab a screenshot of what is happening. Yeah I have everything set up to work and vertex offset is working fine and is being multiplied by VertexNormalWS, it’s just the rotation of those meshes in the level that messes with it. It doesn’t seem to be applying the vertex offset locally to the mesh in the sense that whatever the rotation of the mesh the vertex offset will be the same and the mesh will look the same, just rotated. I’ll try and post a screenshot in a little bit if I can’t get it to work with some more tweaking. In other engines I have been able to multiply by vertex normal and not have these issues with rotating the mesh, but unreal seems to treat it slightly different or I might be missing a setting somewhere.
Here is a screenshot. I think the issue stems from my use of a vector 3 to determine specific directions of vertex movement with those append nodes. I want to have different vertex offset for each direction, however, it must be taking that vector 3 and interpreting it as world space or something like that? I basically want to affect the x, y, and z vertex movement separately while still being local to the mesh and staying the same no matter the rotation of the mesh.
In the screenshot the stuff going into the append nodes are textures and sin waves.
I’ll post an update if I am able to figure it out. Or if anyone has any suggestions let me know!
Thanks for the suggestions guys! I’ve tried all sorts of combos and the one that is currently working is using the transform node after the vector 3 transforming from local to world space and actually not multiplying by VertexNormalWS. Doing this keeps my directional vertex offset looking the same no matter the rotation of the mesh.
And the offset depends on the world position, so if I move it around in the scene, the offset changes. If I connect anything else that isn’t the VertexNormalsWS node to the SplitComponents node (like that ObjectPosition or a WorldPosition node) the offset happens too.
P.S. Sorry for reviving such an old thread, for some reason I thought the date was saying June 17th, not June from 2017
You can try to change your Transformations into (or from) MeshParticle Space, that might fix your issue. Also whenever you are using ObjectPosition or ActorPosition, replace it with ParticlePosition.
In addition always use Niagara, not Cascade, Cascade had some issues with WorldPositionOffsets if I remember correctly.
Could you elaborate what exactly is not working and how your materrial network looks like?
Hi! Thanks for your input
If I try using MeshParticleSpace (in any order on that TransformPosition node) then none of the deformations happen and the mesh becomes stiff.
I can’t use Niagara because this is for a game project that’s been in development for some time and the art director doesn’t want to risk adding this new system and having it explode in our faces, I would also prefer to avoid causing a disaster. So we’ll just use it for next project but not this one.
I would love to show you how it’s behaving but because of NDA I can’t. I can show you my nodes though:
The problem is that the deformations are still happening in world space while in a particle system, so if I rotate the particle system instead of doing a zig zag motion the mesh is behaving more like a worm for example.
The solution I posted above only works when the model is used outside of a particle system, so I made a couple of blueprints to imitate what a particle system would do.
if it is inside a particle system you have to use ParticlePositionWS. It won’t work with ObjectPosition as Priareos already stated.
Subtracting the position in the same space was the right move to get the correct local (center) position. But saying “I don’t know why or how” shows me that you have to invest some time into your vector maths because that is one of the first steps that one learns
(I’ll leave a link for that: Chapter 2: Vectors (Immersive Linear Algebra))
You also state that “the offset depends on the world position”, which I do not quite understand. For me an offset is a value that gets added somewhere (mostly at the end), to have the animation “start” at a different position. Because how you describe what it should do, it sounds like it should make the animation super jittery.
Extra: Keep in mind that particles just know the information giving by the emitter on birth and then just now about themselves.
No need to be patronizing. If I didn’t understand vectors I wouldn’t have this job nor be able to do what I’m doing. It is possible to understand vectors and still don’t know why or how a problem is happening.
I tried ParticlePositionWS as well as others from the very beginning and any other that isn’t ObjectPosition doesn’t fix the issue and it adds an offset that isn’t fixable with the subtraction I showed before. So ObjectPosition is the only one that gives me a correct position even inside the particle system. It’s not the position that is the problem, it’s the rotation.
What I mean with “the offset depends on the world position” is that if you move the object around then the mesh offset changes, only being at the correct position when the pivot point is at origin. For example, if I move it to the right the mesh will move to the right exponentially, same if I do it for any other direction.
What you are describing (moving exponentially further, the further away from origin) is usually because you are adding the object or world position every time you are adding an offset. So it adds the offset + it’s own position. If that makes sense.
So, I’ve done some testing and I think you can maybe get rid of all of your Object Position + Transformation etc. As you are plugging it into the WorldPositionOFFSET, you are already adding it and don’t need to do it before. Then, as it will offset in world space, you will have to multiply with the object orientation (static mesh) or the particle direction (cascade mesh particle), so it adds the offset correctly. (Or you multiply with vertex normal, but then it’s on a vertex level, not an object level).
If you are then applying this material to your MeshParticles, it should just work (assuming they are Velocity Aligned). Not sure about the diagonal jaw movement stuff, but I’m sure we can figure out a different way.