Newbie with quick question on the mesh generation in tutorial (cube example)

29 views
Skip to first unread message

Eric Warner

unread,
Mar 3, 2021, 3:39:57 PM3/3/21
to pycollada
Hi,
  New to pycollada, and it looks very useful.  Trying to understand the expectations for arrays describing vertices, normals and uvs (for texture).  In the online example for generating a dae representing a cube, the array for vertices is 24 numbers, corresponding to one group of  3 for each corner of the cube (8 corners) to describe x,y,z .  The array describing the normals contains 72 numbers, which corresponds to 24, 3 xyz coordinates.  I understand how the indexing system is supposed to work, just don't see why you don't have the same number of normals as vertice xyz groups.  I can see where theoretically you could have 3 groups of 3 normals for each corner, I just haven't seen anything to confirm that is the case.

Second question then is for textures, can I just create an index such that you have one uv pair for each corner (in the case of the cube).  So the array is 16 numbers, for 8 uv pairs?

Thanks,
Eric

Jeff Terrace

unread,
Mar 3, 2021, 4:00:48 PM3/3/21
to pyco...@googlegroups.com
On Wed, Mar 3, 2021 at 12:39 PM Eric Warner <ewarn...@gmail.com> wrote:
Hi,
  New to pycollada, and it looks very useful.  Trying to understand the expectations for arrays describing vertices, normals and uvs (for texture).  In the online example for generating a dae representing a cube, the array for vertices is 24 numbers, corresponding to one group of  3 for each corner of the cube (8 corners) to describe x,y,z .  The array describing the normals contains 72 numbers, which corresponds to 24, 3 xyz coordinates.  I understand how the indexing system is supposed to work, just don't see why you don't have the same number of normals as vertice xyz groups.  I can see where theoretically you could have 3 groups of 3 normals for each corner, I just haven't seen anything to confirm that is the case.

I think the normals source data there could probably be trimmed down, since it looks like it has duplicates. The indices are really what matter in terms of matching lengths of the vertices and normals. The vertex data is optimized, where individual points are referenced more than once in the indices. It looks like the normal indices only reference each source value once.
 

Second question then is for textures, can I just create an index such that you have one uv pair for each corner (in the case of the cube).  So the array is 16 numbers, for 8 uv pairs?


I believe the collada spec defines how they get mapped onto the surface.
 

Thanks,
Eric

--
You received this message because you are subscribed to the Google Groups "pycollada" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycollada+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pycollada/2b6c4d1e-90e0-4718-b8a1-a31e0782029en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages