Header image

Good news everyone. Since a few hours a version of the Pixel Bender 3D compiler has reached the public beta phase. You can download it here.
Now you’re able to write vertex and fragment shaders not only with assembler-like opcodes, but with a lot more readable language.

Instead of:

mov ft0, v0
tex ft1, ft0, fs1 <2d,clamp,linear>
mov oc, ft1

You can write much more readable code like this:

void evaluateFragment()
{
    float4 color = sample(textureImage, float2(uv.x, uv.y));
    result = color;
}

To use a PD3D shader in Molehill you have to write three pixelshaders. The first one is the vertex shader that calculates the vertex position, the second one will be the material vertex shader which (optionally) prepares and calculates data for the fragment shader and finally the fragment shader which is responsible to set the pixel color. Here is an example of the most simple shader you can imagine:

Vertex Shader:

vertex kernel default
<namespace : "AIF Test";
vendor : "Adobe";
version : 1;>
{
    parameter float4x4 objectToClipSpaceTransform;
 
    input vertex float4 vertexPosition
    <id : "PB3D_POSITION";>
 
    output float4 vertexClipPosition;
 
    void evaluateVertex()
    {
        vertexClipPosition = vertexPosition * objectToClipSpaceTransform;
    }
}

Material Vertex Shader & Fragment Shader:

material kernel color
<namespace : "AIF Test";
vendor : "Adobe";
version : 1;>
{
    input vertex float4 vertexColor
    <id : "PB3D_COLOR";>
 
    interpolated float4 color;
 
    output float4 result;
 
    void evaluateVertex()
    {
        color = vertexColor;
    }
 
    void evaluateFragment()
    {
        result = color;
    }
}

To compile a shader program from these three shaders you can use the included PBASMCompiler:

var inputVertexProgram:PBASMProgram = new PBASMProgram(compiledVertexProgramBinary);
var inputMaterialVertexProgram:PBASMProgram = new PBASMProgram(compiledMaterialVertexProgramBinary);
var inputFragmentProgram:PBASMProgram = new PBASMProgram(compiledMaterialFragmentProgramBinary);
 
var programs:AGALProgramPair = PBASMCompiler.compile(inputVertexProgram, inputMaterialVertexProgram, inputFragmentProgram);
var agalVertexBinary:ByteArray = programs.vertexProgram.byteCode;
var agalFragmentBinary:ByteArray = programs.fragmentProgram.byteCode;
 
program = context3D.createProgram();
program.upload(agalVertexBinary, agalFragmentBinary);

For a description how to connect a pixelshader to data streams look into the PDF and the examples that are included in the PB3D release. The documentation is already pretty good ;)

If you have no idea what I’m talking about and you’re have heard the word pixelshader for the first time, take a look at Thibault’s intro to Molehill and Michael’s Simple 2D Molehill example.

Molehill released!

March 1st, 2011 | Posted by lars in 3D | Molehill / Stage3D | Talk - (2 Comments)

As you might have noticed the latest flash player codenamed “Molehill” has been released to the public. Finally everyone can play around with the new GPU features. Read about the details here: Changing the web, again.

In my previous post, I mentioned my plans for Molehill. Meanwhile I have developed a 2D engine based on Molehill and I will release the beta version within the next days hopefully. Unfortunately I was on a holiday and just came back yesterday. Now my inbox is flowing over and I’m back into my projects, but I will use the next days to clean up the code, write a few examples and get that thing online for you.

Stay tuned!

Flash 3D – Molehill

January 13th, 2011 | Posted by lars in 3D | Molehill / Stage3D | Talk - (7 Comments)

It’s been a while since my last “real” post… but it’s about time, there are so many things happening. I’m still pretty busy developing large scale flex applications for clients and it’s still fun, but obviously I went out for a walk to the “other side” and learned Objective C on the iPhone. I was always interested in hardware accelerated graphic programming and the iOS platform was a nice and easy way to learn it, because all the tools were there and I could just start. So I started learning OpenGL on the iPhone, which was a lot of fun … and gave me headaches sometimes.

