drawing with gu (translations and such)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
sturatt
Posts: 46
Joined: Thu Jul 13, 2006 4:21 pm

drawing with gu (translations and such)

Post by sturatt »

I guess ill start with what im trying to do. What i want to do is write an exporter for milkshape (a 3d modeling program) to write a custom model format. Ive looked into it a bit, and have come across something that im not quite sure how to handle. I always assumed that for bones and animation, there would be a very simple hierarchy:

bones have meshes, meshes have vertices
bones -> meshes ->vertices

After looking at milkshape, ive discovered that instead of that, the meshes and triangles formed from the vertices are seperate from the bones entirely, only the vertices are connected to the bones. This makes sense, since if have a mesh with two bones and you move one, you want to triangles between the bones to stretch, instead of creating a hole in the mesh.

my question about the psp is this: i only know of one way to draw with the gu, and thats sceGu(m)DrawArray(...) which takes a vertex and index list. If i am trying to draw a triangle that has say each of its vertices attached to a seperate bone, then each vertex will need to be transformed according to that bone right? how would i draw this triangle whose vertices are each transformed differently?

ive only ever thought about doing something like this

transform(x,y,z)
drawTriangles(index list, vertex list)
transform(x,y,z)
drawTriangles(index list, vertex list)

but i dont see how that can work if a triangle's vertices might need to be transformed differently

I hope that all made some sort of sense, and im sorry if this is a simple/stupid question =\
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Re: drawing with gu (translations and such)

Post by rapso »

sturatt wrote:After looking at milkshape, ive discovered that instead of that, the meshes and triangles formed from the vertices are seperate from the bones entirely, only the vertices are connected to the bones. This makes sense, since if have a mesh with two bones and you move one, you want to triangles between the bones to stretch, instead of creating a hole in the mesh.
in other animation programs the vertices are even assigned to more than just one bone, just imagin a face, the form of the lips are affected by several muscles, it wont be sufficient to have just one bone per vertex, they're then assigned to bones with specific weights, this is usually called skinning.
my question about the psp is this: i only know of one way to draw with the gu, and thats sceGu(m)DrawArray(...) which takes a vertex and index list. If i am trying to draw a triangle that has say each of its vertices attached to a seperate bone, then each vertex will need to be transformed according to that bone right? how would i draw this triangle whose vertices are each transformed differently?
The PSPSDK has a sample for skinning, as the GU supports skinning with up to 8bones per mesh afaik. if you want to support more, you probably have to split your mesh into several trianglegroups.
sturatt
Posts: 46
Joined: Thu Jul 13, 2006 4:21 pm

Re: drawing with gu (translations and such)

Post by sturatt »

rapso wrote:
sturatt wrote:After looking at milkshape, ive discovered that instead of that, the meshes and triangles formed from the vertices are seperate from the bones entirely, only the vertices are connected to the bones. This makes sense, since if have a mesh with two bones and you move one, you want to triangles between the bones to stretch, instead of creating a hole in the mesh.
in other animation programs the vertices are even assigned to more than just one bone, just imagin a face, the form of the lips are affected by several muscles, it wont be sufficient to have just one bone per vertex, they're then assigned to bones with specific weights, this is usually called skinning.
my question about the psp is this: i only know of one way to draw with the gu, and thats sceGu(m)DrawArray(...) which takes a vertex and index list. If i am trying to draw a triangle that has say each of its vertices attached to a seperate bone, then each vertex will need to be transformed according to that bone right? how would i draw this triangle whose vertices are each transformed differently?
The PSPSDK has a sample for skinning, as the GU supports skinning with up to 8bones per mesh afaik. if you want to support more, you probably have to split your mesh into several trianglegroups.
thanks for the reply. I guess that was a silly question, since the sdk has an example of doing exactly what i asked. Whenever someone talked about skinning, i thought they meant applying a texture to a mesh or something along those lines.. thats why I didnt look at the skinning example, but I'll look at it now, thanks again =)
Post Reply