godotengine / godotengine/godot

Setting a Node's clip_children property to "clip + draw" lower its texture's opacity across the entire texture

Open
#94,672 3 comments 1 reaction 0 assignees View on GitHub
bug confirmed topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.3.beta3.official [82cedc83c]

### System information

Godot v4.3.beta3 - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 (NVIDIA; 32.0.15.5585) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 Threads)

### Issue description

If a Node has a texture with some colors with opacity lower than 1.0, then setting the Node clip_children property to "Clip + draw" lower the opacity value of those colors.
Colors with opacity 1.0 aren't affected.
This only happens if the Node has at least one child, even if that child doesn't overlap the parent at all.

### Steps to reproduce

- Get a texture with some transparency (I edited the box' background in the Godot icon)
- Create a node and load that texture, eg. Sprite2D, TextureRect, ...
- Create a children for that node, eg. Sprite2D
- Set the parent's clip_children property to Clip and Draw
- The texture will become more transparent.

Here is an example :
clip_children = disabled :
![image](https://github.com/user-attachments/assets/6093151e-8611-4aff-94da-4b408be1e000)
clip_children = clip + draw :
![image](https://github.com/user-attachments/assets/55b7b41d-b113-4464-9c52-62222ffd5409)

You can see the transparent color becomes a lot more transparent, and the ColorRect (that isn't a child) becomes brighter as a result.

### Minimal reproduction project (MRP)

[transparency-mrp.zip](https://github.com/user-attachments/files/16353055/transparency-mrp.zip)

Contributor guide

Open the contributing guide

Research direction

Start by running the linked transparency-mrp.zip reproduction with the reported clip_children settings and compare the rendered opacity. Then trace the engine's 2D clipping and draw path for nodes with children; done means partially transparent parent textures retain their opacity when Clip + Draw is enabled.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.