OS: Windows 10
GPU: GTX 1050 2GB
Browser: Chrome and Firefox
Ver: Babylon.js v7.19.1
Url: https://sandbox.babylonjs.com/
Expected: Loaded successfully (or tell the user that it’s not supported)
We have a bigger issue here with the obj not just the Exception when there are no UVs.
The objLoader is faking lines by setting the mesh’s material wireframe to true.
It works when the obj contains l elements defined by exactly two vertices and the line doesn’t share vertices. This works with wireframe:
l 1 2
l 3 4
l 5 6
3 lines w/o vertex sharing.
However obj suport multiple vertices in the l element. Both examples produces a mesh with shared vertices.
l 1 2 3 4 5 6 1
l 1 2
l 2 3
l 3 4
l 4 5
l 5 6
l 6 1
wireframe is not applicable with these.
I’ll need to create a LineMesh/GreasedLineMesh from the l elements or should we draw the mesh in MATERIAL_LineListDrawMode. Which approach do you prefer guys?
I’ll need to add new vertices to the resulting mesh. The number of vertices in the obj will be different as the number of vertices of the mesh on scene
since l 1 2 3 4 will result into
Guys, I decided to choose the easiest way to make lines working.
No material change, no LINES mode rendering for the mesh. These parts remained untouched. So it still uses the wireframe trick to render the lines.
I just preprocess the lines elements from the OBJ. See the description:
Lines and polygons are described in terms of their points, while curves and surfaces are defined with control points and other information depending on the type of curve. The format supports rational and non-rational curves, including those based on Bezier, B-spline, Cardinal (Catmull-Rom splines), and Taylor equations.
In case of the sandbox, yes. In case of the api, Promise should be rejected, or onError callback should be called, in case of invalid (or unsupported) obj files
What about devs using babylon.js? Not all of them can use a global error listener to handle. Since most methods in OBJFileLoader returns Promise, the Promise should be rejected, instead of throwing uncaught errors.