Pregunta

From my computations, I've got a lot of raw bytes of data. I would like to view them not as an image, but as a 3D relatively-standard file. (c.f. previous question about PPM :What is the simplest RGB image format? )

I would like to put in a file some header and a bunch of struct point, and open this file with a standard 3d file viewer such as g3dviewer.

struct point {
    unsigned int x; // coordinates
    unsigned int y;
    unsigned int z;
    unsigned char r; // color
    unsigned char g;
    unsigned char b;
}

I've already looked at the .OBJ file format, but it forces me to translate each point in a text line describing a cubic vertex.

Does this simple 3D file format exist ?

¿Fue útil?

Solución

The PLY format is fairly simple.

ply
format ascii 1.0
comment object: vertex cloud
element vertex 8
property uint x
property uint y
property uint z
property uchar red                   { start of vertex color }
property uchar green
property uchar blue
end_header
0 0 0 255 0 0                         { start of vertex list }
0 0 1 255 0 0
0 1 1 255 0 0
0 1 0 255 0 0
[...]

In line 4, the number of vertices is defined.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top