Anyone know why there are over 4 times as many vertex in CompactSubGeometry.vertexData compared to SubGeometry.vertexData?

Software: Away3D 4.x

pete shand, Newbie
Posted: 20 November 2012 01:48 AM   Total Posts: 21

Anyone know why there are over 4 times as many vertex in CompactSubGeometry.vertexData compared to SubGeometry.vertexData?

and why the length isn’t divisible by 3 (x,y,z)

eg: Creating a sphere 30, 30 segments has 2883 vertex numbers with SubGeometry.vertexData: 31*31*3 = 2883

but for some reason using the new CompactSubGeometry returns 12493 vertex numbers…

   

Somokon, Member
Posted: 20 November 2012 07:57 PM   Total Posts: 75   [ # 1 ]

CompactSubGeometry puts all data (vertex, normals, tangents, UVs) into one vector/buffer.  It’s a performance optimization.

You can take a look at vertexOffset, vertexStride, vertexNormalOffset, etc. to figure out how to get at the data you need from vertexData from an ISubGeometry.

   

pete shand, Newbie
Posted: 20 November 2012 10:13 PM   Total Posts: 21   [ # 2 ]

Arr sweet, thanks for explaining… I figured it’d be doing something like that after reading the Away3D 4.1 Alpha release post, but just wasn’t 100% sure what it was doing.

So will this improve performance if I’m only updating the vertex positions? wont it mean I’m uploading data that isn’t changing? (normals, tangents, UVs)

   

Avatar
Alejandro Santander, Administrator
Posted: 21 November 2012 04:39 AM   Total Posts: 414   [ # 3 ]

I think that changing any of the interleaved data sets and not the others ( for example, changing vertex positions but not vertex uv’s ) has the same effect as changing all the data in a compact sub geometry. This could be less performing than using non compact sub geometries and altering only the buffer that deals with positions. I think there is an option in geometry to use separate buffers.

   

Avatar
loth, Sr. Member
Posted: 01 December 2012 12:08 AM   Total Posts: 236   [ # 4 ]

yes use
_plane.geometry.convertToSeparateBuffers();

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X