Live data from Hacker News

So you think you know box shadows?

dgerrells.com

41–50 of 130 posts

Re: So you think you know box shadows?

#41
post #24
post #23

> However, using a transparent color significantly slowed down the number that can be drawn too which doesn't make as much sense to me. I'd imagine that with hardware today transparency should be somewhat free. That's because transparency limits how you can batch draws on the GPU. With opaque draws, you can use the depth buffer and draw in any order you like e.g. maximizing batching. With transparency, you need to dr…

Can't you mathematically work out how to change the colors/opacity to rearrange the job?

I think there’s still a dependency graph

Re: So you think you know box shadows?

#46

> It also turns out that some smart people figured out maths hacks to draw rounded boxes for super cheap which UI peeps love because with this hack boxes can be so round as to appear as circles Any references to learn more about these hacks?

Some historic articles on software rendering (the original Bill Atkinson stuff) https://www.folklore.org/Round_Rects_Are_Everywhere.html http://wg20.criticalcodestudies.com/index.php?p=/discussion/... A modern 3D accelerated article (using SDF as another commenter suspected) https://mortoray.com/quickly-drawing-a-rounded-rectangle-wit...

I was thinking SDFs and the Bill stuff at time of writing. Read my mind.

Have to add work by Evan Wallace here too as he is a legend.

https://madebyevan.com/shaders/fast-rounded-rectangle-shadow... https://madebyevan.com/webgl-path-tracing/

Re: So you think you know box shadows?

#50
post #28
post #24

Earlier quoted context omitted.

Can't you mathematically work out how to change the colors/opacity to rearrange the job?

Having that knowledge sounds just as expensive if the operations aren't commutative.

Yeah, somehow between comments I forgot this was about shadows and I was thinking more about drawing polygons. In that case, you can break up the polygons and work out the colors for each of the (theoretically 2^N) regions of overlap.
Post reply on HN