Tesselation or Geometry Shader in Godot 3
Asked Answered
D

11

0

Is there any possibility to make use of the tesselation or geometry shader stages in Godot 3?
I'm trying to write a plugin to procedurally generate trees with adaptive LOD. For good performance I think it would be best to solve this on the gpu preferably in the tesselation shaders or alternatively in the geometry stage however I didn't find any possibility to do so yet.

I also thought about using compute shaders but from what I could see they will only be available in Godot 4 using Vulcan.

Any help or ideas on that topic would be very welcome!

Thanks in advance,
Mocca

PS: If need be I might also look into Godot 4 and Vulkan, but as I don't have much experience with either and since Godot 4 is still in alpha, any option in Godot 3 would be preffered.

Declinature answered 24/6, 2022 at 17:25 Comment(0)
P
0

No tesselation, geometry or mesh shaders in godot 3/GLES 3. Vulkan would have it, but afaik godot shader language in 4.0 does not implement any of it yet(if ever). Whatever you want to do with them would likely have to be done as a gdextension.

Paton answered 24/6, 2022 at 19:29 Comment(0)
E
0

No, I don't think it's supported. You can create geometry with code, but it's done on the CPU.

Electroencephalograph answered 24/6, 2022 at 19:42 Comment(0)
D
0

Paton hm okay thanks for the reply, could you elaborate on the gdextensions or do you have any advice on how to best get started with them?

Declinature answered 25/6, 2022 at 8:55 Comment(0)
D
0

Paton Thanks! And last question: Do you know any resources (tutorials/references) for GDNative/GDExtionsions or even Modules for extending the graphical funtionality of Godot? Anything that could help me get a better grasp of how I could achieve what I want. You've already been a great help so thanks for that, as I'm relatively new to this I'm just looking for a good place to get started.

Declinature answered 25/6, 2022 at 9:50 Comment(0)
T
0

Declinature

The chapter starts here:
https://docs.godotengine.org/en/latest/development/compiling/index.html

Extensions are not yet covered, 4.0 is in alpha and breaking changes are still expected.

Trainer answered 25/6, 2022 at 10:17 Comment(0)
P
0

Declinature The trouble here is that godot 4.0 is still in development and new things like this might not yet be very well documented. Your best bet might be to ask on godot contributors chat when it's not particularly busy(i.e. some meeting going on), the developers might very well welcome some feedback from people actually using and testing the new thing as well.

Also, I'm not too sure but some of the developers might be active on matrix and also there's some few developers that might occasionally check in on the forum here such as Housewifely

Paton answered 25/6, 2022 at 11:26 Comment(0)
D
0

Okay thank you very much for the tip!
I'll look a bit more into the documentation and then try my luck there. 🙌

Declinature answered 25/6, 2022 at 13:10 Comment(0)
E
0

You might want to try to do it with GDScript and then see if performance is okay and use that to port to C++ later if you need it to be faster.
https://docs.godotengine.org/en/stable/tutorials/3d/procedural_geometry/index.html

Electroencephalograph answered 25/6, 2022 at 14:27 Comment(0)
D
0

Electroencephalograph
Thanks, yeah that's kind of what I'm doing at the moment, I just planned to move the generation on the gpu for scaling later on as I suspect it would get quite troublesome with a larger amount of trees otherwise.

Declinature answered 28/6, 2022 at 10:44 Comment(0)
T
0

Talking about graphics api, one can do it in the geometry stage, or in a vertex shader, and give it the look of diversity and randomness, even a systematic influence and movement like wind would have, by offsetting a mesh via texture lookups.

Basis would be just a few meshes, a deciduous tree, coniferous tree, one or two fruit trees, one can introduce variation through colour, size, rotation, bending. That's very fast, it wouldn't much affect the performance even if thousands of objects where rendered that way, as long as they aren't too complicated and one can do it in a single draw call through instancing, which GLES3 supports, I think.

See the basic example of a grass field, but this can be taken much farther of course.

Hope this isn't too much over engineering :-)

GPU tessellation has disadvantages, it is relatively limited in its functionality, and it doesn't really generate geometry. The above is much more flexible.

Trainer answered 28/6, 2022 at 21:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.