Posted by: pixelero | March 11, 2008

simple 3D-effect by using BlendMode.LIGHTEN

Here’s my simple 3D-trick (or 2.5D, I know) using the color value as a z-value in 3D-space:
– to start with we have circular sprites, I’ve used a radial gradient fill, with values 0x00 around edges and 0xFF at the center,
with blendMode.NORMAL looking like this:

– when changed to BlendMode.LIGHTEN, on the area where the sprites overlap, we get this

Yes, looks like the sprites really had depth.
From the color values blendMode.LIGHTEN chooses the brighter, or as a number, larger one, like max(a,b),
or like we were having a z-buffered rendering, imaging having more sprites – kind of a voronoi mountain !

After adding some filtering ephasizing the 3D-effect and adding the color tones, we end up having this:

Although we’re limited to a very narrow depth in z-scale as well as a very limited number of colors – only 256 shades or levels, I found this method rather interesting in all its simplicity.

Here’s some results I came up with:

At the bottom of that there’s a text – may not be the best use of textField-input, but try typing something…
I don’t know if it’s for any use for anyone – but here’s the source code

Another – why always spheres ? Here’s a ‘pillow surface’ z = (1.0-x²)(1.0-y²) in range -1.0..x..1.0 and -1.0..y..1.0, used:

(reminds me of some old ’80’s computer game, should I add a penguin jumping from one block to another ? )

… stay tuned, might be source code and most probably some more examples coming up ! Wish I had the time to make a couple of more experiments like for instance if using linear gradientFill gives a ‘plane’ in 3D-space and what happens with BlendMode.DARKEN or BlendMode.SUBTRACT – a hole or anti-material ?


  1. […] […]

  2. […] […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: