I have tried different parameters, different nodes combinations to create school of fish with vertex offset, but each time I had the same, or worse then earlier results…
Shader works correctly on static mesh, but particle system change vertexes positions by the same axes (in example it is X). I found that particle pivots have the same XYZ orientation.
So technically shader works correct, it changed vertex position by particle pivot, which is not the same object pivot.
I tried to found school of fish in PC games… but each game showed me the same: floated log.
Is it possible to realize school of fish, each fish changes the direction by velocity, and vertex position changes by object pivot orientation?
Maybe there are easier ways but I would expect using the custom vertex stream velocity could help you. There’s a thread about this!
Since particles that use velocity alignment don’t orient itself using 3d rotations, you can instead use the velocity vector as your relative fish orientation pivot if that makes sense?
There is most likely a little bit sorcery involved in creating this type shader so please share your progress I am curious!
The workflow in the link would have to be adapted and applied to you shader’s vertex offsets differently than discussed in the thread. The exact implementation I can’t tell you without trying to figure it out by myself
Basically your vertex transform is in world space. So without a rotational offset, the animation won’t work. Typically the best approach for this is to back a vertex animation in local space for the mesh, and then play that animation in the shader as most of the nodes necessary usually start from the assumption that you are in local space.
I’ve never had much luck with procedural animation for the swimming of the fish, but flocking is great.
Another thing you’ll want to do is to build in an averaging system between frames so that they have a maximum angular velocity. This should help with the flip-popping.
Without looking at your graph I can only say this, “I hope you’re working in quaternions” because gimbal lock is gonna kick your ass every time.
Ah cool, looks like you solved the vertex animation issue, still using the sine curve?
In the solution I am using at the current project, there is a RotateAboutAxis node, also found in Unreal. Quite handy fella:
Sorry for my long answer, but I have some problems with new Unity 2018.3 and ShaderForge. So I will show the node tree as soon as I made it on Amplify or ShaderGraph