Close Show/hide page

Parsons MFA Design + Technology

August 21st, 2010

I just wanted to mention that at the end of the month I’ll be taking a happily anticipated break from the commercial grind and going back to school, to the Parsons MFA Design & Technology program.

I’m looking forward to posting new and hopefully interesting things here as I progress through the program, the time during which I aim to broaden the scope of my personal sandbox and make experimentation a full-time vocation. But hopefully without losing any of the snark.

homescreen 3D – an OpenGL Android program launcher

July 31st, 2010

Video demonstrating my first “experiment” with the Android Market. An answer to a question nobody asked, namely: “What if you made an Android program launcher in 3D?”

It was, to be frank, a gigantic pain in the ass coding the motion for this, since there seems to be no Tweener-like class written in Java (Java, not processing…). Anyone know of one?

Built using min3D.

 free version

 
 almost-free version

:T

Announcing “min3D”, a 3D framework for Android

May 5th, 2010
Why yes, that is the Earth revolving around the planet Jupiter

View the code for this example.
Note how the “onEnterFrame” function is only 8 lines long.

Update:
Download min3D sample app
(Android v1.5 or higher)

This post announces a 3D framework/library-in-progress I’ve been writing for Android, written in Java with OpenGL ES. Between the names min3d, modest3d, and llama3d, I’ve gone with “min3d” for being the least self-deprecating while still conveying an appropriate level of expectation that I’m comfortable with. :)

I’ve gone legit by putting it up on Google Code (first time for everything, etc.). While just an early build, it should at the very least be useful for educational purposes if like me you’re just starting down the Android path.

My aim while building this was to make a library that required no extra massaging of model data on its way to being used by OpenGL. To that end, data can be created and manipulated directly on the ByteBuffers that are used by OpenGL, without the need for any intermediating (ie, redundant) data structures. And hopefully wrapped in such a way that’s still relatively easy to use.

But this approach also imposes some important restrictions. The maximum number of vertices and faces of an Object3d is fixed after instantiation, and the dynamic addition/removal of vertex or face elements is currently not supported. If/when implemented, these operations will have to be much more costly than, say, with a linked list. But unavoidable, as far as I can tell.

Here’s what’s currently implemented through the API (all conventional stuff…)

Read the rest of this entry »

Android Red Bouncing Ball

April 21st, 2010
Download (for devices running Android v2.1)

As the geek sits down to learn a new programming language or new programming platform, the first thing he or she must do is learn to make a program that successfully prints the words “Hello, world!” to the screen.

The main significance of this first minor feat as it relates to the programmer is not epistemological, technical, or temporal, but psychological. Crossing the — shall we call it the “Hello world” threshold? — brings with it the realization of the existence of a universe of infinite possibilities. But also the burden and intolerable vertigo that comes with that sense of unlimited freedom.

For, alas, there is no standard “second program” for the geek aspirant to sit down to write. The programmer is on her own. Of the potentially infinite paths that lie in front of her, which will she choose?

Actually though, the most common second program chosen with pedagogical motives in mind — I would submit — would be that venerated bouncing ball, colored 0xFF0000. If you come from a Flash background, you probably know of it well.

Here’s mine, on the Android platform- (Sure wish I could’ve used Flash 10.1… ;)

Using NativeProcess in AIR 2 for screencaps

April 18th, 2010
Thumbnail

Download installable AIR file
Requires AIR 2 Beta 2 Runtime +
Windows .NET v3.5

My aim here was to get familiar with AIR 2’s new capability of interacting with external processes’ standard streams.

One useful way of learning how to use a new feature is to proceed directly to trying to abuse it.

To that end, this AIR application takes in a fairly continuous stream of uncompressed binary image data from a native process’ standard output. My hope was to get real-time screen capture updates into AIR at a decent frame rate.

Details and source code after the break–

Read the rest of this entry »

More Fun With Texture Projection

March 22nd, 2010
Thumbnail - Click me

Here I’m just expanding upon the ‘texture extraction’ idea posted before. This version maps video onto 3D objects in a much more direct manner by using ray-casting, like the examples in the last several posts.

Controls:

  • Mouse rotates object
  • Mouse drag moves object
  • [SPACE] remaps the texturing of the 3d object
  • [ENTER] cycles through different 3D primitives
  • [H] shows full list of kludgey hotkey controls

Update with video (8/25/2010):

Although this piece dispenses with the encumbrances of an AR marker or any application-like functionality, I think the method being used here has some potentially interesting uses for an augmented reality-based design application. (Or for more whimsical uses like “upload-your-face” done in 3D). I’ve disabled backface detection, so the imagery gets mapped on all sides of the object rather than just the camera-facing polys, which makes it more visually interesting. Live demo above requires webcam.

