drop shadow

BlitzMax Forums/OpenGL Module/drop shadow

Bremer(Posted 2008) [#1]
I can create a drop shadow by drawing the image/text with the color set to black and offset by a number of pixels. But what if I wanted that shadow to be a soft shadow, without sharp edges?

How could that be done if I needed it to be updated in real time, so when the user changes the object shape, then the drop shadow is updated as well?


Dreamora(Posted 2008) [#2]
the drop shadow could be stored in a type together with the object shape so you can switch them toegher.

The "soft shadow" sounds like drop shadow + scaled drop shadow with alphablend drawn on top of it (or directly a drop shadow that has an alpha fade at its shadow border + alphablend, that would make it soft)


sswift(Posted 2008) [#3]
This is a function I wrote for blurring a texture using 3D acceleration in Blitz 3D:

http://blitzmax.com/codearcs/codearcs.php?code=754

It's not perfect, but it's a start anyway. Basically the idea is you draw a bunch of copies of the object in a corner of the screen with varying levels of transparency, then copy it to a texture and draw your scene with it as you would normally.

This is a crappy way to do it though. I only did it this way myself because there was no other way to do it in Blitz 3D.

What you really want to do for this blur, and those outlines you asked about, is look into pixel shaders. I'm not sure if they can be used with the version of OpenGL which Max uses though, and I have no idea if the version of DirectX it uses supports it either. But that's the fast way, the modern way, and the way you should be doing it, if possible.