godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a geometry nodes-like system (procedural mesh generation) #7505

Open ywmaa opened 1 year ago

ywmaa commented 1 year ago

Describe the project you are working on

any 3D game.

Describe the problem or limitation you are having in your project

no limitations, but maybe a shiny feature

Describe the feature / enhancement and how it helps to overcome the problem or limitation

a system like geometry nodes, should use instances a lot, which will allow for better performance overall, and clever asset reuse, which will allow indie game developers to conserve game disk space.

finally a system like this can make game level design and iterations very easy.

it is like using MultiMeshInstances3D but a lot advanced compared to it.

I can imagine creating a whole terrain system just by using this system.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

if a system like geometry nodes is implemented in Godot Engine, which should use techniques such as instancing, and distribute instances on points, while allowing math just like geometry nodes, finally exposing all custom parameters to property editor.

If this enhancement will not be used often, can it be worked around with a few lines of script?

no it is a whole system.

Is there a reason why this should be core and not an add-on in the asset library?

it can be done as an addon, but I think it will be messy, and hard to maintain.

ywmaa commented 1 year ago

Extra idea, but not related to the main topic, which implementing a system like this, can also allow importing geometry nodes system from blender to Godot's Specific Procedural Generation system

Rytelier commented 1 year ago

Best would be if it was just direct implementation go Blender's geo nodes in editor, so it could work two ways. It would be most suited as a plugin, not project for the main team. There's a plugin like this for Unity https://blendermarket.com/products/bengine-for-unity and I'm waiting for someone to make something like this for Godot.

Calinou commented 1 year ago

Best would be if it was just direct implementation go Blender's geo nodes in editor, so it could work two ways.

Blender is GPL-licensed, so we can't take any code from it. (This is not an issue for a community add-on, but it'll then have to be GPL-licensed, which affects projects that use the add-on.)

According to BEngine's documentation, it avoids having GPL-licensed code in exported projects by making it effective only in the editor, and "freezing" the data before it's exported.

ywmaa commented 1 year ago

I just got another idea for this system, maybe we can just make an internal Godot Engine Class for procedural generation functions, and expose it to GD script, finally the node system will just translate to GD script function to generate the asset.

using this way, maybe the whole generation process will use functions like add_child(), and modify position and rotation.

while the class also provides the advanced function, like distribute points on faces/mesh.

this can also reduce the time of development and maintaing these stuff, since it uses a simple functions that already exists in the Engine.

also can take advantage of GD script already having most math functions

Zireael07 commented 1 year ago

There are several procedural mesh generation assets for godot already. My favorite is jarneson / godot-ply

ywmaa commented 1 year ago

@Zireael07

it looks like a nice addon, but what I mean by procedural generation, is either a code/node based system, not 3D editing tools like blender or 3D max.

and I think a system that edits each vertex each time will be heavy for game engine, unless it precomputes the stuff before using the asset in any game scene.

if I think of a procedural generation system in a game engine, I think it will mainly focus on instancing objects and scattering them + assigning different materials to them.

maybe a lot similar to a GPUParticles System, but a lot flexable and programmable.

Zireael07 commented 1 year ago

unless it precomputes the stuff before using the asset in any game scene.

That's exactly what those generator assets do.

I've been planning to write a code based wrapper for godot-ply (note it CAN be used from code already, it's just a little obtuse to do so)

I think it will mainly focus on instancing objects and scattering them + assigning different materials to them.

Lots of scatter assets on the Godot asset store too, no need to do Blender geometry nodes for this

MirceaKitsune commented 5 months ago

I was looking for answers to the same question and found this. Godot has a node-based shader editor and hopefully visual scripting will return to Godot 4 too in some form: Seeing how powerful geometry nodes are in Blender, it's hard not to think how amazing it would be if Godot had its own geometry node system, with the unique ability to modify properties from GDScript to change in realtime as needed! There are vertex shaders which can be used in visual shaders, but they can't create new geometry or actual 3D shapes only displace existing vertices, also they don't modify collisions since data can't be sent back to the CPU which makes them useless for designing actual levels or complex objects.

https://github.com/GreenCrowDev/hoodie

Seems someone already implemented it on their own: Hoodie does exactly what we're thinking of! Of course it's an external addon, and C++ meaning you need to patch and compile Godot yourself with it; I don't like relying on these since you never know when the developer might abandon them and a future update to Godot can break functionality. It would be amazing if his code could be integrated into vanilla Godot instead!

This would be an amazing feature particularly for procedural levels if you add 3D noise into the mix: Imagine how easy this would make heightmap and even voxel terrains, even generating structures with rooms such as dungeons. Geometry nodes are a powerful technique, supporting them by default would be an extra thing that makes Godot more useful and easy and unique than other engines. Hope this can actually happen and won't become one of the many nice ideas forgotten.

Zireael07 commented 5 months ago

There's at least one other procedural geometry addon I'm aware of

EDIT: And a PR adding support for Blender's geometry nodes: #87735 https://github.com/godotengine/godot/pull/87735

ywmaa commented 5 months ago

EDIT: And a PR adding support for Blender's geometry nodes: #87735 https://github.com/godotengine/godot/pull/87735

well, it is my PR, but it only exports geometry nodes instances correctly as instances for better performance, but it doesn't expose any geometry nodes values from blender, you need to do everything in blender, then import the .blend file.