How to create a custom texture from a scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Matt_UV
:warning: Old Version Published before Godot 3 was released.

Hello, I have a scene composed of several Node2Ds. Each of them are parent of several Sprites. The goal of my scene is to add variety by randomly showing a Sprite for each Node2D, and hiding the others.
Here is an example :
Here is an example

I would like to save the result as a texture, to repeat in a Polygon2D from my main scene.
However, I don’t want to show the scene, then I cannot use get_viewport().get_screen_capture().

Do you have any idea on how to save the result as a texture ?

If I can’t figure out a way, I will launch the scene and take several screenshots to reuse them afterwhile, but I’d like to do it by code :wink:
Thank you :slight_smile:

Godot Engine - Q&A
How to draw a mask on a Sprite ? - Godot Engine - Q&A

it doesn’t help?

volzhs | 2016-06-09 07:20

Thank you, I already tried the first method, which is not quite adapted, because of “get_screen_capture()”

However the second one seems interesting, I will try it tonight and keep you advised :slight_smile:

Matt_UV | 2016-06-09 10:13

have you ever got anywhere with this? might answer your own question for posterity.

I’m wondering how to draw a custom texture from the ground up, however without using _draw.

Guilherme Furst | 2018-03-01 23:49