Fix unintended frustum culling
When view some models in scene import settings dialog, the subviewport will have some unintended frustum culling.
Adding a custom aabb for the preview fix this bug.
The frustum culling fix is queued to be reviewed in 4.4.
This makes sense as a temporary solution, but I don't know why frustum culling would break in the first place. Is this because skinned meshes skip generating an AABB before being imported for some reason? I thought the advanced import settings dialog already imported the mesh once, with the AABB being set at import-time as an optimization (so it doesn't need to be generated by RenderingServer every frame).
PS: I think we have a dedicated RenderingServer method to disable frustum culling for a specific node entirely, or do we? This would be more reliable than using a large magic number.
@Calinou I've seen this. The AABB on skinned meshes seems wrong until the first update skeleton (e.g. if you rotate a bone and then undo). This could be the bug.
I wonder if this is a rendering server bug since I'm not sure how the AABB can get desynced, or as a hack, if there is a way to manually force an update on all skeletons during import or upon loading a scn
This makes sense as a temporary solution, but I don't know why frustum culling would break in the first place. Is this because skinned meshes skip generating an AABB before being imported for some reason? I thought the advanced import settings dialog already imported the mesh once, with the AABB being set at import-time as an optimization (so it doesn't need to be generated by RenderingServer every frame).
PS: I think we have a dedicated RenderingServer method to disable frustum culling for a specific node entirely, or do we? This would be more reliable than using a large magic number.
I dont think this is a problem of AABB. Initially I thought this was a problem of AABB but later I add
auto show_aabb = [=](AABB aabb){
MeshInstance3D* a = memnew(MeshInstance3D);
auto box = memnew(BoxMesh);
box->set_size(aabb.get_size());
a->set_mesh(box);
a->set_global_position(aabb.get_position()+aabb.get_size()/2.);
a->set_transparency(.5);
mesh_preview->get_parent()->add_child(a);
};
show_aabb(mesh_preview->get_aabb());
before scene_import_settings.cpp line 882 I got this
It seems the AABB generation is coreect. There's an error after adding the code node_3d.cpp:345 - Condition "!is_inside_tree()" is true. Returning: Transform3D() from get_position(). If there's better way of debugging the AABB plz let me know.
I think I've found the function for disabling the culling: RenderingServer.instance_set_ignore_culling. I'll make changes to the commit later.
@Calinou I've seen this. The AABB on skinned meshes seems wrong until the first update skeleton (e.g. if you rotate a bone and then undo). This could be the bug.
I wonder if this is a rendering server bug since I'm not sure how the AABB can get desynced, or as a hack, if there is a way to manually force an update on all skeletons during import or upon loading a scn
Can you give me a way of editing the bones in this dialog? This bug only happens in this dialog. If I place this model into the scene, it works well.
This bug still exists in this commit. any update?
I don't think this is the correct fix. We need to figure why the mesh is getting incorrectly culled and then resolve the problem at the source instead of simply disabling culling.
In general, we don't merge PRs until we are happy that they are the correct fix for a problem
hmm... thanks for your reply. i will try to fix it myself.