Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish implementing Canvas Background mode #68805

Merged
merged 1 commit into from
Nov 17, 2022

Conversation

clayjohn
Copy link
Member

Fixes: #52467
Fixes: #67633

It looks like CANVAS_BG wasn't fully implemented. In order to work properly it needed a few extra things:

  1. In render_empty_scene we needed to pass the environment to the renderer
  2. In the RD renderers we need to copy the render target to the render buffer (and convert to linear, this required a bit of refactoring of the copy_to_fb shader). GLES3 doesn't need the copy as it renders 3D and 2D to the same buffer anyway
  3. We need to clear the render target before 3d rendering if a clear is requested and nothing is drawn in the 2D pass

@clayjohn clayjohn added this to the 4.0 milestone Nov 17, 2022
@clayjohn clayjohn requested a review from a team as a code owner November 17, 2022 20:46
@akien-mga akien-mga merged commit a533bd1 into godotengine:master Nov 17, 2022
@akien-mga
Copy link
Member

Thanks!

@pingvoid
Copy link

Hey there, I run into this issue while I tried the v4.0.beta4.official.e6751549c (Vulkan API 1.1.216) on my MacBook M1 Pro (OS: Monterey v12.6). I try to use the env-node in a 2D mobile project and there it causes still the same behavior like its mentioned in the other issue reports (overlaying editor-UI/scene canvas with a grey color as soon as the background mode is switched to canvas). Is this only fixed for 3D or not mobile?

@akien-mga
Copy link
Member

@pingvoid This was merged 6 days ago, while 4.0-beta4 was released 20 days ago, so it's expected that you would still have the bug in the old version.

This fix will be in 4.0-beta6 which will be released later today.

@pingvoid
Copy link

Thank you for your fast response and sorry that I missed this info somehow. ;)

@besh81
Copy link
Contributor

besh81 commented Nov 24, 2022

Hi All, just tested the new Canvas Background mode but it works partially for me.

The 3D editor become unusable as soon as I select WorldEnvironment->Background->Mode->Canvas

Cattura

Instead it works as expected when scene is running:

Cattura2

Edit:
Win 10 22H2
CPU i9 10900
GPU Nvidia Quadro rtx 4000

@clayjohn clayjohn deleted the canvas-bg branch November 24, 2022 21:37
@clayjohn
Copy link
Member Author

Hi All, just tested the new Canvas Background mode but it works partially for me.

The 3D editor become unusable as soon as I select WorldEnvironment->Background->Mode->Canvas

Cattura

Instead it works as expected when scene is running:

Cattura2

Edit: Win 10 22H2 CPU i9 10900 GPU Nvidia Quadro rtx 4000

@besh81 What renderer are you using?

@besh81
Copy link
Contributor

besh81 commented Nov 25, 2022

The above screenshots are with Forward+ but I have the same result with mobile or gl_compatibility

Also tested on a different machine same result:
Win 10 22H2
i5-6600K
Nvidia GTX 1060

Am I doing something wrong ??
I'm using the same scene structure that I always used in 3.x version

@clayjohn
Copy link
Member Author

You are seeing the effects of the thing I thought I fixed in point 3. I must have missed a condition where the render target needs an additional clear

@besh81
Copy link
Contributor

besh81 commented Nov 25, 2022

I understand. Do you think it will be possible to show the canvas in the 3d editor? Maybe with a flag to enable/disable it

@clayjohn
Copy link
Member Author

clayjohn commented Jan 3, 2023

setting background_canvas_max_layer to 1 seems to work around this issue

@vxSpctr
Copy link

vxSpctr commented Jan 11, 2023

Editor becomes unusable for me under similar circunstances, not quite sure if a separate bug report is needed. The workaround suggested (background_canvas_max_layer = 1) does not fix the behavior I have experienced.

Version: v4.0.beta11.official [91713ce]
OS: macOS 12.6.1
Hardware:

  • MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports)
  • Processor: 2.9 GHz Dual-Core Intel Core i5
  • Memory: 8 GB 2133 MHz LPDDR3
  • Graphics: Intel Iris Graphics 550 1536 MB

For me it only happens at the Forward+ Renderer, Mobile and Compatibility are working as expected.

How to Reproduce:

  1. Create 3D environment.
  2. Add CanvasLayer
  3. Inherit Sprite 2D
  4. Add WorldEnvironment
  5. Create Environment and set Background mode as Canvas
  6. Editor becomes unusable.

Minimal reproduce project.
[EDIT] - Minimal reproduction uploaded, just swap the Background Mode from Solid Color to Canvas and editor gets stuck.
CanvasBackgroundBug.zip

@clayjohn
Copy link
Member Author

@vxSpctr please open a bug report if you are experiencing a new issue. This pull request has already been merged so your comment will get lost and forgotten about.

@besh81
Copy link
Contributor

besh81 commented Jan 11, 2023

setting background_canvas_max_layer to 1 seems to work around this issue

In beta9 the suggested work around solve the problem (at least for me) but even better in beta11 everything works as expected without any work around.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment