-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a case for shadows when blur_radius = 0 #22441
Conversation
float distance = length(max(float2(0., 0.), rounded_edge_to_point)) + | ||
min(0., max(rounded_edge_to_point.x, rounded_edge_to_point.y)) - | ||
corner_radius; | ||
alpha = distance <= 0. ? 1. : 0.; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does metal have something like the GLSL smoothstep()
? With appropriate threshold values using that instead of the hard conditional here should fix the aliased edges nicely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I'll take a look!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: nvm, I was reading the way distance
is calculated wrong.
Alternatively a simple alpha = (1.0 - min(1.0, distance * distance))
should look good too.
Blade shaders are directly transcribed from the metal ones so they'll need the same fix. |
I think I feel good about where the metal shader change is now. Going to see if I can get the blade change done next! |
For future reference: It looks like the blade renderer (at least when run on macOS using For now I'll work on fixing Edit: #22711 |
Since this PR makes no structural changes, and the current blade rendering is unchanged, I'll merge this one and open a new PR with the blade changes! |
Closes #22433
Before/After (macOS):
For some reason the non-blurred one seems much lower quality, so we may need to tinker with the samples, or something else.
I'm unsure if this is a problem on Linux/in the Blade renderer, but since no changes were made outside of the medal shaders we can probably take this macOS-specific win for now.
Release Notes:
blur_radius
of 0 would not render.