Jump to content
  • Advertisement
Sign in to follow this  
Tipotas688

Ply Files

This topic is 3615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Can anyone tell me how ply files work? I dont understand what the faces tell us exactly in order to place the vertices in their correct place

Share this post


Link to post
Share on other sites
Advertisement
Here's an example ply for reference:

ply
format ascii 1.0
element vertex 11
property float x
property float y
property float z
element face 11
property list uchar int vertex_indices
end_header
0 1 0
0 3 0
2 0 0
2 2 0
2 4 0
3 2 10
4 1.8 0
4 2.2 0
6 0 0
6 2 0
6 4 0
3 0 2 3
3 0 3 1
3 1 3 4
3 2 6 3
3 3 6 5
3 3 5 7
3 3 7 4
3 5 6 7
3 6 8 9
3 6 9 7
3 7 9 10

Share this post


Link to post
Share on other sites
Looks like the header says you first how many vertices you have,
and which components they have.

In your case 11 vertices with x,y and z coordinates.

And it tells you that you have 11 faces (quads in your case).

So your vertices are:

0 1 0
0 3 0
2 0 0
2 2 0
2 4 0
3 2 10
4 1.8 0
4 2.2 0
6 0 0
6 2 0
6 4 0

And your vertex indices for the faces are:

3 0 2 3
3 0 3 1
3 1 3 4
3 2 6 3
3 3 6 5
3 3 5 7
3 3 7 4
3 5 6 7
3 6 8 9
3 6 9 7
3 7 9 10

Hth,
Marc

Share this post


Link to post
Share on other sites
I m ok with that but how will I use the faces in order to create the actual shape?

I suppose the faces tell you where to place the vertices? I ve writen some code for it but it doesnt seem to work properly...

Share this post


Link to post
Share on other sites
If I'm correct with my assumption that the indices are for polygons, then
you should build your polygon according to the indices. That means
that you use the first four indices to get the vertices to draw.

In your supplied file you would draw a quad with the vertices 3,0,2,3 (First Face)
And then with the next four indices
(vertices 3, 0, 3, 1) - if you are using OpenGL you can use glBegin(GL_QUADS).

But it is not even close to being performant - for performance you have to
build an index buffer and a vertex buffer and draw with VertexBuffer Objects or
the equivalents in DirectX.

Marc

Share this post


Link to post
Share on other sites
Its triangles as the first one shows how many corners there are, or so I guess.

I found out what was my problem, in the end I had understood what ply files have in them but I had put the wrong number in the tables so they looked up the previous face.

Thanks though :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!