Introducing Stok3d – More FP10 3D+Pixel Bender shading

stok3d-envmapphongLast week I posted an example of Environment Mapping using FP10’s native 3D and Pixel Bender. The reactions were quite positive, which motivated me to push the concept a bit further and create more shaders using Pixel Bender. These new additions all work in the same fashion, ie. as Filters which need to be updated whenever the target object (or if provided: light position) changes.

I created a project on Google Code for this, dubbed Stok3d (as I was positively stoked at that specific point in time). It’s a mini-library at this point, but in the future there’s potentially more to it than shaders; Z-sorting for instance: although it has been done already, it wouldn’t be a bad idea to create something specifically for Stok3d and have more functionality in one place. But… zat’s for ze futuah! At least for now, it will be easier to commit bugfixes and updates.


In the order from low cpu usage (and less visually interesting) to high cpu usage (and more interesting):

* Although Stok3d is distributed under the GNU GPLv3 license, the textures are NOT covered by this license. In particular, the blast door and hangar door textures, normal maps, and specular maps are made by Florian Zender ( and are used with his kind permission. Check out his work, it’s quite impressive! :)


The source for the examples as well as the library can be found on Google Code. It’s available over svn or as a downloadable archive.

16 thoughts on “Introducing Stok3d – More FP10 3D+Pixel Bender shading

  1. really awesome looking ! I want to play around with this code when I get a chance, and combine it with some of my own programmatic modeling experiments. Would it work with a non-flat surface , or something that changes dynaimcally?

  2. I really like your posts. Unfortunately I can’t see most of your demos. It says that Flash 10 is required and asks if I want to install it. I’ve got installed.

  3. Thx all!
    Piergiorgio: I think it’s safe to say that Wick3d is buried ;) I learned from it what I wanted to learn and as such it was time to move on. This is especially for FP10 native 3D.

    David: Well, if you combine several DisplayObjects with different rotational settings etc, I guess it could work, but probably not as well as the shader effects in Away3D or in (upcoming) Papervision X, which are much more suited for mesh work.

    Rothrock: It needs 10.0.22. It seems some Pixel Bender implementation bugs were fixed since some previous versions.

  4. on the unrelated note, what’s the difference between publishing sources under gpl and not publishing sources? noone can use them either way.

  5. Makc: First of all, don’t worry. The GPL License is most likely only temporary while this project is still in an experimental phase and going to be redistributed under a more permissive license. “No one can use them” is a pretty strange claim. You can redistribute and modify it as long as you provide the source and don’t change the license, which is exactly what I’d like at this point – people experimenting with it in a purely open source context.

  6. Pingback: Dynamic text with phong shading using Stok3d | sakri rosenstrom blog

  7. Peter: Those examples looks fantastic! It’s a good example that sometimes, 2D looks better (and faster) than 3D :)

    dVyper: Thanks. I think cpu-wise limits can be reached quite quickly. It’s very tempting to go overboard with these kinds of effects, especially since chaining together some filters can be very nice but intensive!

  8. Pingback: 3D Fractals (Ray-traced with Flash) | Neuro Productions

  9. These examples look fantastic. I’d really love to use stok3d, but I’ve had zero luck getting them to work right in my own projects, despite several days of tinkering. I’m trying to use a DiffuseFilter, but I can’t seem to get a handle on where the light source is. I’ve attached a Sprite with an X on it as a marker, and I move it to the location of the light on frame updates, but it just floats around with no apparent connection to the light shining on the target with the filter. What is “lightPosition” relative to, exactly? Is it t relative to the stage? To the target? The parent of the target? None of these seem to account for the light’s behavior. Can anyone help?

  10. Dave: If I remember correctly, it should be relative to the DisplayObject’s parent. To be honest tho, nowadays, you’re probably better off using a 3D engine like Away3D to do anything like this. This was an experimental project that has since been abandoned due to a lack of use (I think you must be the first!)

Leave a Reply

Your email address will not be published. Required fields are marked *