This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

save a shader as 3d object

fonofono Posts: 45Member

Hallo,

maybe this question is totally silly or out of contest, but i'm asking myself if is possible to save a shader as a
static 3d object. If yes where should i look? Let's say i want to save what i currently see on the screen (only shader content
as a 3d object. Maybe deciding first a capture Volume that save the current 3d structure generated by the shader
itself.

Thanks

Comments

  • SIsilicon28SIsilicon28 Posts: 693Moderator

    ???
    Sorry, I don't understand the problem. A shader isn't a 3D object by itself. Concerning graphics APIs, a shader is just a program that runs on mesh data (vertices, triangles, etc...).

  • fonofono Posts: 45Member

    ok,

    so is impossible to use a 3d shader as terrain / levels generator.
    Sorry if the question maybe sound stupid. I'm currently exploring what can be done
    with shader and reading a book about them. Really at the beginnning.

    Thanks

  • MegalomaniakMegalomaniak Posts: 2,580Admin

    Well, not a shader alone, no. But if you google there's plenty of tutorials on generating a terrain and even some opensourced plugins around that add a new node that can be created in the node tree.

  • SIsilicon28SIsilicon28 Posts: 693Moderator

    Yes, usually it's more mesh work than shader work.

  • cyberealitycybereality Posts: 928Moderator

    Saving a shader might be possible if you can format that data as a fullscreen image (for example a height map for a terrain). Then get the viewport as a texture and save that to a file. I think that could work.

    The other option would be to use MeshDataTool, which is not a shader, but you can modify a mesh, move vertices around, change properties like normal or vertex color, etc. This would be in the scripting code (like GDScript), so you should be able to save that to a sort of text file and load it up later.

  • ZylannZylann Posts: 31Member
    edited May 2020

    The terrain generator from my plugin works exclusively using shaders, it uses a Viewport node to then capture the results back into images (which is actually the only thing you can get back from a shader atm).
    In Godot 4 you may be able to do more general stuff with compute shaders.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.