Hello everyone, I want to make the output of a script attached to my control node visible without any background, however I get the clear color as the background. The control node is the child of a subviewport and I use the subviewport texture to render the output to a plane. I've already tried the flag "transparent bg" in the subviewport but it renders completely black if I do that. Does anyone have any ideas on how to fix this?
#Transparency Problem With Viewport Texture
1 messages · Page 1 of 1 (latest)
Thanks I'll try that but I thought that there would be an alternative way to control the background from the nodes in the scene
You`re welcome
when I tried this it still shows the color instead of being transparent unfortunately
Can you please show me a screenshot of the issue
right now it's showing this but I want to only show the graph and make the background transparent
the graph is the output of a script attached to the control node
So the part that`s grey, its supposed to be transparent in that part?
yes
so that it looks like the graph is floating in 3d space
Maybe this will help:
https://forum.godotengine.org/t/transparent-background-so-that-desktop-is-visible/23124
Godot Forum
ℹ Attention Topic was automatically imported from the old Question2Answer platform. 👤 Asked By Sharon I want to render my game with a transparent background/no background at all so that my desktop of my computer is visible behind the game, is there a way to make that possible? Thank you? Window transparency is usually controlled by the w...
I appreciate the help a lot but I don't think that's what I'm looking for. Here is the full picture of how it looks in game right now. I would like to make the grey part transparent to get the float effect but not actually make what I'm doing in the computer outside of the game visible
yes I tried that I enabled transparent background here in the viewport
No, on the control node
I'm sorry but I don't see the setting here
the mesh has the viewport texture yes
Try looking for a transparency setting there
hmmm there is a transparency setting but when I turn it completely to 1 it's invisible
So if you put the transparenncy to 1 the graph dissapears too?
Alright
Does the graph texture have a grey background?
Like, in the part of the editor that says filesystem
Bottom left by default
I don't save the graph as a texture it's calculated when I hit play
and it's drawn with the draw function
it's supposed to continually change in the game
I think that the graph might be inheriting the transparency of the mesh
Is the thing being drawn on the mesg
Is the graph drawn on the mesh
you can have the full script here:
extends Control
var num_nodes: int = 5 # Default number of nodes
var node_positions: Array = []
var connections: Array = []
func _ready():
_generate_graph()
queue_redraw() # Request a redraw
func _generate_graph():
# Generate positions for nodes in a circle layout
node_positions.clear()
connections.clear()
var radius = min(size.x, size.y) * 0.4 # Adjust as needed
var center = Vector2(size.x / 2, size.y / 2)
for i in range(num_nodes):
var angle = i * TAU / num_nodes
var position = center + Vector2(cos(angle), sin(angle)) * radius
node_positions.append(position)
# Generate connections (edges) between nodes (e.g., connecting each node to the next)
for i in range(num_nodes):
connections.append([i, (i + 1) % num_nodes]) # Creates a circular graph
func _draw():
# Draw connections
for conn in connections:
var from_pos = node_positions[conn[0]]
var to_pos = node_positions[conn[1]]
draw_line(from_pos, to_pos, Color.BLACK, 2)
# Draw nodes
for pos in node_positions:
draw_circle(pos, 10, Color.BLACK)
func set_num_nodes(n):
num_nodes = n
_generate_graph()
queue_redraw()
it's not drawn on the mesh it's attached to the control node
I think that because the mesh is transparent, it makes the subViewport inherit that, and then its passed down to the Control, making the graph invisible
Do you see any things on the control node about visibility?
these are the settings I see
I've just tried using top level and transparent bg in wiewport together I got my hopes up but it didn't work...
Maybe put show behind parent on the mesh
Wait, why does the mesh even exist
Isnt that what`s making the grey square
the mesh is supposed to display the viewport texture
the albedo is set to viewport texture
the mesh is the default godot plane and it's supposed to be white by default
so my guess is that it's the viewport
What happens if you make the subviewport a child of the node3d and remove the mesh
What if you make the control a child of the node3d and get rid of the subviewport
but the way it's being rendered in the mesh is as a subviewporttexture here
yes but then the graph can't appear
it looks grey but the only thing I can do is set the subviewport node there