Custom geometry and vertices / indices order logic

Software: Away3D 4.x

Joni Bekenstein, Newbie
Posted: 15 February 2012 01:33 PM   Total Posts: 3

Hi, I’m creating a custom geometry (by code) and I have the following question:

Should I apply any logic in the order of the vertices and the indices?

I’m sharing vertices between the faces, so should I declare the indices in such a way that all neighbor faces (which share vertices) are one after the other? Or that really doesn’t matter?

   

Avatar
Fabrice Closier, Administrator
Posted: 15 February 2012 02:21 PM   Total Posts: 1265   [ # 1 ]

If all indices point at the propper vertex (x val) pointer.
if vertex and normals buffer have same length
if uv buffer is multiple of 2
if indice buffer is multiple of 3, meaning it declares a series of triangles, each having 3 vertices (3 numbers per vertex (x,y,z)), 3 normals(3 numbers per normal (x,y,z)), 3 uvs (2 numbers per uv’s (u,v)) and 3 indices per face (3 uints)
if you ensure that you do not have more than 196605 entries into vertices buffer per subGeometry.

Then you’ll be just fine. If not, Away will present you a nice big fat error or go black wink

Also you might want take a look at the Weld class, it shares all vertices out of the box for you! Explode does the reverse. Both good for either smooth or flat shading results.

 

   

Joni Bekenstein, Newbie
Posted: 15 February 2012 02:49 PM   Total Posts: 3   [ # 2 ]

What I’m trying to do is define a geometry with the shape of a slice of a donut. Imagine a slice of pizza (an isosceles triangle with a rounded base), and then take a big bite off the tip.

I managed to build the top and bottom sides, and join them along the rounded parts. But when applying a light, it doesn’t look correct.

I only define vertices and indices. Normals and tangents are auto derived (don’t really know how to do it manually anyways). And also I’m not defining any uv data either.

I’ve attached 2 swfs. Any ideas?

 

File Attachments
Demo001.zip  (File Size: 198KB - Downloads: 247)
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X