Sunday 20 October 2013

Quick drawings

This method has been used elsewhere!!! EDIT: see Robert Hodgin http://roberthodgin.com/stippling/
I AM COPYING IT!
So don't be surprised when you find it elsewhere.
I have however, ported the method to C++, and optimised it so it doesnt use the square root function involved with calculating the distance between two points (a^2 = b^2 + c^2).
Soooo....
PYTHAGORAS THEOREM, BITCHES!

Win for not doing hard math.
First, a picture of someone else's eye (no opt):


Second (no opt):

Third, a picture of my cat (with sqrt opts):

Friday 11 October 2013

The ArrayCube

This project started as a quick sketch with Nick Noble, a COMP1720 student, to learn about arrays.

We created a cube object, gave it some values, a vector location and stuff. And whacked it into a 3d array, drew them all. And as soon as you know it we have some weird stuff like this:



And thats all great. But I liked this. I wasn't happy with all the crap that Processing was giving me.
"Only 8 lights" they said.
"You're drawing too many cubes" they said.
So I started porting it to openFrameworks:







Now look at me, creating classes in C++ for glory. 
Problem is that its even slower. 
WHATS THAT OPENFRAMEWORKS? YOU'RE EVEN SLOWER THAN PROCESSING?
So I did a few more iterations:



Made some changes:



But still, why is this crap running so slow?
C++ doesn't treat variables like Processing does. Assigning a value (using =) makes a copy of it. And I have a problem with that. I'm drawing many, many cubes. Like a lot of them. All of the cubes. And I want them to just grab some value from somewhere else to use as their opacity or brightness or whatever the hell I want to to be.

I needed to start using pointers.

I started using pointers. Things got faster.
I started using more pointers. Things got much faster.
I used pointers in a class, had them coming out my arse.
I set *my = &day and filled it with win.
I pointed at 0x4632b2b and fucking killed it.
And so now I'm like:
"HELL YEA! I CAN DO THE POINTER DANCE! EAT MY SHORTS, PROCESSING!"
But I was still not fully pleased. It was missing something. Some kind of other input and interaction with its surroundings that would make it whole. I looked high and low. I googled this and I googled that. 
And then it struck me.
"WE NEED SOME DSP ALL UP IN THIS BITCH!"
 And after learning very quickly how to use openFrameworks' ofSoundStream I finalised the code for having it not only play sound (End Theme by Zero 7), but react dynamically to sound input.
And this is the result:

Saturday 24 August 2013

Simple Nodes with openFrameworks

I made a small, simple node system in openFrameworks today.
Its essentially just an array of ofNode objects, with lines in between them, randomly placed on screen.
Next I'll try creating my own node class, and add some animation.

EDIT:
I finished animating it. Unfortunately the openFrameworks ofNode class doesnt have an inbuilt velocity or acceleration. So I built my own in by making 3 arrays the same size as the number of nodes, filling the arrays with random values between -0.1 and 0.1 and then ofNode.move(); ing them using those values.
Not the most elegant solution, but hey... It works.
Next I think I will Perlin the shit out of their movement.


First video of animation

Second video of animation

Updates

Working with Processing for Uni, mainly creating my hybrid work, however I also have been practicing trying to create really really short programs really quickly. For storytelling I am still constructing ideas and how/what to do. For my personal work at the moment I've decided to ditch Cinder and begin working in openFrameworks because it has a gigantic community and seems to be more supported. Either way they are both C++ so it should be fine.

Hybrid Work
Working with the twitter4j library in processing along with a 3D simple gravity system to produce a data visualisation of hashtags. It can talk to arduinos as well, through Serial.write(). Still in progress and not polished however its moving along quite rapidly. Heres some of the preliminary photos of it.











Really Really Short Programs
I got bored and wrote a program in 5 minutes.
I call it 256 Shades of Grey.













openFrameworks
I have been playing around with computer vision and I've been trying to get the addon for face and expression detection working (unsuccessfully).
I did manage to get the openCv addon working (with the help of a couple of the examples).
Next step is controlling an arduino, or outputting sound.

Thursday 18 July 2013

Messing around with linux

Over the past couple of weeks I haven't been doing much coding or art.
I've been immersing myself in the art of server maintenance.

I compiled my first custom Linux kernel (Gentoo), unfortunately it was a x86 kernel not a x86_64 and I needed sleep desperately. I got given a IBM eServer (346?) xSeries with dual Xeon 3.2ghz processors. So I've been playing around with that (currently its running Arch Linux).

I got more familiar with the use of bash scripting to start programs on linux servers. I followed a guide over here only used the system crontab because it lets me do things as different users :) I did this because bfgminer kept crashing within a screen session and killing the session it was in (not giving me any reason). This way: it crashes -> cron runs the script every 5 minutes -> the script checks if bfgminer is running -> if bfgminer isn't running restarts a new screen session and bfgminer inside it (success YAY).

EDIT:
Also for those running Ztex FPGA devices. YOU CAN RUN IT AT A NORMAL USERLEVEL!
You don't need to run everything as root (particularly if you are using bfgminer like me).
The information you need to know is here.

