Importing obj with intersecting meshes as stamps - problems — Oculus
New to the forums? Click here to read the "How To" Guide.

Developer? Click here to go to the Developer Forums.

Importing obj with intersecting meshes as stamps - problems

FrozenPeaFrozenPea Posts: 2,535 Valuable Player
edited June 2017 in Oculus Medium
Hey Everyone,

I've trying to make my own stamps in Maya and then import them into Medium to use as stamps. I have made about 20 stamps but most of them are simple geometry and some are using intersecting meshes which don't work well in Medium.

Here an example:

Normal model using two pieces of geo intersecting (all looks good in preview page)

Here is what it looks like after running a Boolean -> Union in Maya. The mesh is all water-tight



You can download the meshes here: https://drive.google.com/open?id=0Bwvhwj7RGYOpcVl2TnNqd2FaQ28
Joint_01 - intersecting 
Joint_03 - boolean

Anyone have any advice on how to get it to work properly? :)

Thanks!

Comments

  • P3nT4gR4mP3nT4gR4m Posts: 1,696 Valuable Player
    At a glance I wouldn't be surprised if it was the single, long quads was causing the problem. Remesh maybe worth trying?
  • FrozenPeaFrozenPea Posts: 2,535 Valuable Player
    Thanks for the advise @P3nT4gR4m ;

    I thought quad imports were fixed but I will try converting to tri's and will report back :)
  • MattHickmanMattHickman Posts: 359 Oculus Staff
    Yeah, we do now convert quads to tri but... this might be an edge case we didn't handle the best, we'll have a peek.
  • duncankellerduncankeller Posts: 16 Oculus Staff
    @FrozenPea
    You have the right idea with using the boolean'd watertight mesh, those should all theoretically work. Probably something funny in the import code, I'll take a look at it. In the mean time, definitely try triangulation and see what happens. Indeed we support quads now, but if it works when you triangulate it that's more info for us to help nail it down and get it fixed.
  • duncankellerduncankeller Posts: 16 Oculus Staff
    @FrozenPea
    You have the right idea with using the boolean'd watertight mesh, those should all theoretically work. Probably something funny in the import code, I'll take a look at it. In the mean time, definitely try triangulation and see what happens. Indeed we support quads now, but if it works when you triangulate it that's more info for us to help nail it down and get it fixed.
    Doggone it, I spoke too soon, it's absolutely the quads causing this. I triangulated in blender and it comes in with no issues. On the plus side, it seems like a pretty specific issue so I'm pretty confident I can get this fixed up. Thanks for the post!
  • RoswaldRoswald Posts: 4
    NerveGear
    @FrozenPea Hey Frozen Pea. when you booleaned the object you created a giant pocket of empty space within the geometry in the intersection, you can tell where it is in the green stamp preview. Since the walls are so thin Medium won't make any geometry in the intersection. A quick way to fix this is to delete all the geometry within you object and triangulate the mesh to make sure its water tight.
  • duncankellerduncankeller Posts: 16 Oculus Staff
    edited June 2017
    @FrozenPea
    OK, sorry for the spam, but I nailed it down further. We triangulate n-gons during import, so I wasn't sure why triangulating them in blender was fixing this. What I ended up doing as a test was just triangulating this particular part to see if it would work, and it did.



    So the real issue here seems to be the way we triangulate these polys, as triangle fans rather than in a way that wont leave verts that don't connect to adjacent faces. There's probably a smarter way we could do this, but in the mean time this should hopefully be a good heuristic on how to get good-looking meshes with n-gons into medium!
  • FrozenPeaFrozenPea Posts: 2,535 Valuable Player
    @duncankeller Thanks for being so hands on, wasn't expecting this! :) 

    I tried doing a triangulation within Maya and had the same success. Doing a bool + tri is really easy so I will just stick with doing that for intersecting meshes for now until the next patch :)
     
    If there is anything else I can do to help then please just let me know, I'm happy to send over my .mb file or do any further testing if you need it! 
  • duncankellerduncankeller Posts: 16 Oculus Staff
    No worries, I tend to go a little nuts on the import stuff since there always seems to be an edge case or two I hadn't thought about.

    For this particular case, I had a discussion with our graphics engineer, and learned that one of our hard constraints for stamps is that they are watertight and have no T-Junctions, which is exactly the problem here. It is a bit ambiguous, because some definitions of watertight include "no T-Junctions" and others do not, but for our purposes, the T-Junction is causing the issues, the fact that it is also a quad is a bit of a red herring. 

    And we also have a constraint that the stamp loading has to be quite fast, which is why we don't do a huge amount of processing on the meshes to make sure that they fit all of the criteria. So I think at least in the short term we will not be able to handle this case very well. My suggestion: When in doubt, remove duplicate verts and triangulate, and you should be golden. Really though you should be fine as long as you avoid the T-Junction.

    ANYWAYS sorry for the ramble there, hopefully that clears things up!
  • FrozenPeaFrozenPea Posts: 2,535 Valuable Player
    haha so I unknowingly created the 'worst case scenario' import as my first import? Sounds about right!  :D

    That clears things up perfectly, I just went through and did a bool + tri to all my other meshes and everything is importing perfectly now, thanks so much! :)
  • P3nT4gR4mP3nT4gR4m Posts: 1,696 Valuable Player
    Surely it aint a quad at that point, it's an n-gon?  
  • duncankellerduncankeller Posts: 16 Oculus Staff
    P3nT4gR4m said:
    Surely it aint a quad at that point, it's an n-gon?  
    Right, well regardless anything with > 3 verts will get triangulated in Medium. However it does a "quick and dirty" triangulation since we are very performance minded with the stamp code. So if you have a mesh that looks like this:

    Medium will take a quad, or n-gon, or whatnot, and may triangulate it like this, just depending on which order it grabs the verts in:

    Which was the case with the above mesh. As you can see, it unfortunately leaves the T-Junction.

    Annoying. If you triangulate it in Blender/Maya/Etc, it'll probably be a bit smarter, and triangulate it like:

    T-Junction annihilated! 

    For now it's just going to be one of those edge cases you have to pay attention to and fix in your editor of choice. We might be able to handle it better in future versions, but no promises since we are under kind of a unique set of constraints.

    Happy to answer any more questions if you have 'em.
Sign In or Register to comment.