Augmented Reality Texture Extraction Experiment

September 19th, 2009

This is an AR-based experiment that enables the user to lift textures from real-world objects in live video and apply them onto 3D objects that are overlayed on top of them. Only box primitives are supported here, but the general idea could be extended to other types of 3D primitives or potentially even more complex objects with some clever image compositing and UV mapping.

Thumbnail - Click me
Click for live demo

Click the image on the right to run a live version of the experiment, in case you have the patience to suffer thru the quick-and-dirty hotkey-based UI.

Print the AR marker (PDF | PNG) and point your webcam at it.

It’s running Saqoosha’s (feature-incomplete) Alchemy branch of the FLAR Toolkit, along with Papervision3D.

In the future, it would be nice to figure out is how to apply bilinear filtering to the ‘deperspectivized’ textures. I could also add a feature to export the textured 3d objects into a 3D file format (probably OBJ) if there’s any interest.

Conceptually, this piece builds on these two video projection tests, and is a modest implementation of one of the themes from this post of ideas for augmented reality.

Keyboard Mousebutton Replacement Utility (.NET)

August 23rd, 2009
Screenshot

This one’s pretty niche: A small Windows utility that emulates the left and right mousebuttons using the keyboard. Specifically, using the right Windows key and the right Alt key.

Why? Because I use a MacBook Pro running exclusively in PC-mode, and I can’t stand how the mouseclick is implemented with its button-less trackpad. So yeah, pretty niche…

Sorry, no UI to change the hotkey assignments. If you’re comfortable with C#.NET, the source code is included in the zip file. It may be useful to examine if you’re interested in learning (1) how to capture keystrokes globally in Windows or (2) how to generate mouse operations programmatically, using some dreadful-looking Windows API interop code that I tried to learn as little as possible about in order to get to work.

Download (source included)

Complex Spotlight Shadow Caster for Papervision3D

June 8th, 2009
Thumbnail - Click me

Simulates the projection of shadows coming from a spotlight light source onto irregular surfaces. In the supplied example, an animated MD2 model (from Quake 2) is casting a shadow onto the inside of a sphere. Supported parameters include shadow color, alpha, blur, falloff and texture map size, as well as position, rotation and field of view. This evolves out of the projection work posted previously.

Source:

SpotlightShadowCasterManager.as

Usage:

After instantiating the manager –

	_shadowCaster = new SpotlightShadowCasterManager();

– assign one or more DisplayObject3D’s that will block the light from the spotlight:

	_shadowCaster.registerShadowCasterObject(myMesh);

Then register one or more meshes that can have shadows cast upon it with registerShadowCasterObject. As the second argument, you must supply a BitmapMaterial utilized by the mesh on which the manager will draw the shadows. Usually, you’ll want to create a CompositeMaterial, with the BitmapMaterial most likely at the top of the stack. It might look something like this:

	var compositeMaterial = new CompositeMaterial();
	compositeMaterial.addMaterial( new ColorMaterial(0x888888) );
	var mat:BitmapMaterial = new BitmapMaterial( new BitmapData(1,1) );
	// .. the bitmapdata will get overwritten,
	//    but must contain _something_
	var sphere:TriangleMesh3D = new Sphere(compositeMaterial, 1000);

	_shadowCaster.registerShadowReceiverObject(sphere, mat);

To update the shadow textures, call

	_shadowCaster.update();

– probably in your onEnterFrame or onRenderTick function.

That’s enough to get going. From there, it’s just a matter of adjusting the projector’s position and orientation in relation to the objects in your scene with the properties projectorPosition, projectorPitch, and projectorRoll. Check the source for the various configurable properties like blur, alpha, color, etc.

Limitations, bugs:

Read the rest of this entry »

Video Projector Effect, Advanced

May 31st, 2009
Thumbnail - Click me

This version handles arbitrary rotations, field of view / focal length, and uses correct math; the previous example faked it somewhat, doing everything basically with 2D math (but why admit to that? :). I found it twice as difficult getting to this point compared to the version posted a few days ago. It turns out that when you want to rotate more than 90 degrees around the x-axis, it’s good to make friends with quaternions, if only superficially.

And it’s interactive this time. By the way, is it not a royal pain to design an interface to control more than two axes in Flash for the web?

There’s still a lot that could be done right / better with this: backface culling (already tried and failed); frustrum culling; per-triangle alpha based on distance and angle to simulate light intensity; per-triangle focus/blur based on distance, maybe (but probably not); a more straightforward way to implement video; shadows… Basically, anything short of building a renderer-inside-a-renderer.

Bonus points for identifying the band to whom the set list pictured in the third image belongs.

Sorry, still no source.