www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: MichaelJPCT on July 08, 2020, 09:23:34 pm
-
Hi Egon,
when i want to move some vertices of an object, the 1st method that comes to mind is using a shader.
but sometimes i dont like to write a new shader.
Animation and IVertexController seem to be my options.
but i worry about the performance.
among the 3 methods, is shader potentially the fastest one?
assuming:
the movements are simple maths.
i need to deform the object in every frame.
the quantity of moving vertices is below 100.
-
Shaders are certainly the fastest, but in a lot of cases, Animation should be good enough. Personally, I never did complex animations using a shader. I only used them for simple stuff like foliage moving in the wind. The IVertexController should be similar to Animations but the code tweaking the vertices is less efficient than the animation code in most cases, because it has a slightly higher level of abstraction.
-
From my own experience:
Pro's shaders:
Shaders are fastest
Con's shaders:
Shaders can produce inconsistent results on different devices
Writing shaders for animations is more complex than creating Java animations
-
thank you both .