Displaying subviewport while game is running (or other effective ways of debugging them)

Godot Version



I need a way to debug subviewports to make sure they are working properly. I am trying to run a shader that saves global coordinates on a per-pixel basis to a texture and I want to make sure it’s working properly. I have looked through the documentation and nothing seems to match what I want. Ideally the subviewport exists in it’s own node with resources I can hook into other nodes, so it renders to a texture that another one could display.
Is there a way to do this, or a better way to verify a shader is working as intended? Or a place in the documentation with the stuff I need to get this done.

and if someone suggests to me a goddamn video tutorial i will skin them alive

1 Like

If you want to debug a scene that you want to parent to a subviewport, if I understand correctly, you can work on the scene when it’s deattached of the subviewport, and once you finished you can make it a child of the subviewport.

I’m sorry if you found the reply to be unhelpful, as I have little experience with subviewports.

It’s a little bit like that, but I am just using the SubViewport to run a shader, there isn’t a scene attached to this. I might be going about this wrong.
I have a screenshot below, I want to display the result of the subviewport into the control, and ideally it wouldn’t be parented but if it has to then it is what it is.
I’m trying to do some shader stuff to make a raycasting thing potentially more efficient (and a bit less weird) so I want a separate render to get the depth of every object in the current scene. It’s not the thing I’m directly asking here as I think I’m on track but I need to see the texture I’m generating before I go further, if that makes any sense.
Here’s a screenshot of the scene hierarchy for the player.

If you want to see what the ColorRect displays, make the ColorRect a child of a Control node, and take the Control node outside the subviewport, perhaps this will help?
p.s node name in terezi’s quirk funi

It helps me keep track of what needs to be deleted, it’s surprisingly useful.

Sorry for pestering, have you succeeded in debugging?

Not yet, I’m going to pour over the documentation some time later. I tried doing that but the texture stopped appearing and I am exhausted.

Yes. I get it. The set up is like this. This is called a designer view layout. That’s what you’re trying to create. The SubViewport can contain anything youlike, like a camera, texture, etc. Then you can create a mesh2d to show on the screen. Where you apply the texture as the SubViewport. And you get to see everything going on in the SubViewport. The subviewport is a window node. Window node can be different.

1 Like

This is perfect, thank you! I don’t think I would ever have found that.