fLindahl / map-to-gltf

CLI tool for converting .map files to .gltf/.glb
MIT License
21 stars 2 forks source link

Work on CSG union? #4

Open iBoonie opened 3 months ago

iBoonie commented 3 months ago

I see you haven't worked on CSG support yet, but from the readme you plan to (hopefully)? Are there any plans on getting union working anytime soon? I have a project im scoping out, and mesh merging would be amazing to have. I took a look at it in this repo but its over my head on the implementation since it will have to be done all manually.

Before I found this repo I made a 1/2 working implementation using trimesh. Im having trouble with mapping UV's from after the union in my implementation. 61qvk

fLindahl commented 3 months ago

I haven't had plans on implementing CSG union for a while...

I'm not sure how to handle the worldspawn entity, since I mainly use this tool for directly exporting maps to Godot and a custom engine, and having one single gigantic mesh for the worldspawn entity would be hard to vis cull. I might look into it if I find the time. Maybe an idea would be to unionize all entities except the worldspawn, or try to find logical cuts where joining brushes would make sense.

I think that for now, all faces with the same material within the same entity are grouped into one primitive, thus reducing drawcalls somewhat at least.

iBoonie commented 3 months ago

I haven't had plans on implementing CSG union for a while...

Ah thats fine, I was just wondering.

Funny enough Im also working with Godot. One thing that could be a possibility is ignore worldspawn altogether (or add a flag to ignore it), and only process entities. One could manually break up a the mesh in TB by creating a custom class in the FGD. Create all the geometry you want and assign it to the entity and iterate over each one and split based on that. That is unless you want it to be completely automatic, then it would have to be split based on size (kinda like how vbsp does, every x units).