My camera draws a box over the background. How do I prevent this?
Been a while since you posted, welcome back!
I don’t use Godot, but until a more experienced person comes along, I found a checklist for this issue that could help:
- Camera Settings: Make sure the camera’s properties are set correctly. Check the following properties:
- Clear Mode: Ensure that the “Clear Mode” property of the Camera is set to “Only Depth.” This prevents the camera from clearing the background color.
- Background Mode: Set the “Background Mode” property to “Transparent” if your game needs a transparent background.
- Viewport Background: Check the background color of the viewport. If you have a color set for the viewport background, it may be interfering with the camera’s rendering. Set the viewport background color to transparent if needed.
- Layer Visibility: Verify the layer visibility in the Camera2D node. If you have other objects or layers that are drawing over the background, adjust the layer visibility or order to ensure the background is rendered first.
- Z-Index: Check the Z-index of your camera and other objects. Ensure that the camera has a lower Z-index than the background or any other nodes that should appear behind the camera.
- Shader Issues: If you are using shaders, inspect your shader code. A shader might be altering the rendering in a way that creates the undesired box effect.
- Canvas Layers: If you are using CanvasLayers, ensure that the layers are arranged correctly. The CanvasLayer with the background should be behind the one with the camera.
- Update Godot: Ensure you are using the latest version of Godot. Sometimes, issues get resolved in newer versions.
- Viewport Rect: Check the “Viewport Rect” property of the Camera2D. Make sure it covers the entire viewport and isn’t set to a smaller area unintentionally.
By going through these steps, you should be able to identify and resolve the issue with the camera drawing a box over the background in Godot. If the problem persists, you may want to provide more details or share relevant parts of your code for further assistance if a teaching assistant comes by.
Hope this helps!
Hi Donald,
its hard to tell whats happening from a small screenshot of the window.
is the grey box only showing when you play the game or is it showing in the editor?
if its showing in the editor, im wondering if it might be worth, trying to hide each node in the game scene and try and track down what node specifically is causing the box.
if its only happening when the game is runnning. im not sure.
i would like to have a look at your project if i may to see if i can track it down.
if you could zip your project folder up and pop it online somewhere so that i can download and have a look. hopefully i can find out what it is and get back to you asap
Darren
Update: It seems connected to my computer’s video capabilities. I’m using a school issued laptop with intel UHD 620 but using the exact same project at home on a better computer doesn’t have the graphics glitch. Weird.
ah, might be worth changing the rendering from Forward+ to Compatability just to test, this will use OpenGL instead of the forward renderers Vulkan.
hopefully theres a happy meduim where you can worth through the lectures on both machines with the same output.
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.