Be a Supporter!

mikemike

Main News Movies Games Audio Favorites Reviews Stats 1,301 Fans
Follow mike

raytracing with adobe pixel bender

2008-07-22 04:51:26 by mike
Updated

I started playing around with Adobe's Pixel Bender, the image processing language that will be integrated into Flash 10. Pixel Bender lets you make things like custom filters and blend modes, so I'm sure we'll see all kinds of cool effects pop up.

After reading through the Pixel Bender spec, I was impressed that it had good support for conditionals and loops, which is a tough spot for these shader languages. So what do I do? Push it to the max and make a raytracer, of course. :)

You can download the source .pbk file here. You'll need the Pixel Bender Toolkit to check it out.

It's your run-of-the-mill raytracer featuring ambient, diffuse, and specular lighting, reflection, and shadows. There are a few sticking points I had to work around. For one, there's no recursion in Pixel Bender, so spawning a tree of rays from a single ray would be tough. This rules out having objects that are both reflective and refractive, for example. Secondly, there's no indirection. This makes it difficult to have different type of primitives, so I'm rendering spheres only.

The Pixel Bender toolkit renders using the GPU, so its really cool to see the picture update at 60fps. :) It's even more awesome to think that this could run inside Flash Player 10! Unfortunately, it looks like that's too good to be true. For one, Flash 10 only supports a subset of the Pixel Bender spec. You could work around this, but even then, all signs point to Flash 10 running these shaders on the CPU only. Setting the Pixel Blender toolkit to run in CPU mode slows the raytracer to a crawl. :(

Watching the GPU do all this crazy stuff makes me wonder about the future of graphics hardware. As we add things like branch logic to our GPUs, they become more and more like a generalized CPU. Will we get to a point where the GPU/CPU distinction doesn't even exist, and your "graphics card" is just used as another core? Or will the GPU continue to be distinct as a very specialized, parallel number cruncher? I'm not really a hardware guru, so maybe I'm way off base here.

I'll be at San Diego Comic-Con this weekend, at The Behemoth booth. Stop by and check out Castle Crashers. :)

raytracing with adobe pixel bender


Comments

You must be logged in to comment on this post.


grosargrosar

2010-08-10 15:02:31

Here's an interesting site that talks about having a GPU and then an individual rayracing card.
"Raytracing to replace rasterization by 2020"
http://www.dacris.com/blog/2010/08/08 /RayTracingToReplaceRasterizationBy20 20.aspx


10nitro10nitro

2008-12-09 17:17:51

:Watching the GPU do all this crazy stuff makes me wonder about the future of graphics hardware. As we add things like branch logic to our GPUs, they become more and more like a generalized CPU. Will we get to a point where the GPU/CPU distinction doesn't even exist, and your "graphics card" is just used as another core? Or will the GPU continue to be distinct as a very specialized, parallel number cruncher? I'm not really a hardware guru, so maybe I'm way off base here.

I'm by no means an expert, but here goes:
The CPU is more like a project supervisor, they don't really spend too much time actually working, but use most of their effort coordinating the team/system.
The GPU is like the highly skilled coder that doubles the productivity of the team, the guy the CPU turns to when he needs something important done; but isn't really a good leader.

They will probably eventually merge though, I think of the GPU as a modern day ALU (algebraic logic unit), which was integrated into the processor. (In fact that's the reason AMD makes processors. They made ALUs for Intel CPUs. Once Intel integrated the ALU, AMD was out of a job.)

-----
What do you mean? That is horrible, there are tons of jpeg-like artifacts in the image!</sarcasm>


nataSNoosenataSNoose

2008-09-22 17:13:35

That's Pretty O.o


ZJZJ

2008-09-02 21:37:41

Next question: How can you be so awesome?


groundpwndrgroundpwndr

2008-08-25 08:19:18

Excuse me, but how come you have to pay for t-shirts? I could have sworn you were part of the staff, and as such, subject to free shit when and where ever you wanted it. Has your account been hacked or possibly you are inebriated?

mike responds:

I hacked my own account whilst inebriated


XaxroxXaxrox

2008-08-24 10:43:16

I give you a :O


ArchawnArchawn

2008-08-21 08:15:37

That's fucking sweet.


MizoxMizox

2008-08-20 19:36:16

and I thought flash was laggy as is, even with the player 10 beta, if someone tries to run this thing on MY CPU it'll probably fry my whole machine, great job Adobe, I liked it better back when it was Macromedia


KajenxKajenx

2008-08-06 04:17:11

Haha, I love it. "Let's just write a raytracer for fun!" You code monkeys are too much!


JBPresentsJBPresents

2008-07-27 10:05:18

if your interested in new processor tech check out the worlds first artificial DNA molecule. It has great potential for super fast storage and processing capabilities
http://www.ecogeek.org/content/view/1 913/71/


cmggcmgg

2008-07-26 22:40:46

!_!
woooooooooooooooooooooow
grovie XD
jajja
zee you later


sirtom93sirtom93

2008-07-25 22:25:42

Wow, extremely hot.


YrtnejYrtnej

2008-07-25 19:37:38

Oh, man, that looks AWESOME!

In before Gatling. Ddin't see that one coming, eh?


Mr-AndersonMr-Anderson

2008-07-24 10:29:59

IT DOESN'T MAKE A BIT OF DIFFERENCE; THE BALLS ARE INERT.


Matt475Matt475

2008-07-24 01:01:37

sketchy


mongoidmongoid

2008-07-23 20:11:34

Holy crap! I had no idea that Flash 10 was capable of this!

I agree with you that it will be very interesting to see how GPUs are used in the near future. Espcially when they start implementing the single chip integrated CPU and GPU. I did a backflip when I found out that Flash 10 was going to be given GPU support. The possibilities make me drool a bit.

Intel says it will have 80-core processors by 2012. The scary part is realizing that that's only 4 years away. At some point soon, Flash and Flex will have the ability to become something much more than what they are.


Afro-NinjaAfro-Ninja

2008-07-23 02:09:09

why do you have to do this to me mike


GoldenPickaxeGoldenPickaxe

2008-07-22 19:03:07

Oh and please tell Tom I said hi.


GoldenPickaxeGoldenPickaxe

2008-07-22 19:02:38

Looks like you could make a blue spheres fan pic with that and it look real...(Blue Shpere is a Sonic minigame,or it can refer to the secret mega-game.


speelingspeeling

2008-07-22 18:38:41

since i can't go, can u bring me back a present?


AdobeKevinAdobeKevin

2008-07-22 16:20:35

nice!!


ScuzzfestScuzzfest

2008-07-22 15:36:03

complicated.................


kornroxkornrox

2008-07-22 14:04:30

3d shit


WurmyWurmy

2008-07-22 13:31:17

I wish I understood what you were talking about :C


CuboneCubone

2008-07-22 13:05:38

radical


WiiporterWiiporter

2008-07-22 11:21:38

That is awesome.


DoodlerDoodler

2008-07-22 05:21:00

SWEET MICHAEL!


JimmyDallasJimmyDallas

2008-07-22 05:08:16

That's mighty spiffy that pixel bending