-
Buttons... buttons.... buttons...
A project which uses looooottsss of buttons, 256 to be precise!
9 February 2010
Read more -
Trees
Some designs to find the ambience for a project which sadly will not continue.
9 February 2010
Read more -
Compiling Code::Blocks from source on Mac
Finally, after trying like 100 times to get a working installation/build script for the latest CodeBlocks version I managed to get it working! Now, I've got a script which I can simply run and which compiles the latest Code::Blocks version (from svn) into a application bundle for the Mac. Below I'll describe the steps I had to make to get it all working. First some of the things which are important
● I've been using the wxWidgets 2.8 branch and Code::Blocks revision 6135
● I first installed XCode on my MacOS 10.6 (xcode probably sets up the developer tools you need, but I'm not sure)
● take care of the dynamic libraries and their locations
● some paths and files need to be copied to the bundle location which is not described anywhere (untill now)5 February 2010
Read more -
Touchtable prototype
Working on a touchtable prototype and trying different types of materials, leds, lasers etc.. to get a sharp and bright image from the camera. In the next couple of weeks we look which elelctronics we need to get the best result. Some thoughts go to creating a touch interface witouth a camera so one can use a glass-like plate as input device for all different kinds of things. Maybe to control other ambient intelligent furniture.
● Create a IR webcam (Dutch)
● Touch LCD using FTIR
● IR LED@farnell, 44 degrees
● IR receiver 38KHZ
● 360 multitouch
● Markers
● Multi touch blogs + gluPartialDisc!!
● IR lasers
● Laser based multi touch
● Multi touch music applicationsPart list (still checking)
● Sony PS3 Eye Toy camera
● IR band pass filter; need to check which wavelength
● RGB LEDs (bright)
● Some optocouplers with related parts (will specify later)
● Maybe 4x a 780n 25mw IR lasers
● Some AVR chips
● USBasp: AVR usb programmer
● Virtual USB
● Socket
● Header
● AVR programmer● 780nm IR lasers, with 89° line generators - 10 pieces (4 per table, 2 extra) ● Headers, 2x20
● Headers, 1x10
● Headers right angle, 1x3
● White, solderless terminals - socket
● White, solderless terminals - housing
● White, solderless terminals - terminals● AVR Dragon
● HC595N shift register, el cheapo
● HC595N shift register
● 20 DIP socket
● 20 DIP socket, el cheapo
● Voltage regulator LM7805
● Attiny10-TSHR
● Attiny13-SH
● Attiny2312● Socket, 2x10
● Terminal socket, 1x2
● 16 DIP socket31 January 2010
Read more -
3D Math continued
I'm still playing around with openGL and openFrameworks and some things are falling in it's place finally. I'm working on a project to learn more about 3D math (dot and cross product) and how and when to use these. The Geon visualization of Ars Thanea is one of my inspirations for these tiny applications I'm working on.
Today I played around with the cross product which gives you a perpendicular vector between two other vectors. Somehow a couple of basic concepts with vectors and 3D math weren't clear to me. Though after I started playing with vectors I got a better understanding. One of these was how/what is that perpendicular vector the cross product returns? This is actually to simple, though one need to know how it works; Lets say you've got two vectors: a red and white one. An easy trick to understand vectors is to pick up a couple of stylos. Now take two stylos and put the bottom against each other and move the tips away from one another. Image that you put a white paper against these two stylos; this is your plane. Now when you calculate the cross product, you get a perpendicular vector, pointing away from this paper.
In the images below I've tried to make this clear. The red and white arrows are the vectors and styles you've got. The pink plane touches both of these vectors. The blue vector is the perpendicular one which is the result of the cross product.
31 January 2010
Read more -
Parsing the maillogs ....
Just a reminder for myself on how to simply parse the maillogs (also the rotated/bzipped ones).
Find mails "from" "domain.ext" and write these with the date to a o.txt file
for file inls /var/log/maillog*; do bzgrep -i "domain.ext" ${file} | grep 'from='| awk '{print $1 " " $2 " " $3 " " $7} ' >> o.txt; doneFind mails "to" "domain.ext" and write these with the date to a o.txt file
for file inls /var/log/maillog*; do bzgrep -i "domain.ext" ${file} | grep 'to='| awk '{print $1 " " $2 " " $3 " " $7} ' >> o.txt; done21 January 2010
Read more -
3D Math, HD video creation
Last night I've had some time to work on my never ending learning project :> I'm still exploring openGL and all that comes with it. Yesterday this meant 3D vector math which I finally understand. I used 3D vector math to calculate the rotation of particles in my LSystem code. This LSystem code is basically a particle system which remembers the original shape of the structure that I created using these particles and springs/bones. The test application I worked on is called "Amone" and uses a openGL display list to draw a cylinder between the vertices (particles) instead of just lines. The code that's rotates and draws the display list is most important for now :> and looks like this:
// test with display list.ofxVec3f bone_dir = (target->getPos() - source->getPos()).normalize(); ofxVec3f cyl_dir = ofxVec3f(0,1,0); ofxVec3f axis = bone_dir.crossed(cyl_dir); float angle = -acos(bone_dir.dot(cyl_dir)); float dist = (target->getPos() - source->getPos()).length(); glPushMatrix(); ofEnableAlphaBlending(); glEnable(GL_SMOOTH); glColor4f(1.0, 0.0, 0.3, 0.3); glTranslatef(source->getPos().x,source->getPos().y,source->getPos().z); glRotatef(angle * RAD_TO_DEG, axis.x, axis.y, axis.z); glScalef(source->getSize()*30,dist,source->getSize()*30); glCallList(display_list); glDisable(GL_SMOOTH); ofDisableAlphaBlending(); glPopMatrix();Creating a video from the openFrameworks application
Creating a video from this application was done using ffmpeg and avisynth. These two wonderful tools make it possible to create a video from an image sequence, combine audio and add some effects. Avisynth is a scripting util that I used to add the audio and the fade in / out effect. With 3 lines of code all image files were combined into a HD video that I could use for vimeo. Basically it works like this:
1) you create a Avisynth script and
2) use this script together with ffmpeg to create the avi file.That's all :=). The Avisynth script I used, looks like this:
video = ImageSource("G:\tmp\amone\test2\amone_%04d.png", start=1, end=1400, fps=30, pixel_type="rgb32").Turn180() aud = DirectShowSource("X:\audio\tunes\www_dbsoundsworks_com_TheTeachingRobot.mp3") AudioDub(video, aud).FadeIn(50).FadeOut(50)28 November 2009
Read more -
Perlin noise for vortex like animation
Wow a sort-of-free night ;-) Finally got a couple of hours to spend on opengl/openFrameworks and algorithmic animations. I'm still working towards an interactive visualisation and therefore I'm testing different kind of algorithms to create naturalistic and good looking effects. This time I used perlin noise to add a force to particles which make them fly in a vortex like manner. Basically I use the X and Y position of the particle as input for the perlin noise which results in this nice effect. I was trying to simulate this video of flight404:
Weird Fishes: Arpeggi from flight404 on Vimeo.
My bubbles video
This effect can also be used to create "dust" like particles, like seeds flowing through the air. When you want to use this, you should increase the force the perlin noise is adding.Now I use a x-force like -7 to 7.
void MyParticle::addPerlin() { float val = SimplexNoise1234::noise(position.x * 0.001, position.y * 0.001); ofxVec3f noise_force( ofMap(val, -1,1,-7,7) ,0 ,0 ); forces += noise_force; }
And the complete particle class
/** * Some important notes: * * - make sure that the forces your apply in seek/flee/etc are not bigger * than the max force to which we limit in the integrator (update()). Also * this code works fine, when the flocking doesnt look nice, make sure to * tune the flee/seek/separate etc.. velocities/forces. * */ #include "MyParticle.h" #include "ofMain.h" #include "simplexnoise1234.h" MyParticle::MyParticle(ofxVec3f oPos, ofxVec3f oVel, float fMass):position(oPos), velocity(oVel),damping(0.995) { setMass(fMass); color = 0xFF00CC; } void MyParticle::setReflection(ofImage oReflection) { reflection = oReflection; } void MyParticle::setImage(ofImage oImage) { img = oImage; } void MyParticle::setSize(float fSize) { img.resize(fSize, fSize); reflection.resize(fSize*2, fSize*2); } void MyParticle::setMass(float fMass) { if (fMass == 0) inverse_mass = 0; else inverse_mass = 1/fMass; } void MyParticle::update() { // combines all forces forces *= inverse_mass; velocity += forces; velocity *= damping; velocity.limit(9); position += velocity; forces = 0; bounce(); } void MyParticle::bounce() { if (position.y <0) position.y = ofGetHeight(); } /** * Some notes... Make sure that you do not att a force which is bigger than the max * velocity (see update()->velocity.limit(). Also by change the multiplication value * of the x and y parameters of noise(), you can make the change smoother or "quicker". * A good value is 0.001. * * When using both x/y position and parameters I noticed that I can create a nice * water droplet flow effect like: http://vimeo.com/935317 */ void MyParticle::addPerlin() { float val = SimplexNoise1234::noise(position.x * 0.001, position.y * 0.001); ofxVec3f noise_force( ofMap(val, -1,1,-17,17) ,0 ,0 ); forces += noise_force; } void MyParticle::setVelocity(ofxVec3f oVel) { velocity = oVel; } void MyParticle::setPosition(ofxVec3f oPos) { position = oPos; } void MyParticle::addForce(ofxVec3f oForce) { forces += oForce; } void MyParticle::draw() { // Make the colors blues at y == 0 int b = (position.y / ofGetHeight()) * 255; color = (color & 0xFFFF00) | b; color = color | b; ofSetColor(color); ofEnableAlphaBlending(); img.draw(position.x, position.y); float val = SimplexNoise1234::noise(position.x * 0.001,position.y * 0.001); float alpha = ofMap(val, -1,1,0,1); glColor4f( 1 ,0 ,0.4 ,alpha-0.5 ); reflection.draw(position.x-reflection.width/2, position.y); ofDisableAlphaBlending(); } void MyParticle::seek(ofxVec3f oPos) { ofxVec3f best_velocity = oPos - position; best_velocity.normalize(); best_velocity *= 5; // 10 is max force // + best_velocity -= velocity; forces += best_velocity; } ofxVec3f MyParticle::getPosition() { return position; } ofxVec3f MyParticle::getVelocity() { return velocity; } // flocking void MyParticle::align(vector<MyParticle*> pItems) { // alignment makes sure each particle goes into the same direction. ofxVec3f acc_velocity(0,0,0); float insight_dist = 35; float count = 0; for(int i = 0; i < pItems.size(); ++i) { if (pItems.at(i) == this) continue; ofxVec3f diff = pItems.at(i)->getPosition() - position; float dist = diff.length(); if (dist > insight_dist) continue; acc_velocity += pItems.at(i)->getVelocity(); count+=1; } if (count > 0) { acc_velocity /= count; // average velocaty forces += acc_velocity; } } void MyParticle::separate(vector<MyParticle*> pItems) { ofxVec3f acc_position(0,0,0); float insight_dist = 15; float count = 0; for(int i = 0; i < pItems.size(); ++i) { if (pItems.at(i) == this) continue; ofxVec3f diff = pItems.at(i)->getPosition() - position; float dist = diff.length(); if (dist > insight_dist) continue; flee(pItems.at(i)->getPosition()); } if (count > 0) { acc_position/= count; // averay velocaty forces += acc_position; } } void MyParticle::flee(ofxVec3f oPos) { ofxVec3f desired_velocity = oPos - position; desired_velocity -= velocity; desired_velocity.normalize(); desired_velocity *= 5.0f; // max speed // + desired_velocity -= velocity; forces -= desired_velocity; }
22 November 2009
Read more -
LSystem update
I did a tiny update on my animated LSystem code... Created a LSystem generator and parser to create nice tree like structures. Next step will be replacing the lines and dots into more realistic tree textures. I also want to implement wind forces to animate the tree in a realistic way.
14 November 2009
Read more -
Kerstboom-kast version 2.0
3 November 2009
Read more