A few month ago I was asked by Adobe to take part in a prelease team for the new upcoming Flash Player codenamed “Molehill” and guess how excited I was (Thanks Thibault!). Finally our dreams are becoming reality: Hardware accelerated Flash content. Leveraging the GPU to do all the rendering at nearly native speed in the browser, wow:

As you know, I built my own little 3D engine (ND3D) in Flash and hey it became a little successful and a few people are still using it. Of course it never could compete with all the big engines like Papervision3D, but it’s small, fast and lightweight.

As you can imagine I’m playing around a lot with the new Molehill API and it’s so stunning and I can’t wait for the final player to be released to the public. I also thought about what to do with ND3D and if it would make sense to port the engine to Molehill and make use of the hardware acceleration. This time I can’t compete with the major players as well (Away3D, Alternativa3D or Flare3D) which are making their engines ready for Molehill, but it was never my goal to compete …

My goal for the next version of ND3D is to build a small and easy extendible 3d library that has all the basic features you need to display high quality 3d content (loading textures and meshes, animating them, extendible materials, lighting, reflections, etc…). Since I’m still a “learner” in many 3D topics, it’s challenging and very exiting (I never coded a pixelshader before Molehill…). I’m interested in way too many topics at the moment: Bump mapping, Shadow mapping, Projections, just to name a few. The more I dig into graphic programming the bigger the whole world get’s… Let’s see where I will end up. So ND3D will be mainly a research and learning project for me and hopefully it will be usable to some of you. I will be open sourced and hopefully you guys like to contribute and extend it…

But more important is: Flash is coming from a 2D world and there are so many cool 2D games out there that need to be ported to Flash, so Flash needs a hardware accelerated 2D framework. On the iPhone I was working a lot with Cocos 2D and I really liked it, so I decided to create a Molehill accelerated 2D engine, let’s call it ND2D for the time being.

My plan it to be ready with this engine as soon as the player reaches the public beta (fingers crossed). It will be open source like ND3D and free for everyone to use. I wanna see thousands of particles and spaceships exploding at 60hz in HD in Flash, with the new player somethiing like this will be possible:

If you’re interested in this 3D topic and want to learn how graphic programming works, be able to write pixelshaders and be prepared for Molehill I recommend reading these two books: OpenGL Official Learning Guide and Pixelshader Programming in OpenGL. If you’re already able to code pixelshaders for OpenGL or DirectX, Molehill will be very familar to you…

And I almost forgot to mention an article I just read that drove me to write this post, an interesting read about Flash competing with Unity3D: Adobe vs. Unity

So long…

Fluid Toy 2 (iPhone / iPad)

December 6th, 2010 | Posted by lars in Talk - (7 Comments)

Finally I found some time to finish the sequel to my little FluidToy. It’s still an interactive fluid simulation, but with a lot more options and visual effects. Check it out:

Get it on the Appstore

First steps on the iPhone

September 23rd, 2009 | Posted by lars in iPhone | Talk - (5 Comments)

Here are the results of my first tries with ObjectiveC + Cocoa2D + OpenGL. Feels nice and pretty fast and I like the “strange” look of the ObjectiveC language. I implemented a small particle system based on a CocosNode with OpenGL, 10000 particles moving with a decent framerate! Second I ported an existing fluid solver to ObjectiveC, there is a lot to optimize, that’s why it’s running only at 30 fps. I like experimenting with this platform, more to come…

Stardust particle engine + ND3D

August 27th, 2009 | Posted by lars in Talk - (0 Comments)

Allen Chou made a beautiful and pretty fast open source particle engine named Stardust. Just have a look at the examples, you can customize the output in various ways via xml configuration. So in case you need an easy to use particle engine for your next project, I suggest you take a look at his engine. He also added an extension to use it together with my ND3D engine.

SimpleTimer 2 updated

June 18th, 2009 | Posted by lars in AIR | Flex | Talk - (3 Comments)

st_new_icon

