Primitive feather edges?

E

EWR

Guest
Hi Guys!

I'm currently working on drawing 2d shadows for my game. My shadows are drawn as primitives (trianglelist).
This works great for hard shadows.
I would love to soften the edges of my primitves so I can create "soft shadows". What's the best approach for doing this?

Thanks!


:pickle:
 

Attachments

jo-thijs

Member
Hi and welcome to the GMC!

I'm not sure what the best approach would be,
but you could divide the 2 quadrilaterals of the shadows
into a lot of adjacent quadrilaterals
and draw all of those quadrilaterals in a for loop with varying alpha values.

This is not a very performant method though.
A better solution is probably to use shaders.
Using those, you can easilly control the alpha value of every individual pixel.
 
Top