Der Schmale – David Lenaerts’s blog

Flash Platform Experiments

Parallax Mapping with Pixel Bender (still burning cpu’s)

Tags: , , ,

Aw man, Mr. Doob went ahead and made me all stoked about Pixel Bender again (and there goes my patience, curse your leet hide!). I went back to the parallax mapping effect from my last post to see if I could make it work more correctly in Pixel Bender (using the steep parallax algorithm). And since we’re using Flash Player 10 anyway, I made the surface rotate in 3D to illustrate the effect a bit better. Because of the lack of loops when using PB in FP10, it’s limited and some things could look a bit weird (especially since I’m exaggerating the effect here). Pixel Bender in Flash also has its speed limits, so this is still a cpu killer… As a result, I had to throw out the part handling lighting and self-shadowing :(

 

Enough rambling, here’s the demo (Flash Player 10 needed!):

  • demo for FP10 browser plugin
  • swf for the standalone player
  • the source (including pixel bender code)
Leave a comment (4 comments)

(fake) 2D parallax mapping… will burn your cpu

Tags: , , , , ,

When Alternativa3D showed some demos with their parallax mapping, I always thought it’d be interesting to try it myself without having to resort to PixelBender.

Well, I did, and I wasn’t happy how some things turned out. There was no overlap of objects, and sharp edges would come out looking odd or distorted. Then, taking another look at their demo, I noticed they conveniently used slanted or smooth edges all the time without any possible overlap.

Reading up on some stuff, I decided to make the process iteratable, and liked it much better already. There are some downsides… Most importantly, it’s a cpu-killer and still pretty flawed compared to the real thing (which is a pixel shader). Nonetheless, it was fun to figure out and code, and that’s pretty much the reason why I decided to post it ;)

Oh, and I also rewrote the Bump Map from some time ago, since I needed it to make this demo a bit cooler overall. The code back then was a quick experiment; not exactly a beauty nor reusable whatsoever, which has been taken care of to some extent. Additionally, the lightmaps now support colours and you could just as well write your own.

Check out the demo here and the source here. The images used came from here.

Leave a comment (16 comments)

© 2009 Der Schmale – David Lenaerts’s blog. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.