Neos-Metaverse / NeosPublic

A public issue/wiki only repository for the NeosVR project
196 stars 9 forks source link

obj files with multiple objects named the same will become merged on import #1733

Closed mralext20 closed 3 years ago

mralext20 commented 3 years ago

Describe the bug

A user in discord came to the bugs channel with intigreation issues involving Anyland. Anyland exports OBJ files with multiple objects named the same. a simple reproduction case is attached bellow.

To Reproduce

import this obj file: https://cdn.discordapp.com/attachments/439422161657135106/808616470732603392/untitled.obj observe that the two cubes are glued together

Expected behavior

multiple cubes, seperately imported together.

Screenshots / Video

reimported into blender: imported into neos:

Bug information (please complete the following information):

Additional context

some messing about with pyassimp leads me to believe that this is indeed a neos issue, not assimp.

Reporters:

Dirk#3000, logged to github by Alex from Alaska#2020

mralext20 commented 3 years ago

follows is the conversation in discord pretaining to this issue: from https://discord.com/channels/402159838827905024/439422161657135106/808612041778266122

I've been having an issue with importing .OBJs which I have exported from Anyland. Neos appears to be merging certain pieces/meshes that make up the object which should be separate pieces. I know this is a Neos issue because when I dropped the OBJ into an online OBJ editor for testing, all the separate pieces were separate as intended with no randomly merged pieces. From my testing, it would appear to be based on the pieces having the same name, thus Neos thinking they are one mesh or something along those lines.

This is really unfortunate because I love the VR modeling workflow of Anyland, and would love to easily be able to use the OBJs that can be exported from it. I contacted Philipp, the dev of Anyland, about this issue and his response was "Would you mind asking the NeosVR dev why they merge it? I.e. if it's related to same-naming, or something else?"

has also provided a example file of their own: https://cdn.discordapp.com/attachments/439422161657135106/808631486386274314/thing-2021-01-24-05-53-32.obj

Frooxius commented 3 years ago

This is a bit tricky. The reason they are merged is because this is how submeshes work - they have multiple meshes on the same node (which is determined by having the name here). If you check the imported sample object in Neos, you can actually see it has two materials, one "Material" and one "Material.001". If you inspect the mesh, you can see there are two submeshes:

image

If they are functionally two different objects, they shouldn't be named the same. The import process in Neos could be adjusted so it treats submeshes as separate entities, but it would have to be optional setting, otherwise this would break a lot of existing imports - any mesh that has multiple material slots (avatars, 3D scans with multiple textures and so on) works the same - there are separate mesh entities bound to the same node with the same name.

Without this behavior the imported model would end up being a lot of separate objects, each with a single material, which is not optimal in most cases.

Would the setting to override this behavior suffice as a solution?

Dirko3000 commented 3 years ago

That would be a perfect solution as anyland is a game where everything is made of individual parts that can be scripted independently to do things and animate. I wish to use my anyland models and do the same in neos, so if it allowed them to stay separate and be coloured and moved independently like in anyland, that would be 100% perfect.

I have a number of Anyland players I have been trying to get to try neos, and their anyland creations not working properly has been a bit of a turn-off.

Many of them have hundreds or over a thousand hours (such as me) in the game, which is obviously a lot of asset investment in a creation-oriented game.

Frooxius commented 3 years ago

In 2021.2.21.1425 I've added new "Split Submeshes" option to the Advanced Model import settings that you can use to deal with this problem. I strongly recommend only using it when encountering this particular, as it will interfere with other models (e.g. ones that come with animations and such), but I hope it helps with the imports from Anyland!