Thanks very much for your feedback =). It is highly appreciated.
What do you expect my_object.shader() to even do?
Well... I'm not sure =). My naive guess was that the shader must work with some kind of initial data. So if a Spatial shader runs for the first time, say on a mesh, it must have some kind of input, such as vertices and colors for each vertex, that it then manipulates according to its code. And once it has run an iteration, it must somehow save that data for the next iteration. Otherwise it would just start from the same input every time, which seems inflexible. So I thought that I could provide it with some input somehow, execute the shader once, and then check how its data looks like after that. My initial expectations would be that I could have an object, such as
my_object, that the shader would take as input by for example running my_object.shader() or similar on it.
My initial idea of how to provide input
My thought of how to provide the shader with a texture input would be to give it a
uniform sample3D that I set as a texture3D from GDScript. Then I simply store the output data in the texture through the shader. Do you think that method would work?
Thoughts on your suggestion
I think I understand how to do what you propose. Let me collate to see that I've understood: 1) setup a
Viewport with its own world, with the same dimensions as my texture. 2) Add a
TextureRect as a child to the
Viewport and set its
texture property to my texture. This wiill be the input to the viewport. And 3) wait for the viewport to render one frame, and then grasp the texture's data using viewport.gettexture().getdata().
So far I have two questions:
You can use a Viewport node with its own world and dimensions the same as the texture
How do I set the dimensions of the world? I look into the properties of viewport, such as its world and environment, but I don't find anything connected to dimensions.
It is not possible to force the render to happen immediately though
Is it not possible to force the render through VisualServer.force_draw(...)?