Godot Version
4.3
Question
How to implement a CompositorEffect
with a draw list, not a compute list?
Details
I am learning to use the Compositor
and I’ve already got compute shaders working with it. But now I want to try implementing custom drawing (rasterization of vector shapes and text) as a CompositorEffect
. So that I can plug it into the Compositor
, and apply some other CompositorEffect
on top (e.g. change brightness).
Should I use RenderingDevice
’s draw_list and render_pipeline in the _render_callback()
to achieve my goal? If yes, then how to do that? I’ve found the example in the docs describing a “simple drawing operation”. But what is it drawing, just transparent colors? Where to does it draw these colors? It says that draw_list_begin()
“Starts a list of raster drawing commands created with the draw_*
methods.” I’ve found how to use draw_*()
in custom drawing, but how to connect these functions to draw_list? Where to place them? Also, how to initialize the render pipeline, or raster_pipeline
in the case of the docs code snippet. render_pipeline_create()
has 11 arguments; and I don’t understand how to properly assign most of them. The unclearest ones for now:
vertex_format
–vertex_format_create()
requires an array ofRDVertexAttribute
which lack documentation,primitive
– say, how to draw an arc or text if there are no similar entries in theRenderPrimitive
?shader
– what kind of shader does it want?
So, I’ve got plenty of questions, and I don’t even know where to start reading up. I haven’t found comprehensive tutorials about render_pipelines and draw_lists but maybe you’ve found/prepared/recorded some? Maybe there are some clear demos using these? Or maybe you’ve got some general ideas on implementing a drawing CompositorEffect
? Any advice/suggestion/lead is appreciated!