Closed Gamepro5 closed 6 months ago
I've started looking at automatically generating the index array if it's missing from the source mesh: https://github.com/Calinou/godot/tree/occluderinstance3d-bake-no-index
The code needs to be moved to the right location though as it's not being called properly by the looks of it.
The mesh is being reated in res://addons/cyclops_level_builder/math/convex_volume.gd create_mesh()
. Mesh data is being loaded on line 980. The mesh is being created as an Mesh.PRIMITIVE_TRIANGLES, so it is not indexed. None the less, I was able to export my test scene with 'Export as Godot Scene...' and was able open it and add an OccluderInstance3D. I was then able to press the Bake Occluders button and it completed without any errors. I don't know how I'd verify that the occluders are actually working, but as far as I can tell they are working without any bugs.
I'm not familiar with setting up occluders. Why are you setting a box occluder before baking? Is there a way to see the occluder shapes when you're testing to verify that they're the correct shape?
Why are you setting a box occluder before baking?
This shouldn't be required, as occluder baking will automatically create an ArrayOccluder resource to assign the baked data in.
Is there a way to see the occluder shapes when you're testing to verify that they're the correct shape?
You can see if the shape is correct after baking by enabling occlusion culling in the project settings, then set the debug draw mode to Occlusion Culling Buffer in the 3D viewport's Perspective > Debug Advanced menu. If the shape is correct, the low-resolution buffer you'll see should match the object's shape.
Cyclops is generating indexed meshes now and my tests with baking occluders are working.
Title says it all. Click on a cyclops block and click "export to godot scene". Make an Occluder3D and set the occluder to a box. Make the box take up the entire scene. Enable occlusion culling in your project settings. If you try to Bake Occluders, it will say:
This doesn't make any sense. It doesn't say that when the meshes aren't ArrayMesh.
Edit: After taking to Clay from the Godot rendering team, the ArrayMesh must include both vertices and indices. How are the ArrayMeshes constructed in cyclops?