Is it possible to generate vertex buffer with compute shader in godot 4?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SanSeiU

Say I want to generate a grass land, all grass vertices are generated in compute shader. And I want to use the generated vertex buffer to render. Of course I can send data back to cpu, and use it to fill an array mesh. But that`s not efficient. Is there any way to use the data directly in gpu?

:bust_in_silhouette: Reply From: LordBoots

I’m actually quite certain I saw something on this exact topic on Youtube yesterday when researching grass shaders.

Just googled it now and it does appear that compute and vertex shaders are fully implemented.

The most efficient method I’ve seen is to model a simple grass blade and then use an array mesh and a shader to get the behavior you’d like. You could most definitely use compute shaders but as you said the overhead might be a little much depending on how large you’re trying to scale up.