|
koblongata, Newbie
Posted: 01 October 2013 11:59 AM Total Posts: 28
Hi I am wondering if there is any example about VertexAnimator?
I tried subgeometry.updateVertexData, but the operation seem expansive, I can only update around 100 objects, before the framerate drop below 60.
Scaling seems to be more efficient (around 50% faster), so I was thinking maybe VertexAnimator can make transitions would act more like scaling, more faster?
Any help would be much appreciated..
|
GoroMatsumoto, Sr. Member
Posted: 01 October 2013 12:56 PM Total Posts: 166
[ # 1 ]
If your needs is only scaling, and using same geometries on each meshes,
you can use the particle engine of Away3D.
Here is a simple example code of the particles.
https://github.com/away3d/away3d-examples-fp11/blob/master/src/Basic_Fire.as
In Actually, you can have different geometries and textures(not materials)
on particles, but I don’t know whether you need it or not.
You should describe more informations of your project.
Someone can answer more accurate.
Cheers.
|
koblongata, Newbie
Posted: 01 October 2013 02:40 PM Total Posts: 28
[ # 2 ]
I would like to transform the vertices of a geometry, on every enter frame, much like what as3dmod does, but with user defined positions, I tried to achieve it by using (as as3dmod similarly did):
subgeometry.updateVertexData(new <Number>[0,0,0…..]);
but found out that it is a bit slow,
scaling, on the other hand, is faster, isn’t scaling about transform vertices as well? can I manipulate the vertex data more directly like the way scaling did, without having to reload the entire vertex data everytime?
I want to find out what is the most efficient way to transform vertices of a geometry, so was thinking VertexAnimator could be helpful, but cannot find out how to use it correctly..
|
Fabrice Closier, Administrator
Posted: 01 October 2013 03:28 PM Total Posts: 1265
[ # 3 ]
the asmod version you reffer to, is cpu based, acting directly on uvs destructively. A gpu version would read these, and apply the transforms on screen without altering them. Hence why this library is slow for realtime.
You can use Prefab and its builded in VertexAnimator to get familiar with it. Code wize, its nothing more than a series of subgeoms representing the keyframe of your animation.
|
|
Fabrice Closier, Administrator
Posted: 01 October 2013 05:34 PM Total Posts: 1265
[ # 5 ]
I’ve actually already wrote one.
It needs to be polished a bit and I need add some modifers / vertex manips examples. Its just I need find time for it.
|
GoroMatsumoto, Sr. Member
Posted: 01 October 2013 06:17 PM Total Posts: 166
[ # 6 ]
Oh my god… The guru is here.
I’m looking forward to be shared!
|
koblongata, Newbie
Posted: 01 October 2013 08:27 PM Total Posts: 28
[ # 7 ]
Wow, that would be so cool
can hardly wait on this new addition!
|
koblongata, Newbie
Posted: 01 October 2013 08:34 PM Total Posts: 28
[ # 8 ]
Thanks so much Goro! always explaining things to a newbie like me tirelessly every time!
|
GoroMatsumoto, Sr. Member
Posted: 01 October 2013 08:46 PM Total Posts: 166
[ # 9 ]
|
koblongata, Newbie
Posted: 03 January 2014 06:52 PM Total Posts: 28
[ # 10 ]
I was wondering Is this feature still coming?!
|
|
koblongata, Newbie
Posted: 04 January 2014 07:53 PM Total Posts: 28
[ # 12 ]
how many vertices that curtain contain? how do you manipulate the vertex positions to achieve the speed in the demo?? please give some tips thank you:)
|
theMightyAtom, Sr. Member
Posted: 05 January 2014 10:02 AM Total Posts: 669
[ # 13 ]
There’s a blog post about the curtain technique.
http://videometry.blogspot.dk/2011/09/introducing-atomizer.html
There’s 3000 verts in the curtains, 3786 in the manta ray.
To manipulate the vertex positions, make a copy, add your offsets, then reapply. In order to save memory, only take a copy of the vertices once, and reuse this each time.
The routine used in the manta looks like this (updated for Away3D 4)
private function incrementWave():void { //increment the wave waveCycle += _speed; // angle in radians // start with a clean copy of original positions var v:Vector.<Number> = refVertices.slice(0); var i:int; var d:Number; // manipulate the Z component of each vertex (this is dependant on what you want to do!) for (i = 0; i < v.length; i += 3) { // affect the y-axis, depending on distance from z axis d = (1 - Math.cos((Math.abs(v[i + 2]) / modelWidth)* ninety)) * _amplitude; // amplitude depending on distance from mid body // signwave along body length v[i + 1] += Math.sin((((v[i]) + waveCycle) / modelLength) * (threeSixtyRads * _frequency)) * d; // add harmonic from Y frequency //v[i] += Math.sin(((v[i + 1] + waveCycle) / 100) * (threeSixtyRads * _frequencyY) ) * _amplitudeY; } // assign the manipulated vertices back to the mesh (_mesh.geometry.subGeometries[0] as SubGeometry).updateVertexData(v); }
|
koblongata, Newbie
Posted: 05 January 2014 05:39 PM Total Posts: 28
[ # 14 ]
Thank you!
In this situation I found that away3d handles large amount of vertices much better with fewer mesh objects. If I instead having 100 curtains with 30 verts in each, the framerate would drop dramatically. updateVertexData(v) seems to be really expansive as Fabrice Closier pointed out..
|
Rajneesh, Jr. Member
Posted: 20 January 2014 05:48 AM Total Posts: 34
[ # 15 ]
This was really helpful.
Thanks theMightyAtom
|