godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.4k stars 21.26k forks source link

Subtractive Blending doesn't work on Compatibility Renderer #99549

Open sstarbright opened 3 days ago

sstarbright commented 3 days ago

Tested versions

I've tested various versions of Godot 4 going all the way back to when the Compatibility Renderer was first added. None of them have correctly rendered subtractive blending. It should be reproducible in any version of Godot 4 with the Compatibility Renderer.

System information

Godot v4.4.dev5 - Windows 10.0.19045 - Multi-window, 3 monitors - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 3070 (NVIDIA; 32.0.15.6094) - AMD Ryzen 7 5800X 8-Core Processor (16 threads)

Issue description

Subtractive Blended Materials show a solid color, instead of blending with whatever is drawn behind. This isn't an issue for Additive or Multiplicative Blended Materials.

In editor, it shows one of your editor theme colors:

Image

In game, it seems to show a solid gray:

Image

Steps to reproduce

  1. Create a project, set to Compatibility Renderer
  2. Open a 3D Scene
  3. Add a Camera3D
  4. Add a MeshInstance3D, with a PlaneMesh rotated towards the Camera
  5. Add a StandardMaterial3D to the MeshInstance3D, Shading Mode set to Unshaded, Blend Mode set to Subtract

Minimal reproduction project (MRP)

N/A

AThousandShips commented 3 days ago

Please upload an MRP to make this easier to test, fix, and confirm:

sstarbright commented 3 days ago

I think I was mistaken. It appears the issue actually has to do with rendering a subtractive blended material in a SubViewport for a ViewportTexture, as I make use of those in my project.

However, it still is broken in Editor as well.

Here is an MRP to test it in v4.4.dev5.official [9e6098432] : SubtractBlending_4.4-dev5.zip

If you open it, you can see it broken in the Editor. When run, you can see that it just displays a grey box. You can adjust the MeshInstance3D's Material to Add, or Multiply and it will work fine. Subtract seems to cause issues.