- Home /
Vertex animation shader only for a submesh?
Hello.
Our game is in its last stages of development, using Unity 5, and we are confronted with an issue:
we had the idea to add a moving feather on our character's head but it's way too late to do all the animations over again
we then tried to assign a "moving" material (with a vertex animation shader) to the feather. The animation we wanted is probably a bit too complex to achieve by simply making the feather's vertices sway...
we created a little looped animation with two bones for the feather and got it to work as a material without any bones, with a compute shader and two textures which drive the vertices's displacement (vertices's normal and position maps). The idea was to keep the feather rigged and skinned to the character's head and to add its own motion thanks to the compute shader/material associated.
the method above only works for our feather which doesn't have many vertices. We can't animate the feather when attached as a submesh to the whole character, there are too many vertices involved for the texture "baking" in this case
I assume the feather as a mesh has its own vertex array while the feather as a submesh shares the whole character's vertex array... meaning we can't use our "moving" shader/material on the feather as a submesh part of the character. I tried and the result is indeed awful.
I don't see any way around it, is there a way for a single mesh to have the same vertex array as the same mesh but as a submesh part of a another mesh? It sounds silly I know but I must be missing something
Thanks for your help!
Answer by JonPQ · Jul 19, 2019 at 09:52 PM
Can you not just re-export your character with the feather as a separate object/mesh. The feather could still connect to one bone/node on the head to follow the head motion. but additional movement could come from the vertex shader.
Yes, but I would end up with two meshes ins$$anonymous$$d of one?
Yes you would. but that would be the price to pay if you want to run a vertex shader only on some vertices of a model. Hard to quantify performance, but most likely much better to split them into two. Rather than send the whole large character mesh, when you only want to run vertex shader on the much smaller feather.
Your answer
Follow this Question
Related Questions
How to force the compilation of a shader in Unity? 5 Answers
Scissor test/early rejection 2 Answers
Reuse Shader Pass output as input for next Pass 0 Answers
Border overlapping shader 1 Answer
Combine textures with CG? 1 Answer