Shadow UI elements?

Hi,

I’m wondering if there is any built-in function to create shadows on UI elements, like you find in most modern games. I know that DrawShadowText does something like this for text, but what about for non text elements?

If not, would my best bet be to just pre-create these as images in paint.net?

Thank you.

1 Like

You can use BShadows https://gmod.facepunch.com/f/gmoddev/oaxt/Blue-s-Masks-and-Shadows/1/#postevegt · GitHub

Example usage, the x/y needs to be relative to the screen, you can use Panel:LocalToScreen - Garry's Mod Wiki to get the x, y of the panel.

BSHADOWS.BeginShadow()
surface.SetDrawColor( 255, 0, 0 )
surface.DrawRect( x, y, w, h )
BSHADOWS.EndShadow(intensity, spread, blur, opacity, direction, distance, _shadowOnly)

Blue’s Shadows is quite expensive however. The best option for fps would be to create the textures like you said and disable panel clipping.

1 Like