Jump to content

Bounding box is off - importing from raw obj data


Numa
 Share

Recommended Posts

unfortunately I think its just in how babylon imports object files.  I might have to look at the importer and hunt down whats happening for us.
But honestly my only fix that I could find was separating all my submeshs into different obj files and that is not a valid method.  I have a sneaking suspicion its a importer bug honestly because I have been able to reproduce it predictably and the work around i found leans tword that.  I am not familiar with the importer script but I know right where I will go to start and that is going to be the loop over the submeshs, I bet there is a object extension or clone that is not happening correctly or an array is not getting cleared out before the next iteration of a loop hence why the indices and point counts are showing up weird in the output but seem to have a direct relation to their wrongness in numbers.

Link to comment
Share on other sites

 /**
             * This function set the data for each triangle.
             * Data are position, normals and uvs
             * If a tuple of (position, normal) is not set, add the data into the corresponding array
             * If the tuple already exist, add only their indice
             *
             * @param indicePositionFromObj Integer The index in positions array
             * @param indiceUvsFromObj Integer The index in uvs array
             * @param indiceNormalFromObj Integer The index in normals array
             * @param positionVectorFromOBJ Vector3 The value of position at index objIndice
             * @param textureVectorFromOBJ Vector3 The value of uvs
             * @param normalsVectorFromOBJ Vector3 The value of normals at index objNormale
             */
            var setData = (indicePositionFromObj: number, indiceUvsFromObj: number, indiceNormalFromObj: number, positionVectorFromOBJ: BABYLON.Vector3, textureVectorFromOBJ: BABYLON.Vector2, normalsVectorFromOBJ: BABYLON.Vector3) => {

I think this may very well indeed be needing of a bug post yes seeing how I have seen this error pop up for several users and no direct answer has ever really been found the goto is for people to tell one to update the bounding info, but it never works.  Id see what one of the more advanced Guru's say though!  I have have an inkling this is where we need to start looking, see how it says if the tuple exists, add its indice... if it already exists then it already has an indice right why would we be pushing another one?

Link to comment
Share on other sites

@deltakosh thanks I'll keep that in mind.

What about that bug though? It would be great if someone could have a look at that or hint at a quick fix. We're really keen on using Babylon if we could just get past the import stage.

Link to comment
Share on other sites

8 hours ago, Temechon said:

Figured it had to be the arrays were being concatenated, thank you so much for this fix! this was a huge hitch in my development but thought I was just doing things wrong.  It was not until people kept posting the same problem that it triggered duh bug...

Temechon were you the original author on the OBJ importer? You might be the guy I need msg about an interesting idea.

Link to comment
Share on other sites

umm, its a little over my head... Ive never studied the structure of 3d Objects... but if its needed, Ill start becoming competent and take a little pressure off teme.  It looks like after his fix though, there will not be not much change needed.

Maybe ill write us up a FBX importer then...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...