Describe the project you are working on:
A 3d tile based strategy game that happens to use multi-meshes for tiling since gridmaps don't work for hexagonal layouts.
Pretty sure you can define csg meshes as tiles for gridmaps but in this case i am limited. R.I.P. my project due to Godot not supporting hex gridmaps. 馃槶
Describe the problem or limitation you are having in your project:
I'll have to write a script that removes my multimesh tile instances as they collide with my csg subtraction mesh object that was meant to clip the floors (and subsequently the multimesh floor tiles) of buildings down to the relevant floor so that it is more easily visible to the overhead camera.
This will not look as nice and not be as simple as the subtraction mesh being able to just clip everything.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
It's a multimesh node that works with constructive solid geometry as if it were a csg mesh node. Since that probably isn't feasible to directly edit a multimesh It would be more relevant to my issue to have a feature that 'bakes' a multimesh into a single mesh that i can assign to a csg mesh node.
Or it could be done by a script that detects the geometry of the multimesh and applies an arraymesh that wraps around the multi mesh.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
To dynamically render a multimesh as a single mesh that is affected by csg nodes. Though there are probably more ways than one to go about this.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Unsure but probably not.
Is there a reason why this should be core and not an add-on in the asset library?:
~This seems like it would be a basic function that has been overlooked if there is no reason for this not to be viable.~
Edit: I see that this is not as much of a basic concept as i thought but it would be a useful addition nonetheless.
I'm not sure that this is even possible.
Are you looking for a single CSGMesh that would be instanced thousands of times? Or are you looking to apply CSG operations to the thousands of instances separately?
@clayjohn
The former, and yeah, I'm also skeptical if it's possible.
Depends on how the multi-mesh works.
Do you need csg operations at runtime or just to create the meshes? If the latter, there's a nice bit of script that lets you save csg as mesh, which then means you can use it with the regular multimesh...
@Zireael07 The csg operation has to run dynamically so the former. What you are saying isn't really relevant to the multimesh though, the in-engine fuctionality of the multi-mesh doesn't accommodate for setting it's instances at specific points (for the grid) so that also needs to be done at runtime.
Also there is also no way to use the csg on a multimesh in the first place.
@KnightNine I think what @Zireael07 is getting at is likely the only way that MultiMesh could be combined with CSG. The nature of CSG makes it extremely difficult to use with a MultiMesh. The CSG node needs full information about the Mesh and the transformation (position, scale, rotation). However, the benefit of the MultiMesh is that it uncouples the mesh from its transformation and lets you draw thousands of copies of the same mesh just by specifying individual transformations for each.
Accordingly, the only way the CSG node could work with a MultiMesh is if you took a snapshot of the CSG node at a given time and then used that as an input to the MultiMesh. To me it sounds like Zireal s suggesting that the needed functionality you proposed is already in-engine and you just need to add it to your game using a few lines of code.
@clayjohn I now see how that would work if i wanted all instances of the multimesh to be affected by a csg mesh simultaneously.
What would actually be needed for me would be the reverse of that: to save/"bake" the multimesh as a single mesh so that i could assign it to a csg mesh since i'd require the csg meshes to move through this mesh dynamically.
if there was a way to do that then i could work around it. Unfortunately the csg mesh is constantly moving back and forth through the tile mesh which that suggestion doesn't allow for.
_unrelated note, was wondering if there was a way to do something like this:_ https://godotengine.org/qa/63678/store-collision-space_state-collisions-based-destinct-world
@KnightNine What you are suggesting is impossible. Every instance needs to use an identical mesh. Instancing is a very particular hardware-based technique that draws one mesh thousands of times in a single draw call.
What you need to do is bake thousands of instances of a mesh using your 3D DCC (e.g. blender) and then interact with that mesh using CSG nodes.
@clayjohn
Ah, i see.
Ok multi meshes are off the table but would I possibly be able to merge colliding csg meshes into one uniform mesh and also bake it at runtime? @Zireael07 stated that it was already possible to take a snapshot of a csg nodes and save it as a mesh but does that have to be in-engine? If i could do that during runtime and apply the resulting mesh to a single meshInstance node, then that would work!
This is going a different direction now probably gonna change this request entirely or close it and make another since multimeshes are not relevant to this anymore.
You can do it at runtime, yes - link to the code that does the trick: https://github.com/godotengine/godot/issues/19232#issuecomment-476459435
Most helpful comment
You can do it at runtime, yes - link to the code that does the trick: https://github.com/godotengine/godot/issues/19232#issuecomment-476459435