Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Vertex shader animated polygon flip

I am trying to create a vertex shader-based animation that would flip each polygon of a (two sided) mesh. It should look similar to this, except with every polygon of the mesh, rather than just one plane:

alt text alt text

In that example, I use the plane's pivot and the world X axis for the RotateAboutAxis node. But when it comes to a more complex mesh (a character, for instance), you need the center point of each polygon as the pivot, and a vector perpendicular to that polygon's normal direction as the rotation axis. I made several unsucessful attempts, and I am having trouble getting the rotation right.

Could you point me in the right direction? Or maybe you can think of a better approach to this effect?

Thank you.

Product Version: UE 4.19
flip1.gif (444.5 kB)
flip2.png (306.2 kB)
more ▼

asked Jun 23 '18 at 12:51 PM in Rendering

avatar image

1 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You are on the right path, but you need something, to get pivot of the subject. As an example, you can encode that in your vertex colors or UVs.

more ▼

answered Jun 23 '18 at 06:03 PM

avatar image

7.9k 130 31 293

avatar image NAVAZA Jun 23 '18 at 07:13 PM

Yes, that is what I was trying just now. So far, I have found a node that gives you the tangent and binormal vectors, so I can put that into the rotation axis.

Now I only need to find the center of the polygon/barycentric coordinates to use them as the rotation pivot.

Vertex colors could work for static meshes, but I would rather do it in the material, so that the effect would work on animated meshes, too. Except I have no idea how to find the barycenter of each triangle/polygon, since I don't have access to the 3 vertices of each triangle, but just the one vertex being processed at the time.

Any ideas?

Also, here's another gif. I got it working on spheres and sphere-like meshes with hardened/flat normals, since you can fake the polygon pivot doing "objectPivot + (vertexNormal * objectRadius)".

First row is rotating in their V/binormal axis, second row in the U/tangent axis, and the third in the W/normal one:

alt text

flip3.gif (5.1 MB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question