0 votes

When i gettexture() on my Viewport and attach it to a Sprite then I have the scene rendered two times (one on the Sprite and one from Viewport rendered on screen).
If I hide ViewportContainer after I get
texture() then the texture is empty.
So far my only workaround is to set position of ViewportContainer somewhere off-screen.

This is my code:

$ViewportContainer.rect_position = Vector2(-1000, 0)
var viewport_texture = $ViewportContainer/Viewport.get_texture()
$Sprite.texture = viewport_texture

The reason I'm doing so is because I want to apply a custom shader on viewport texture. My way to do multipass shader, because there is no multipass shader in Godot.

asked May 2 in Engine by Goral (30 points)
edited May 2 by Goral

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.