godotengine / godotengine/godot

viewport texture pre-multiplied alpha values differ between compatibility and forward+ (compatibility is correct)

Open
#96,047 0 comments 0 reactions 0 assignees View on GitHub
needs testing topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

reproducible in 4.3 stable

### System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 (NVIDIA; 32.0.15.5612) - Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz (8 Threads)

### Issue description

when using a viewport texture with transparency, on a material with pre-multiplied alpha enabled, colours are not correctly pre-multiplied in forward+ mode, but are correct in compatibility.

![premult_issue_img](https://github.com/user-attachments/assets/0318a0a5-7a90-4727-a069-c05d10023eb9)

if this is considered a duplicate of #88603, please keep this report as it is more accurate/concise

### Steps to reproduce

example shows a viewport texture rendering a flat grey colour with gradient transparency, then overlaid back over the same grey.

view the example in 2d mode. in forward+ there is a visible gradient where there should be a flat grey. switch to compatibility and it is flat

### Minimal reproduction project (MRP)

[premult_issue_v2.zip](https://github.com/user-attachments/files/16738075/premult_issue_v2.zip)

Contributor guide

Open the contributing guide

Research direction

Import and run the linked premult_issue_v2.zip minimal reproduction project, then compare its viewport-texture output in Forward+ and Compatibility rendering modes. Trace how viewport textures and pre-multiplied alpha are handled in the two paths; done means the Forward+ result matches Compatibility, with a flat grey overlay and no unintended gradient.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.