🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

There's a pocket in my frog

posted in noaktree leaves
Published October 02, 2005
Advertisement
2D light shader...

I've recently discovered the PocketFrog and PocketHal libraries for developing games and graphics on mobile devices. One thing that caught my eye was the ability to create per pixel shaders using C style structs. So I wrote an example application demonstrating a per pixel light shader with PocketFrog.

The shader uses a list of omni light structures to hold the light's properties: power (range), falloff, position, and RGB color. These structs can be accessed by the user. For every pixel the fragment program calculates the influence each light has on that pixel (0-1) according to the light's range, falloff, and position relative to the pixel's screen position. The influence value is used to calculate a color. The total color values for each light are then summed to get the final color of the pixel before it is returned and drawn by the rasterizer.

Hmmm...

One problem with my implementation is that it will only work on rectangular sprites that have no masks. This is because PocketFrog does not send the 2D location of the pixel to the shader. I had to hack in a pixel cursor. This hack fails when masks are used, however, because not every pixel is sent to the shader. I just started using this library yesterday and will take a closer look at it to see if there is a way to have the rasterizer send the pixel location to the shader. It may take a rebuild of PocketFrog. [cool]

It's kind of fun programming my iPaq again. [smile]

You can find the PC binaries and VC6 source here.
Previous Entry Uhhmm
Next Entry Witch or Treat
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement