I want to render a blank screen for a couple seconds when a task is done. currently i’m swapping all the textures in the environment for blacked out ones, but there must be a simpler way to get a black screen?
I think there was a fadeToBlack function somewhere, but you could just as well:
-set the background black and render.hide() but that’s no good if you have some hidden nodes that you want to keep that way later
-render.setColor(0,0,0,1) to set all nodes to black - but that’s no good with specular shine and glow, and nodes that have vert color
-use a shader -but you’d have to use a shader
-put a black card in render2d that will cover the whole screen (if you use DirectGui you may need to toy with depth sort)
I think that you could also create an intermediary node directly below render, below which you parent your scene, and which you detach when you want it to disappear.
To make a black card covering the window:
cm = CardMaker('black') cm.setFrameFullscreenQuad() card = render2d.attachNewNode(cm.generate()) card.setColor((0, 0, 0, 1))
Then, call card.removeNode() when you want to stop it from being black.
This means that Panda will still render the scene, but cover it with a black card. If you don’t want that, there is actually a better way than calling render.hide(); find the display region that renders the 3D scene, and then deactivate it, something like this:
base.win.setClearColor((0, 0, 0, 1)) base.win.setClearColorActive(True) # Number 0 may not be the main region, may need to try other indices region = base.win.getDisplayRegion(0) region.setActive(False)
That is probably most efficient, since then Panda won’t even consider rendering the scene. If you want the render2d graph to be black as well, you need to do the same for the 2d display region.