Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer Masks Set to Erroneous Value Regardless of Import Settings #100

Open
stultvox opened this issue Mar 18, 2024 · 1 comment
Open

Layer Masks Set to Erroneous Value Regardless of Import Settings #100

stultvox opened this issue Mar 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@stultvox
Copy link

When a VRM model is imported, with only layer 1 selected, the model loads as if only layer 3 is selected.

At first, the only thing I noticed was that the lighting was not behaving as expected on the imported VRM models.
When I iterated through the MeshInstance3D objects in the VRM and printed the values for each layer, that's when I found it was all set to 3.
VRM_LayerBug

I did attempt reimporting the model with different layer settings. None of them seemed to make a difference in the outcome.
I also recalled that I had previously imported a gltf with the layer 3 set to true. So I imported another gltf file with the layer set to 1, and then imported a new VRM model, and it was still set to 3. So I do not believed it's picking it up from other imported gltf files.

I was able to work around the issue by iterating through all the layers in each MeshInstance3D for each VRM model, set them all to false, then set layer 1 (the desired layer) to true, placing that code in the ready function for the scene. It's not ideal, but it does work.

all_children = get_all_children($Characters)
for _i in all_children:
    if _i is MeshInstance3D:
        for _y in range(1,21):
            _i.set_layer_mask_value(_y,false)
        _i.set_layer_mask_value(1,true)
@lyuma
Copy link
Member

lyuma commented Sep 14, 2024

Yeah the head hiding behavior needs to be an import setting. Originally, we didn't know how to create additional import settings, but later we found out that it is possible to combine an EditorScenePostImportPlugin together with an EditorSceneImporter to allow for settings.

Those layer settings are a relatively new addition and I haven't considered how to work with it yet.

The point of assigning layers 2 and 3 was to allow the application to control the visibility of models depending on if you are playing in first or third person. but this is very poorly documented and not configurable.

The issue with setting all meshes to layer 1 manually is you don't want to display both the head and the headless version of the model at the same time, since that will cause z fighting or extra performance overhead.

@fire fire added the bug Something isn't working label Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants