Be a Supporter!

mikemike

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

raytracing with adobe pixel bender

7/22/08 by mike
Updated 6/23/10

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

8/10/10

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

12/9/08

: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

9/22/08

That's Pretty O.o


ZJZJ

9/2/08

Next question: How can you be so awesome?


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?

8/25/08 mike responds:

I hacked my own account whilst inebriated


XaxroxXaxrox

8/24/08

I give you a :O


ArchawnArchawn

8/21/08

That's fucking sweet.


MizoxMizox

8/20/08

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

8/6/08

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


JBPresentsJBPresents

7/27/08

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

7/26/08

!_!
woooooooooooooooooooooow
grovie XD
jajja
zee you later


sirtom93sirtom93

7/25/08

Wow, extremely hot.


YrtnejYrtnej

7/25/08

Oh, man, that looks AWESOME!

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


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


Matt475Matt475

7/24/08

sketchy


mongoidmongoid

7/23/08

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

7/23/08

why do you have to do this to me mike


Oh and please tell Tom I said hi.


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

7/22/08

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


AdobeKevinAdobeKevin

7/22/08

nice!!


ScuzzfestScuzzfest

7/22/08

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


kornroxkornrox

7/22/08

3d shit


WurmyWurmy

7/22/08

I wish I understood what you were talking about :C


CuboneCubone

7/22/08

radical


WiiporterWiiporter

7/22/08

That is awesome.


DoodlerDoodler

7/22/08

SWEET MICHAEL!


That's mighty spiffy that pixel bending