Sketchfab Forum

Problems with model made out of lines

(Brainjam) #1

I'm using an .obj file to import an object made out of line segments. It has a list of vertices ('v' elements) followed by line definitions ('l' elements)

So a square would be
v 1 1 0
v 1 -1 0
v -1 -1 0
v -1 1 0
l 1 2 3 4 1

When I import this into Sketchfab I just get the line segments v1-v2 and v3-v4.

Is this a bug in the OBJ importer or is this something more fundamental to Sketchfab?

And even if I work around this bug by adding a line 'l 2 3 4 1' (to get the other segments), I'm having problems when I have multiple lines over 500 vertices. Any insights about this? I'm new to the Sketchfab community and for now only want to get this line model working and posted.

(Stephomi) #2

I don't know if OBJ has a strict rules about line declaration with more that 2 vertices.
You are assuming that the vertices are linked together one after the another (aka line strip) but that's not how our exporter is working.
It looks like our exporter is pairing the vertex two by two.

If you want a square you can do l 1 2 2 3 3 4 4 1.
Another solution that will work everywhere would be :
l 1 2
l 2 3
l 3 4
l 4 1

@waleguene Maybe we can check what convention other softwares are following ?

(Brainjam) #3

Lines are probably not frequently used, and the spec for lines may, as you say, not spell out what happens when there are more than 2 vertices. All I know is that the javaview exporter does not agree with the sketchfab importer on this.

Knowing the limitations (there seem to be some on the allowable number of vertices in a line element as well), I've been able to work around this since I posted.