Tuesday 21 May 2013

Autonomous Agents, Genetic Algorithms and balancing Natural Selection

For the past week I've been working almost exclusively on a branch of the flocking algorithm used in FishBirds to create a Predator vs Prey program, however it has proved to be much more fruitful than that.
Since starting last friday I have learned how to implement effective natural selection and semi random evolution like this:

 - Predator dies constantly.

 - More prey is introduced when under a certain number.

 - Predator and preys values (speed, agility, weight, sight) are decided randomly with a bell curve around set values.

 - Some Predators are born better and hence do much better, and stay alive much longer.

 - Some prey are born better at escaping predators and hence also stay alive much longer.

I did however find this system lacking in its complexity and method of "evolution" so I decided to try my hand at a genetic algorithm. I wanted something where the offspring was given values similar to the parent, but that could also drastically deviate from them. So I put together a moving mean. And implemented 2 different types of reproduction, time and "well fed". This more detailed list:

 - Predators die constantly, and die faster the smaller the flock is.

 - Predators reproduce when a certain amount of prey is eaten in a certain timespan and when they are of reproducing age (this is to stop the predator slamming into a group and then all its children reproduce causing a huge increase in number of predators).

 - Predators spawn one offspring, and stay alive (this is to for competition between generations).

 - Prey reproduces by staying alive for  certain amount of time. Prey then has 2 offspring, and dies.

 - The moving mean: The normal of the gaussian distribution of random values for the offspring are the current values of the parent. This ensures a good development of genetics and keeps the gene pool relatively diverse.


Problems that I have encountered:

 - If the flock is under a certain number and there are a certain number of predators. The predators will continue to live on the small amount of food that the prey provide.

 - Performance. In a perfect world I would be able to have a flock size of anything. Unfortunately the components of a computer, and Processing have limits. I have been pushing these and I think its time to move on to something more powerful, at least for a language (Discussion in my next post)

 - The flock is limited at the moment. It stops multiplying once it reaches a certain size. This was implemented to reduce performance issues and hence has stopped me producing a more realistic simulation.

 - I couldn't work out how to implement a method of generation counting. I'm sure with more time I could work out how to do it, but I don't want to spend any longer on this project.

I've published a final video to Vimeo.

In conclusion I think I am now significantly more adept at coding than I was last week.
I had a more in depth exploration of OOP, and became much more experienced in balancing systems. I learned how to implement some more advanced random statistical tools to give more useful data. And I learned how to implement genetic algorithms.

Tuesday 14 May 2013

FishBirds updates

I've been working on the FishBirds continuously since my last post. In that time I have moved from the local branch to developing a networked version which no longer uses a ControlFrame and which supports MIDI, to developing a networked version which has no midi control and no control sketch, it is controlled using TouchOSC.

Currently the TouchOSC branch has the most features, just because its the branch which I'm using the most.

I think that they are as complete as I will have them for the foreseeable future, so for the time being I'm going to focus on developing my skills coding other methods of simulating behaviour and manipulating those algorithms. I'm working my way through Shiffmans "The Nature of Code", to help me get the skills that I need. Its a fascinating read, and my coding has already improved.

I will return to the FishBirds when I can write genetic algorithms.


Wednesday 24 April 2013

Github, and finished project.

I started a git, and started some repositories.

https://github.com/stormaes/singing-fishbirds/tree/local

Everything is on there. I'm not going to speak much about it because most of its in the readme and I don't want to repeat myself, because I hate repeating myself.

But I will say this: that project, was HUGE.

I have used 3 new programs, 2 new languages, learned to use 2 new libraries. And then compiled all that into a single project, learned how to use Git. Then wrote a 1300 word readme.

Goodnight internets.

p.arcc.cc

I've been working on the site p.arcc.cc for a while now as an exhibition space for processing sketches.

So far I've implemented a number of php scripts which control the content that goes on the page. There is a couple of small php scripts that read files out of a directory and draw them to canvas, and there is also an upload script, so that anyone can submit a sketch. The inputs of the php upload script are sanitised so that no-one can upload malicious code. It only accepts pde files.

I've also implemented a navigation bar that uses jQuery smoothscroll to navigate to different points on the page that are written using the php scripts. The navbar itself is populated by using a php script, so that it remains up to date.

Skrollr was also implemented to give parallax scrolling effect to the background.
I encountered a strange error concerning this when I was building the site. At a certain point (not the end of the page) the parallax effect would stop. The background would not scroll, it fixed itself.
So I did what any other web developer would do, check the web dev tools, however when I checked the tools, the background started behaving as it should. I could even close the inspector and it would still work. If I refreshed the page it would have the same problem as when I started.
I eventually found a solution to this though.

Monday 1 April 2013

Joomla! and Our Social Lubricant

So,
An update on what exactly I've been doing for the past couple of weeks.
I've been becoming more acquainted with Joomla!
The learning curve was steep at first, but once I got the hang of it, I don't know what I would do without it.
Its so fast to do everything, set it all up and change it to meet the specifications. Theres almost always a module out there that will do anything.

