godotengine / godot

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

Button shadow render not right #49870

Open yikescloud opened 3 years ago

yikescloud commented 3 years ago

Godot version

3.3 stable

System information

windows10 GLES2/GLES3

Issue description

image Alpha of center of the button shadow is a bit lower than the edge, you can see there is a slight black line of the shadow . This will cause a light line appear when add a offset to the shadow image image

Steps to reproduce

Add a button and enable the shadow.

Minimal reproduction project

ButtonShadow.zip

No response

Calinou commented 3 years ago

@firecloud888 Please upload a minimal reproduction project to make this easier to troubleshoot.

timothyqiu commented 2 years ago

I think this is just a visual illusion. I took a screenshot and measured the colors. The pixel color at the "dark line" is the same as pixels above it (#666666).

akien-mga commented 2 years ago

@timothyqiu I think the alpha channel can still be different and make it blend more or less white from the background.

timothyqiu commented 2 years ago

I'm not sure. I think the color I measured is from the rendered image, i.e. after the blend.


To make sure, I made a ColorRect that has the same color as the blended shadow. And then I unchecked the "Draw Center" of the button's stylebox so that the button won't draw anything except the shadow gradient.

I moved the ColorRect to touch the shadow, making sure they don't overlap, but there still seems to be a dark line:

https://user-images.githubusercontent.com/372476/148646051-257aa516-7589-44fe-b308-15d3dda50cf2.mp4

Also, check inside the circular area inside the letter "D"...

Here is a image I created in GIMP. It has a white background layer and a top gradient layer (from gray to transparent). There seems to be a dark line too. But the color picker says it's a normal gradient. gradient

So I think this is an optical illusion.