Godot-proposals: Integrate CGAL to replace the built-in CSG module

Created on 29 Jun 2020  路  10Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
Project with complex geometry (destruction), procedual, CSG, But this proposal affect to all projects and usability.
Describe the problem or limitation you are having in your project:
I have CSG bugs and limitations, and additional need many special algoritms for work, and try avoid use GDNative\C#\Direct use source code.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Maybe integrate CGAL ? It have a lot of stuff cool features -
https://doc.cgal.org/latest/Manual/packages.html
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
Integrate in "core" and expose this functions on code(GDScript, C#) and probality in editor.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Often, and this algoritms need native speed and direct access to raw internal data(avoid overhead and copy-paste data, vertex, meshes (core -> C#/GDScript/GDNative -> core) )
Is there a reason why this should be core and not an add-on in the asset library?:
This tools(algoritms) is very usability and probality allways use in games and it can be used to make cool stuff
Example -
2D Regularized Boolean Set-Operations
2D Boolean Operations on Nef Polygons
2D Boolean Operations on Nef Polygons Embedded on the Sphere
2D Polygon Partitioning - _The algorithms can produce results with the minimal number of polygons_
2D Visibility Computation - very usable in game industry
2D Placement of Streamlines
Triangulated Surface Mesh Segmentation - if combine with Deformation, and procedual skeletal(bones) generation, split surfaces for materials ...
Triangulated Surface Mesh Simplification - auto LOD?
Triangulated Surface Mesh Deformation - this soft word "deform"...
Triangulated Surface Mesh Shortest Paths
Optimal Distances
.... and many others useful algoritms from this library.
P.S. and this solve problems with CSG

archived core

Most helpful comment

CGAL was investigated by reduz, but it wasn't integrated because of its complexity, its gearing towards CAD applications (rather than games) and its license. This is why he ended up writing a custom CSG implementation for Godot.

All 10 comments

CGAL was investigated by reduz, but it wasn't integrated because of its complexity, its gearing towards CAD applications (rather than games) and its license. This is why he ended up writing a custom CSG implementation for Godot.

2D Polygon Partitioning - The algorithms can produce results with the minimal number of polygons

Godot does have an ability to do this in C++ (via PolyPartition library), but no functionality is exposed to scripting.

I'm developing a module which does expose Triangulate_OPT and ConvexPartition_OPT types in the Goost Geometry component.

And yeah I've stumbled upon CGAL once, and the license is not compatible with Godot's license which is more permissive.

Of course that doesn't eliminate the bugs currently present with CSG system in Godot, but I'm not sure whether we can find a permissive geometry library out there anyways, so what's left is fixing bugs...

Since CGAL has a license incompatible with Godot Engine. I petition this issue to be closed since Godot Engine will never be under GPL variations.

CGAL was investigated by reduz, but it wasn't integrated because of its complexity, its gearing towards CAD applications (rather than games) and its license. This is why he ended up writing a custom CSG implementation for Godot.

70% algoritms of this lib useful in games(conmbinations, not direct use and not standart use). Probality not need full integration and change core - need internal and external api. Example: when call func "Optimal Distances" - then core transfer mesh data pointer* to CGAL function and generate internal structure(new node(new navigation)?) or return result to user.

_License_ - i not sure, but [LGPL can used in MIT project] (https://opensource.stackexchange.com/questions/6405/lgpl-licensed-code-reuse-in-mit-licensed-project)

The easiest way to handle the code and its copying seems to me to be to keep all the LGPL-derived code in separate source file(s), which clearly state at the top the original authors' and your copyrights, and that the files are licensed under LGPL.

  • you have modules with different licenses, why not just put CGAL in "thirdparty" folder or dlls? Not need integrate in core source.
    And probality you can contact with GeometryFactory. to solve this issue. Probality CGAL commutity will be happy to help integrate this lib in godot - he get powerfull editor - application base. (example, in most cases i use godot not for games, but for applications and prototyping - powerfull gui and fast, clear develop, animation editor, live time scripting, make editor tools in editor (keyword "tool"), good graphics with shaders, crossplatform...)

And why you rename topic to CSG? it about many algoritms of CGAL - 2d CSG, Optimal Distances, Triangulated Surface... Triangulated Surface Mesh Simplification - resolve problem with auto LOD and etc.

@SuperDIMMaX We don't want to integrate LGPL-licensed libraries as we want people to be able to use Godot on iOS, which forbids dynamic linking.

Ok.
If we talk about CSG and MIT license -> How about this?

Edit: probality not need #https://github.com/godotengine/godot/pull/39956

If we talk about CSG and MIT license -> How about this?

That library is written in Swift. We can only use libraries written in C or C++.

If we talk about CSG and MIT license -> How about this?

That library is written in Swift. We can only use libraries written in C or C++.

Not hard to rewrite, this is not big and complex project... func, var... gdscript :) ?

I have question and not shure about this topic, it more general... about licenses...
Another words, i can`t make project with Godot and CGAL even i can show sources of modifed version CGAL?
And then how integrate alien code in Godot with different license?
I allways think, my code LGPL if i copy LGPL code in project code, but if i not use it derectly in code(GPL source code is external) and use API, then this is not problem. Another words: project->engine->API->CGAL
This is actual question, and probality need in FAQ

P.S. i know, this is offtopic, but... actual license quection:
I have reqest to develop special software for lift maintenance services, and i need visualisation of wires, routers, lift parts, and more complex systems... and i need ... CAD functions? (i found only CGAL for my needs, it contain interesting functions) , and i planed not publish my code in LGPL(can`t :( ), but it use CGAL code... not directly, as external API.
I found many project with MIT and he used CGAL...
I realy not full understand how and why it works :/
You mean this problem?

Edit: You can use LGPL in closed sources on iOS link
Edit: LGPL != GPL and LGPLv3 != LGPLv2.1

This proposal more general, not only CGAL and CSG, and main idea - integrate useful algoritms as base(many exist in Godot, but as part of functions and internal) and make combinations func_1(){algoritm_1} func_2(){algoritm_2} func_3(){func_1 + func_2})
I talk about CGAL, because it have many seperate algotims and it can be combine to get example: NavigationMesh and from any mesh - Navigation, and it can be used for make optimal geometry(severals exist as part of Navigation generation), auto LOD, procedual geometry deforming(CSG and etc) (exist severals functions(algoritms) in seperate nodes(but this internal))... and this is affected not only procedual and 3D.
Now you have many nodes - mesh_array, surface tool, mesh data tool, navigation mesh, navigation and functions in nodes and internal code part... and this API not frendly, but if API more like CGAL, then you and users get more powerfull tools and API, - code reuse, faster develop, easy fix bugs, more perfomance.

Closing, as we cannot accept a LGPL-licensed library into Godot's core. See this page for detailed rationale.

That said, nothing prevents a third party from implementing it as a C++ module or a GDNative add-on. In this case, users will still have to follow LGPL obligations when using the module in question, even if the module itself uses a more permissive license like MIT.

Was this page helpful?
0 / 5 - 0 ratings