godotengine / godot

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

Subsurface Scattering breaks per-pixel transparency blend modes #76196

Open GK-GreyGhost opened 1 year ago

GK-GreyGhost commented 1 year ago

Godot version

4.0.2

System information

Windows 10, Vulkan / Forward+, Nvidia 2070 Super

Issue description

Enabling Subsurface Scattering on a material causes whole scene to use additive blending instead of mix for opaque materials and additive for transparent materials

image

image

Steps to reproduce

  1. Enable display/window/per_pixel_transparency/allowed in the project settings
  2. Set get_viewport().transparent_bg = true
  3. DisplayServer.window_set_flag(DisplayServer.WINDOW_FLAG_TRANSPARENT, true, 0).
  4. set WorldEnvironment background to Color(0,0,0,0)
  5. create a mesh instance
  6. add material to instance and enable SubsurfaceScattering

Minimal reproduction project

transparent_test.zip

Calinou commented 1 year ago

This likely occurs because the subsurface scattering shader writes to the final scene's alpha channel when it shouldn't.