I found some time to give my timer a small graphical rebrush. The application icon and the logo itself has been updated. Now it looks a lot more beautiful in the dock. I also added an alternative bright skin in case you don’t like the dark one. The calender is now zoomable if you didn’t already noticed and timers running less than 60 seconds are not counted anymore. The next thing I’m planning is to write an importer/exporter for the database that let’s you easily migrate all your timer data to a new computer. So long…

Issues with ANT and Out of memory error

May 18th, 2009 | Posted by lars in Flex | Talk - (0 Comments)

Finally my macbook arrived and I got everything set up and started working (Yes, I switched finally ;)). In one of my projects I have to compile a large flex project quite often, so I use ANT directly in the shell.

On Windows it was never a problem, but in OS X I always got: “java.lang.OutOfMemoryError: Java heap space”. After quite a journey through the depths of the web I found the place where to increase the memory size and I thought that’s might be interesting for you:

Just create a file called ant.conf in /etc (Use sudo to create the file) and paste this line: ANT_OPTS=’-Xmx1024m -XX:MaxPermSize=128m’ Done!

ND3D – Reloaded

February 13th, 2009 | Posted by lars in Talk - (7 Comments)

Hey there! My little 3D engine has made a lot of progress the last couple of weeks. I added some stuff Katopz made and Philippe (Flashdevelop Team) contributed a lot as well. Thank you guys!

New features are:
- Interactivity. Meshes and materials are clickable now.
- New Materials: BitmapMaterial, LineMaterial, Pixelmaterial and Wirematerial’
- A few new 3D Objects: Ground, Box, Line3D
- Fixed 3DS and MD2 Parser
- Predefined 3d scene for faster development

Go and grab the newest sources at google code.


(Click me, I will dance for you!)

Big thanks to Richard for the little animated fella. (He just told me the poor little guy is named: Cchhhrkrrpffschnurps. Bless you! :)

Even more updates…

January 29th, 2009 | Posted by lars in Talk - (2 Comments)

Good news everyone! It seems like Katopz from sleepydesign doesn’t need no sleep and added some really cool features to ND3D: A LineRenderer, FileMaterial (so you don’t need to manually preload your textures) and some modifications to support JigLib (an open source physics engine). See the examples on his blog. I will add everything to the repository the next days (Give me some time, I need sleep ;)).

Another ND3D Update 2

January 27th, 2009 | Posted by lars in Talk - (1 Comments)

Here is another update for ND3D: Keyframed MD2 Animation Meshes. Thanks to Katopz from sleepydesign (Sorry it took me so long to add it). An example is also encluded. Go! Update your repository.

ND3D Updates

January 26th, 2009 | Posted by lars in Talk - (3 Comments)

Hey folks, it’s been a while since my last post and my last update to ND3D. Philippe Elsass from the Flashdevelop Team sent me a useful update for my engine. With this update there is now support for alpha transparency in bitmap textures and the MeshLoader is able to load an parse 3DS files. It’s all available via the google code repository

Have fun.
(I’m working on an efficient way to get interactive materials working, hang on…)

SimpleTimer 2 – AIR 1.5 Hotfix

November 23rd, 2008 | Posted by lars in Talk - (2 Comments)

Hi there, I just uploaded a fix for the SimpleTimer. With the new AIR Runtime version 1.5 you weren’t able to restore the minimized timer. That’s fixed now and should come to you via auto update.

SimpleTimer 2 released

October 22nd, 2008 | Posted by lars in AIR | Talk - (7 Comments)

Good news everyone! I just released the first version of my new time tracking application. You can find the download, description and everyting else under Projects -> SimpleTimer 2. The version count is 1.0.1. I hope it’s nearly bugfree, since I’m using it for quite a while now. Let me know what you think of it!

SimpleTimer 2 – Sneak peak

October 2nd, 2008 | Posted by lars in Talk - (8 Comments)

As I mentioned, I’m working on version 2 of my little time tracking tool. Completely rebuild in Flex, with a lot of new features: Detailed tracking reports, CSV export, idle timeouts, autostart and more… Here is a screenshot of the current state.


(It will get public within the next weeks…)