The test site that I've been working with is the beginnings of a project with another student and a group of her friends called Our Social Lubricant. Its currently live at j.arcc.cc, I'm temporarily hosting it on my subdomain because its easier and I can easily share it with the clients.
Currently there is very little actual content on the site, its mostly just odds and ends and placeholders, however the frameworks are in place to deal with content once its actually a part of the site.

I've been developing my skills with CSS mainly but also working out stuff to do with how CMS systems work.

At this point almost everything on the site works (except for a few minor details that I'll get to over the next couple of days.

Ill edit this post later with an itemised list of the features/modules that I've been playing around with on this site so far.

Tuesday 5 March 2013

More improvements to Arcc.cc, particularly the content loading on square and hexagon.
I used jquery to hide all the content first

$(document).ready(function(){
$('#video0, #video1, #video2').fadeTo(0,0)
$('#video, #video1, #video2').hide();


Then once the selection on the navbar is clicked (#intro0), hide the other content that may be active(#video1, #video2) and fade in the content.

$('#intro0').click(function(){
$('#video1,#video2').hide();
$('#video0').fadeTo("slow", 1);


Once the navigation has been clicked, bind to the 'ended' event, and when the even triggers fade out and return to frame 0. (this is not present in hexagon, as there is no end. The hover functions work all the time after the navigation has been clicked)

$("#video0").bind("ended", function() {
$('#video0').fadeTo("slow", 0);
this.currentTime = 0;


Hover functions: when the ended event has triggered enable hovering over the content so that it can be played again.

$('#video0').hover(function(){
$('#video0').fadeTo("slow", 1);},
function(){
$('#video0').fadeTo("slow", 0);}
);
});
});


This code is then just copied over with different entries, to hide the other content and show the correct content.

The only problem I have found with this code is that when the video has ended, and the hover function is run, if the video is restarted more than twice and ended, the hovering gets increasingly longer response times. I think i can fix this by stopping the hover function on ended before restarting it. I don't know how to do this yet, and the bug is low priority.

I was helped with this code with direction from Christopher Fulham, and actual jQuery help from <insert classmates name who I have shamefully forgotten here>.


Wednesday 27 February 2013

Processing experiments with flocking

For the past 2 days I have been intensively into Processing. I've spent about 20 hours out of the past 48 coding.
The result has been that I've created a few Processing sketches, all on the subject of "flocking". Each of the boids detects the proximity of its peers and steers towards the average direction of the "flock". They also repel each other, and attract towards each other to form the "flocks". When the boids collide they both take a new vector of the average sum of the previous ones.
For some of these sketches, colour is controlled by the weighted number of nearby boids, some of them alpha is the attribute thats modified, and for all of them diameter/size is also controlled by size of the flock.

For colourising the main 3D sketches I mapped the boids location in 3D space to control the values of RGB. There is also basic user interface for the 3D sketches, allowing the user to change colour modes between B&W, Blue & Black, and Rainbow, and to change the camera mode between spiral rotation, level rotation, and mouse rotation. There is also facility to pause the camera so the user may examine the flocking inside the cube.
The 2D sketches respond to mouse gestures and the boids repel away from the mouse.

Also most of the 2D sketches are js compatible and you can view one of them here, its #04.

I used heavily modified code from these locations:
http://www.openprocessing.org/sketch/47022
http://processing.org/learning/topics/flocking.html


3D sketches


Video of 3D Flocking Demo


2D sketches

Monday 25 February 2013

More work done on hexagon page

So...
I'm back at uni and working hard again.
Today a bit more work was done on Arcc.cc, specifically the hexagon page (link for the lazy). It still has a couple of small pieces of code that need to be written (or rewritten) but overall its functionality is acceptable.

Breakdown of changes:
1. Switched from iframes to javascript.
  • Removes the reliance on openprocessing.com.
  • Faster load times.
  • No java applet permission requests as it draws straight to canvas.

2. Changed from a straight up layout to request and interaction based, also changed the size of sketches.
  • Gives a more clear place for viewing.
  • No more confusion and scrolling.
  • Borders to know that happens when you click a navigation button.
  • Allows for more organisation and layout, and sets a set size for sketches.
  • Con - the change of size of one sketch causes quite intensive load (this is due to the sketch itself as well as the fact that it is being drawn in a browser).

3. Implemented JQuery.
  • Can modify content on the page much, much easier.
  • Quickly implemented and can be quickly added to.


What I learned from today (in chronological order):
  • My Web Development class is not nearly as fast paced and awesome as my Internet Art class.
  • Hackertyper.net is good for trolling other students who aren't as computer literate as I am.
  • JQuery is AWESOME! and can do all the things.
  • Revere Occam's Razor. It is your god.

Sunday 3 February 2013

Another interesting method of drawing

This is a very interesting method of drawing on this site.

http://www.koalastothemax.com

Falling

http://www.fallingfalling.com

This site piqued my interest tonight mainly due to the sound. the frequency of it seems to be constantly falling. I think I'll investigate this phenomena in a project this year.