Vertex Tangent issue for World Position Offset

Hi there VFX people,

For my first post ever down here, I hope to find some help about normal, tangent and binormal import within UE4.

Lately, I’m playing a bit with world position offset within the shader graph. My latest idea was to use texture coordinate and a bit of math to edit a disc-shaped mesh in realtime for VFX purposes. The goal here is to work with an instanced material of this shader to preview which mesh shape and UVs will be the best set up for a chosen panning texture later on.

image
image
image

As seen above, it allows me to change the general shape of this disc using several parameters, or make vertex rotate smoothing around mesh pivot point axis to help with spiral effect when coming to VFX creation.

For next part, I wanted to offset vertex along binormal to help acceleration/slowdown panner motion.

image

With this feature comes a tangent based issue as shown below :

image

With my mesh UV and normal set up and import setting, I get “splitted” tangent and binormal all along the mesh UV seam. This result in weird behaviour when using vertex binormal for offset within the shader graph. I’ve looked a bit for an alternative way to offset vertex on this axis direction, or in ways to solve this double tangent on my mesh but got stuck there for a while.

If anyone has any idea about how to handle such a situation, feel free to let me know about it! It would be very appreciated!
(Hope this topic intro is understandable enough, feel free to ask for details or explanation if needed!)

See you soon !
Loïc Nayet, VFX enthousiast in learning.

i wouldnt use the vertex binormal - instead take the WorldPosition - ObjectPosition to get the direction vector towards the centre and then transform the Verts along that axis.

Hope that helps

Thanks for the idea! ObjectPosition will be the same as my mesh pivot point location, right ? To do what you are talking about, I would think about getting VertexPosition and make vector look to the object center (make it look the ObjectPivotPoint for example) But I can’t find any “VertexPos” node within the shader graph…

As seen in the Position node documentation, it holds the information of the mesh vertex.
As tharlevfx pointed out, using WorldPosition - ObjectPosition gives you a way to get directions to the center, which helps you to deform according to it.

In your example that you did in a 3d software, many things depend on the distance from edge to center. You could give the vertices a color from intensity 1 (from center) to 0 (at edge) and use this to manipulate the intensity of vertex movement. Just to throw in another approach.

1 Like

Mesh vertex itself represents a radius-vector which is a direction from pivot ( in the object space ) So there’s probably no need to calculate WorldPosition - ObjectPosition , you can just normalize vertex position , reverse it ( mult by * -1) and transform it in the world space…or the one that mostly matches your goal being an object,world,screen etc.

2 Likes

Thank you for giving a different workflow approach with this 0 to 1 vertex color intensity!
For now, I’m working with another solution that seems to work just fine with the cases that I want. But this idea of using vertex color info to manipulate world position offset didn’t come up to my mind since I’m still quite a beginner in terms of shader pipeline knowledge.
I’ll make sure to give it a try and to keep this vertex color info usage in mind! :slight_smile:

Thank you for your repsonse! :slight_smile:
I’ve almost solved my issue on my own, but I think that my approach is pretty similar to what you try to explain to me with you response.
I’m preparing a little subject update with screenshots and gif to show where my project is going and pros and cons of solutions I found :wink:

2 Likes

Hi people!

Finally got some free time to update this post! :wink:

To begin with, I succeed to do what I wanted to! In fact, I was misunderstanding what world position & object position was really referencing to. After some test and playing with this kind of WorldPos - ObjectPos in addition to the fresnel feature (for another shader I’m working on), I finally understood what you guys were telling me about this method earlier this week!
In brief, it works as I wanted to, here a little preview in video :
Disc-shaped mesh vertex offset - flipbook
Disc-shaped mesh vertex offset - wireframe
I still have to clean it up a bit by adding more detailed control features, but the main core of this part of my shader is working properly! :grin:

For the curious ones, here a quick workflow explanation :


This part of the world position offset go through 3 different material function, each one driving on of those disc-shaped mesh feature. The goal is to allow the user to make good use of those custom functions without being too much messy inside the material instance editor, that’s why I chose to work with StaticSwitchParameter for a cleaner parameter editor later. Here’s an example of the instanced material editor :
image

image

And here an example of those basic custom material functions I’m using to achieve the wanted effect :


Vertex rotation

image
Vertex vertical offset


Vertex scaled offset

For the even more curious ones, you may be asking yourself what I’m doing with this?
My goal with this shader is to create a VFX previewing material as complete as possible to help concept making before creating more specified and performance-friendly material, using only the needed features pick out from the previewing master material. (I hope I’m not too much messy with my explanation here and that I made myself understandable about this :sweat_smile:)

Here’s a quick overview of some other feature I made (among many others) to work more efficiently later with VFX production :
VFX Previewing Shader - Example A
VFX Previewing Shader - Example B

That all for today!
Feel free to share your opinion/advice about this, I’m more than open to feedback! :slight_smile:

1 Like