<?xml version="1.0" encoding="UTF-8"?><feed
  xmlns="http://www.w3.org/2005/Atom"
  xmlns:thr="http://purl.org/syndication/thread/1.0"
  xml:lang="en"
  xml:base="http://www.neuroproductions.be/wp-atom.php"
   >
	<title type="text">Neuro Productions</title>
	<subtitle type="text">Freelance Creative Developer :OpenGL/WebGL -cinder / openFrameworks- C++ - Arduino -mobile</subtitle>

	<updated>2014-10-28T15:22:26Z</updated>

	<link rel="alternate" type="text/html" href="http://www.neuroproductions.be" />
	<id>http://www.neuroproductions.be/feed/atom/</id>
	<link rel="self" type="application/atom+xml" href="http://www.neuroproductions.be/feed/atom/" />

	<generator uri="http://wordpress.org/" version="3.0">WordPress</generator>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Making a 6-axis Robot Arm]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/6-axis-robot-arm/" />
		<id>http://www.neuroproductions.be/?p=880</id>
		<updated>2014-10-28T15:22:26Z</updated>
		<published>2014-10-28T13:00:52Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="arduino" />		<summary type="html"><![CDATA[I&#8217;m very interested in connecting computers to the real world. The stuff I make for clients mostly ends up on [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/6-axis-robot-arm/"><![CDATA[<p>I&#8217;m very interested in connecting computers to the real world. The stuff I make for clients mostly ends up on a screen or a projection and a lot of time I&#8217;m missing a real physical step in the world. So this is something I really want to explore more.</p>
<p>After making my Drawing Machine I knew I needed some more precision tools if I wanted to make more stuff like that. So this year, I took that step and bought me a cheap Chinese metal mills and rebuild it to a CNC mill.</p>
<p>And with a CNC, I could make everything I ever wanted (That&#8217;s what I like to think anyway <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ), So I got the ridiculous idea to try and make an industrial 6-axis robot arm. It would be the perfect project to combine my new found love for making physical things, with the old (but not faded) love for programming.</p>
<p>Bought me some aluminium stock, bearings, motors, etc. and a lots of designing, milling, cutting, tapping, drilling, screwing, printing, soldering and programming later this beauty is the result:</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/armfinal.png"><img class="alignnone size-full wp-image-915" title="making robot arm" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/armfinal.png" alt="" width="700" height="527" /></a></p>
<p>I didn&#8217;t document the making process as much as I would like to do, but I was smart enough to shoot some video every once in a while.</p>
<p>So this is sort of the making of video (skip strait to the end to see the finished robot in action )<br />
<iframe width="700" height="430" src="//www.youtube.com/embed/cod_SNq-d6c" frameborder="0" allowfullscreen></iframe><br />
a little bit more info and pictures:</p>
<h3>the Electromechanics</h3>
<p>I knew I needed a lot of torque to move the arms. but I still underestimated it a lot. I guess that&#8217;s a standard beginners mistake. It took me some redesigns and a lot of frustration before I got that  right. I needed to shorten my design and added more gear boxes than I had initially planned.</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/induction_gearbox.png"><img class="alignnone size-full wp-image-895" title="induction_gearbox" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/induction_gearbox.png" alt="" width="700" height="238" /></a></p>
<p><span style="font-weight: normal;">It would have been nice to have some planetary gearboxes but sadly those things cost a fortune. So I had to do with some relative cheap worm-gearboxes. They work fine, but they have quite a lot of backslash. Which affects the precision of the robot. But at least it has the needed force to move itself.</span></p>
<p>I used stepper motors so keeping position was not that hard. But I needed something to sync the &#8220;home&#8221; position between the robot and the computer. So I used inductive sensors on each of the axes to get some sort of start position.</p>
<p><span style="font-weight: normal;"><br />
</span></p>
<p><span style="font-weight: normal;"> </span></p>
<h3>the Hand</h3>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/robothand3Dprint.png"><img class="alignnone size-full wp-image-908" title="robothand3Dprint" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/robothand3Dprint.png" alt="" width="700" height="469" /></a></p>
<p>I 3D printed the hand, with the intent to use it as a prototype, but it was working fine like that, so I kept it.</p>
<p>For the hand I used a standard robot hand design. Just two servos driving the opening and closing of  the hand. I thought it would be nice to also have some sort of pressure sensors so that the hand knows if it has a hold on something. For that I salvaged the load cells of a cheap kitchen scale, and put those in the hand</p>
<p>Didn&#8217;t find much info on how to use the kind of load cells I had (4 cells, 3 wires each) It took me quite a  while to figure out, so for future reference a simple connection schematic :</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/loadcels.png"><img class="alignnone size-full wp-image-907" title="loadcels" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/loadcels.png" alt="" width="700" height="231" /></a></p>
<p>The Hand is easy to replace and has his own Arduino because I wanted it to be exchangeable with something else.<br />
I have a power-line and a USB connection to the hand, so I can replace it with whatever I need.</p>
<h3>The Controller Software</h3>
<p>The robot is controlled by an Arduino who manages the steps for the stepper motors and the acceleration. One of the reasons of it being quite slow is that it has a quite slow acceleration. Though the good old second law of Newton and the relative big mass of the robot it is impossible to stop and start the arm movement fast without  mayor shaking and even tilt it over (this happened <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>I wrote the software for the arm in C++. Just some controls for the axes and some inverse kinematics to control the real world positions, its kind of crappy, but it seems to work fine.</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/robotarmcontroler.png"><img class="alignnone size-full wp-image-886" title="robotarmcontroler" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/robotarmcontroler.png" alt="" width="700" height="416" /></a></p>
<p>Once I did that It was easy to make the robot do pre-programmed stuff. But that&#8217;s kind of boring, so I made a simple program where the robot searches for random placed  cubes and tries to build towers with those.</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/arduinorobotarm.png"><img class="alignnone size-full wp-image-909" title="arduinorobotarm" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/arduinorobotarm.png" alt="" width="700" height="622" /></a></p>
<p>It uses the camera on the hand take pictures of the floor. After that I did some colour and edge detection to search for cubes and then translated the positions in real world, so the robot knows where to find them.</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2014/10/robotscan.png"><img class="alignnone size-full wp-image-887" title="robotscan" src="http://www.neuroproductions.be/wp-content/uploads/2014/10/robotscan.png" alt="" width="700" height="437" /></a></p>
<p>the source code and design files can be found here:</p>
<p><a href="https://github.com/neuroprod/NPBOT" target="_blank">Arduino part</a><br />
<a href="https://github.com/neuroprod/NPBOT_driver" target="_blank">PC part</a><br />
<a href="http://www.neuroproductions.be/uploads/rhino.zip" target="_blank">Rhino files</a> (it&#8217;s a mess)</p>
<p>There is of course much more I could do with it, but I was losing some interested for now. After working a couple of months on this, it&#8217;s time for something new.<br />
I learned a lot and this project got me to some unexplored terrain for me and in the meantime my once clean office turned in a complete Fab lab. So I have a lot of possibilities and new ideas for a next project are beginning to take shape. So stay tuned!</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/6-axis-robot-arm/#comments" thr:count="14"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/6-axis-robot-arm/feed/atom/" thr:count="14"/>
		<thr:total>14</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Arduino Video Game for the Neighbourhood]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/arduino/arduino-video-game/" />
		<id>http://www.neuroproductions.be/?p=805</id>
		<updated>2013-11-25T13:20:46Z</updated>
		<published>2013-11-18T11:38:40Z</published>
		<category scheme="http://www.neuroproductions.be" term="arduino" />		<summary type="html"><![CDATA[My house/office has a store window and I try to make use of it as much as possible. I had [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/arduino/arduino-video-game/"><![CDATA[<p><img class="alignnone size-full wp-image-847" title="arduino_game_ledScreen" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/arduino_game_ledScreen.png" alt="" width="700" height="515" /></p>
<p>My house/office has a store window and I try to make use of it as much as possible. I had some projections etc. in there before, but now I wanted to make something interactive. We have a lot of loitering youth and many people passing by. To appeal to a wide audience, I thought it would be nice to make an old fashion arcade box like thing.</p>
<p>It&#8217;s now on the street for one day and people really seem to like it. Age or background doesn&#8217;t make a difference.</p>
<p>To make it a little bit more challenging,  I thought it would be fun to try to run the hole thing on an Arduino without an external computer. Just to see how much power it actually has. And while I was at it, I decided to try to make everything myself. So I also made my own led screen, with his own &#8220;display driver&#8221; and display list, a 8-bit sound library, and of course the game itself.</p>
<p>The only thing I didn&#8217;t make was the background music for the game, that was composed by the lovely Annegreet Sledsens: Thanks sweety!  You can hear it in the video.</p>
<p>The led screen is very bright which made it very hard to film and photograph with my cheap camera. Even after some photoshopping, I couldn&#8217;t  make it look as good as in real life. So if you&#8217;re in the neighbourhood (Antwerp Belgium, Provinciestraat 60, behind the Zoo), feel free to come check it out and play a game with the locals!</p>
<p>Here the video and some more pics:<br />
<iframe src="//player.vimeo.com/video/80190117?title=0&amp;byline=0&amp;portrait=0" width="700" height="394" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe><br/></p>
<p><img class="alignnone size-full wp-image-840" title="pixelgame" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/pixelgame.png" alt="" width="700" height="469" /><br/></p>
<p><img class="alignnone size-full wp-image-835" title="players2" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/players2.jpg" alt="" width="700" height="466" /><br/></p>
<h3><br/>The Game</h3>
<p><br/><br />
<img class="alignnone size-full wp-image-828" title="screen1" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/screen1.jpg" alt="" width="700" height="124" /></p>
<p>I needed something that would appeal to a large audience (the people in my street) and something was fun to play .<br />
So I took the good old gaming cliché, where the world gets invaded by aliens and you have to fight your way to the end boss, save the world and the human race . With my minimal resolution of 16*90 pixels, I didn&#8217;t have much other choice than making it pixel-art style.</p>
<p>The game has 3 modes, a single-player and a multiplayer brawling/fighting the aliens mode, and an extra fighting mode where the 2 players can battle with each other.</p>
<p>Every mode has just one level, but since it is just a casual &#8220;play on your way to work&#8221; kind of game, I thought it would be more then ok.</p>
<p>some screen-shots:</p>
<p>The game-mode selection:</p>
<p><img class="alignnone size-full wp-image-829" title="screen2" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/screen2.png" alt="" width="700" height="123" /></p>
<p>Two players fighting the the final boss:</p>
<p><img class="alignnone size-full wp-image-867" title="Endboss" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/endboss.png" alt="" width="700" height="123" /></p>
<p>The girl kicking the boys ass in fighting mode:</p>
<p><img class="alignnone size-full wp-image-865" title="kickAss" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/kickAss.png" alt="" width="700" height="123" /></p>
<p>Game over!</p>
<p><img class="alignnone size-full wp-image-866" title="gameOver" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/gameOver.png" alt="" width="700" height="124" /><br/></p>
<h3><br/>Development</h3>
<p><br/><br />
To make the development easy and fast, I cross developed the game as a Cinder c++ app  and an Arduino app, that way i didn&#8217;t had to upload the whole thing on an Arduino every time I wanted to test something.</p>
<p>I didn&#8217;t use any external memory, so I had to store everything on the Arduino.  I made a small app that generates c++ classes from bitmaps with some gamma correction for the led screen. I used indexed colours to save some of that precious SRAM. For driving the leds, I  modified the <a href="https://github.com/adafruit/Adafruit_NeoPixel" target="_blank">Adafruit neopixel lib</a>, to support alpha-blending and make it a little bit faster for my specific case.</p>
<p>I don&#8217;t really have much experience with generating sound and music. So the 8-bit sound was quite challenging. I&#8217;m happy with the result, but my oscilloscope broke during development of a more advanced sound lib, so its quite simple for now. But I really enjoyed  myself working on the sound aspect. I have a feeling that my next project is going to be something sound/music related <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I&#8217;m not going to elaborate too much on the rest of the code. But you&#8217;re free to check the source code yourself  (warning: its messy).</p>
<p>The full source code and game assets on <a href="https://github.com/neuroprod/ArduinoPixels">Github</a> (Code-&gt; MIT, Assets-&gt; CC attribution)<br/></p>
<h3><br/>The Hardware</h3>
<p><br/><br />
Like I said, I made my own led display.</p>
<p>I used strips of  WS2812 LEDs, those are individually-addressable RGB LEDs. The lay in a 16*90 grid (=1440 leds)</p>
<p>I added a laser cut raster over the leds to make the pixels square and put a layer of plexi to diffuse the light some more.</p>
<p><img class="alignnone size-full wp-image-807" title="LedScreenArduino" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/LedScreenArduino.png" alt="" width="700" height="495" /></p>
<p>Beneath the leds is the main Arduino Due and the power source. This is the Arduino that drives the display and runs the game. Those leds suck a lot of power , so I had to add a 60A 5V power supply.</p>
<p><img class="alignnone size-full wp-image-808" title="LedScreenDIYDetail" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/LedScreenDIYDetail.png" alt="" width="700" height="367" /></p>
<p>The screen/main arduino is connected with the arcade box through a simple tx-rx serial line, which was fast enough to send the button commands.</p>
<p>the arcade box is just some painted MDF with a steel frame inside, and a steel plate on-top (it has to be a little bit solid if i leave it outside <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )<br />
The Arduino in the arcade box generates the sound and music and handles the raw button/joystick input.</p>
<p><img class="alignnone size-full wp-image-822" title="arduino_arcade" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/arduino_arcade.png" alt="" width="700" height="348" /></p>
<p>If your interested,  the full &#8220;schematic&#8221; of the project:</p>
<p>Its pretty straight forward.: Pulldowns for the buttons and joystick, the led connections and a pot for the screen brightness and a tx-rx line between the two Arduinos.</p>
<p>on top of that there is a DC coupling for the speaker which is connected to the Arduino DAC . But I still have to put some kind of amplifier between the arduino and the speakers. The sound is hard to hear because of the street noise.</p>
<p><img class="alignnone size-full wp-image-819" title="arduino setup" src="http://www.neuroproductions.be/wp-content/uploads/2013/11/setup1.png" alt="" width="700" height="977" /></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/arduino/arduino-video-game/#comments" thr:count="23"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/arduino/arduino-video-game/feed/atom/" thr:count="23"/>
		<thr:total>23</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Arduino Painting Machine]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/arduino/arduino_android-painting-machine/" />
		<id>http://www.neuroproductions.be/?p=724</id>
		<updated>2013-06-10T15:23:04Z</updated>
		<published>2013-06-10T13:10:51Z</published>
		<category scheme="http://www.neuroproductions.be" term="arduino" />		<summary type="html"><![CDATA[Recently I wrote a hack for the Kinect Hacks book (about this). And I could choose a couple of o&#8217;reilly [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/arduino/arduino_android-painting-machine/"><![CDATA[<p>Recently I wrote a hack for the <a href="http://shop.oreilly.com/product/0636920022657.do" target="_blank">Kinect Hacks</a> book (about <a href="http://www.neuroproductions.be/experiments/furry-photos-with-kinect/" target="_blank">this</a>). And I could choose a couple of o&#8217;reilly books as payment. I wasn&#8217;t really interested in programming books, so I took an arduino and some electronics books. They where quite interesting, so I thought would do something with my new knowledge.</p>
<p>I was always interested to remove the perfection from computer graphics. So thought it would be fun to try to make the most obvious thing first. A machine that uses a paint brush to print a drawing.</p>
<p>It runs on an Arduino DUE  and an Android tablet. </p>
<p>I had a Samsung galaxy note 10.1 laying around from a previous project, so i used that one, The nice thing about that tablet is that it comes with a pen with pressure sensitive input. So I could translate the pen pressure to the brush height/size on my machine for more interesting brush strokes.</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduino_android_painting_full1.jpg"><img class="alignnone size-full wp-image-739" title="arduino_android_painting_full" src="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduino_android_painting_full1.jpg" alt="" width="700" height="444" /></a><br />
A poor video of the machine in action:<br />
<iframe src="http://player.vimeo.com/video/67882372" width="700" height="393" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br />
Its far from perfect, I made a lot of mistakes . But since almost everything I&#8217;ve done for this project was a first time, I&#8217;m still happy with the result <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Physical Setup</h3>
<p>I only have some basic tools. A drill, a jigsaw and a grinder machine and a couple of wrenches. So I improvised a constructions with bolds and nuts that I could adjust as needed. But I learned that precision really is a thing in mechanics so next time I think I&#8217;ll have to extend my tool-set, (and make a plan before I start <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p><img class="alignnone size-full wp-image-740" title="paintingmachine" src="http://www.neuroproductions.be/wp-content/uploads/2013/06/paintingmachine1.jpg" alt="" width="700" height="567" /></p>
<p>For the arduino/electronics part the basic is just some stepper motor drivers (big easy driver) , stepper motors and a servo motor .<br />
Because it was running from an Android tablet, a had to add some displays for debugging, anyway this is the setup I use now:</p>
<p><a href="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduinosetup.jpg"><img class="alignnone size-full wp-image-742" title="arduinosetup" src="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduinosetup.jpg" alt="" width="700" height="790" /></a></p>
<p>The same thing in real life:</p>
<h3><a style="font-size: 13px; font-weight: normal;" href="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduinopaintingdetail.jpg"><img class="alignnone size-full wp-image-736" title="arduinopaintingdetail" src="http://www.neuroproductions.be/wp-content/uploads/2013/06/arduinopaintingdetail.jpg" alt="" width="700" height="269" /></a></h3>
<h3>Some Code stuff</h3>
<h4>Arduino</h4>
<p>the Arduino is really a fun tool and actually quite easy. You write classes for it in basic c++ (no std etc.).<br />
But almost all existing libraries for Arduino use delay() (a sleep that pauses the main and only thread). I don&#8217;t get why they work that way, sure It&#8217;s easy for quick testing, but it makes it impossible to do multiple things at once (like adjusting the brush height while moving the brush in my case)</p>
<p>So I had to write everything myself, the stepper driver, servo driver  and display drivers. so they worked on timesteps instead of sleeps.</p>
<p>Something like this in the main loop:</p>
<pre lang="java">unsigned long timeCurrent=micros();
unsigned long timeElapsed=timeCurrent-timePreviuos;
timePreviuos =timeCurrent;

servo.updateTime(timeElapsed);
stepper.updateTime(timeElapsed);
pauze.updateTime(timeElapsed);
display.updateTime(timeElapsed);
ledDisplay.updateTime(timeElapsed);</pre>
<p>And for example in the servo class:</p>
<pre lang="java">void Servo::updateTime(unsigned long timeStep)
{
  currentTime+=timeStep;

  if(isLow)
  {
    if(currentTime&gt;=waitLow)
    {
      currentTime=0;
      isLow =false;
      digitalWrite(_pin, HIGH); 

    }
  }
  else
  {
    if(currentTime&gt;=  waitHigh)
    {
      currentTime=0;
      isLow =true;
      digitalWrite(_pin, LOW);
    }
  }

}</pre>
<h4>The Android-Arduino communication</h4>
<p>The android connection to the arduino whas quite annoing. I used the naive android USB host, but unlike a regular computer, you don&#8217;t have a driver for the arduino.<br />
So you have to handle the USB connection yourself (send controle bytes etc) and since it took me so long to get it working: a small example (not sure if this is the best way to do it&#8230;)</p>
<p>To make the connection:</p>
<pre lang="java">View.OnClickListener tryConnect = new View.OnClickListener()
{
	public void onClick(View v)
	{
		manager = (UsbManager) getSystemService(Context.USB_SERVICE);
		HashMap deviceList = manager.getDeviceList();
		Iterator deviceIterator = deviceList.values().iterator();
		while (deviceIterator.hasNext())
		{
			UsbDevice device = deviceIterator.next();
			manager.requestPermission(device, mPermissionIntent);
		}
	}
};
private final BroadcastReceiver mUsbReceiver = new BroadcastReceiver()
{
	public void onReceive(Context context, Intent intent)
	{
		String action = intent.getAction();
		if (ACTION_USB_PERMISSION.equals(action))
		{
			synchronized (this)
			{
				device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);

				if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false))
				{
					if (device != null)
					{
						connection = manager.openDevice(device);
						connection.controlTransfer(0x21, 34, 0, 0, null, 0,0);
						connection.controlTransfer(0x21, 32, 0, 0,new byte[] { (byte) 0x80, 0x25, 0x00, 0x00,0x00, 0x00, 0x08 }, 7, 0);

						UsbInterface usbIf = device.getInterface(1);
						for (int i = 0; i &lt; usbIf.getEndpointCount(); i++)
						{
							if (usbIf.getEndpoint(i).getType() == UsbConstants.USB_ENDPOINT_XFER_BULK)
							{
								if (usbIf.getEndpoint(i).getDirection() == UsbConstants.USB_DIR_IN)
									epIN = usbIf.getEndpoint(i);
								else
									epOUT = usbIf.getEndpoint(i);
							}
						}
						if (epIN == null)
						{
							//fail
						}
					}
				} else
				{
					//permision denide
				}
			}
		}
	}
};</pre>
<p>After that, I used an asynctask to send bytes to the arduino and wait for the response (when the command is finished, and android can send a new one)</p>
<pre lang="java">connection.bulkTransfer(epOUT, new byte[] { (byte) command,servoValue,val1B256,val1B1,val2B256,val2B1,speedByte,0}, 8, 0);
new WaitForResult().execute();

private class WaitForResult extends AsyncTask;
{
protected String doInBackground(byte[]... params)
{

    String s2 = "0";
    int len = 0;
    while (len &lt;= 0)
    {
        len = connection.bulkTransfer(epIN, buffer, 40, 5000);
        s2 = new String(buffer);
        try
        {
            Thread.sleep(5);
        }  catch (InterruptedException ie){}
    }
    return s2;
  }
  protected void onPostExecute(String result)
  {
    setResult(result);
  }
}</pre>
<p>The full source code: (this is no production code, just some proof of concept crappy code):<br />
<a href="https://github.com/neuroprod/npPaintingMachine" target="_blank"> https://github.com/neuroprod/npPaintingMachine</a></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/arduino/arduino_android-painting-machine/#comments" thr:count="11"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/arduino/arduino_android-painting-machine/feed/atom/" thr:count="11"/>
		<thr:total>11</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Making a 3D Game with OpenGL: Deferred shading and stuff]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/opengl/making-a-3d-game-with-opengl-deferred-shading-and-stuff/" />
		<id>http://www.neuroproductions.be/?p=674</id>
		<updated>2012-07-20T07:11:33Z</updated>
		<published>2012-07-19T10:40:28Z</published>
		<category scheme="http://www.neuroproductions.be" term="OpenGL" />		<summary type="html"><![CDATA[Lately OpenGL and C++ is pretty much the only thing I do for clients, mostly for installations and iPad apps. [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/opengl/making-a-3d-game-with-opengl-deferred-shading-and-stuff/"><![CDATA[<p>Lately OpenGL and C++ is pretty much the only thing I do for clients, mostly for installations and iPad apps. And that&#8217;s gowning pretty well.  But as a creative code guy, I pretty much stayed in our own tech subculture. But when it comes to cutting edge graphic techniques, we can learn a lot from those other guys, the game developers.</p>
<p>So one sunny afternoon, I decided to do just that and I started to make my own 3D game from scratch.</p>
<p>I wanted to write a blog-post when it was finished. But I hugely underestimated the work (Now I understand why indie gamedevelopers take +3 years to finish a game).  And I&#8217;ve already done so much it wouldn&#8217;t fit in one blog post. So I&#8217;m going to try to make multiple blog-posts, to light out different technical things I&#8217;ve used for my game, and keep you updated about the progress of the game itself.</p>
<h3>The game:</h3>
<p>Or more game engine, since I don&#8217;t really have any game play at the moment:<br />
<iframe src="http://player.vimeo.com/video/46021001?title=0&amp;byline=0&amp;portrait=0" width="700" height="394" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br />
As you can see, there are still a lot of glitches and things to be done, but I&#8217;m happy where it&#8217;s going.</p>
<p>Some of the things I&#8217;ve done so far (not always complete, final or clean).</p>
<p>-The terrain generation, it&#8217;s an infinite/live generated terrain.<br />
-Seamless day-night transitions.<br />
-Cascade shadow maps, SSAO (screen space ambient occlusion).<br />
-Normal maps, alpha textures, alpha shadows.<br />
-Some simple LOD (level of detail) setup for the terrain mesh and the 3D objects.<br />
-Bone animations in the vertex shader + interpolations between the animations. (models are loaded with <a href="http://assimp.sourceforge.net/" target="_blank">Assimp</a>)<br />
-The main part of the rendering pipeline.<br />
-Learned the basics of modeling and animating in Blender <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
-and a lot of other stuff.</p>
<h3>The current Render pipeline</h3>
<p>It&#8217;s very WIP at this moment, but here is a diagram of how the current rendering is done. More about this below.<br />
(click for the full size image, open in new tab if you get the popup)<br />
<a href="http://www.neuroproductions.be/uploads/openglGame/openglRenderPipline_large.jpg" target="_blank"><img class="alignnone" title="Deferred Shading" src="http://www.neuroproductions.be/uploads/openglGame/openglRenderPipline_small.jpg" alt="" /></a></p>
<h3>Deferred Shading:</h3>
<p>One of the things I wanted to try was deferred shading, just for the heck of it. But I&#8217;m really glad I did. Since it seems much faster, and has some additional advantages (there are also some disadvantages)</p>
<h4>How does it work:</h4>
<p>You just render all the main geometry once, In 3 textures. a depth texture, a color texture with just the diffuse. and a color texture with the normals in worldspace.<br />
you can do that in OpenGL all at once, with an FBO (frame buffer object) with multiple color attachments. And since you don&#8217;t do any lightning, its pretty fast. After that, you use those textures to calculate the lighting etc.</p>
<p><img class="alignnone" title="Deferred Shading" src="http://www.neuroproductions.be/uploads/openglGame/DeferredShadingOpengl.jpg" alt="" width="700" height="394" /></p>
<p>The big advantage is that you only have to calculate the lightning on the pixels that are actually visible on the screen. So you have no overhead of overlapping objects. And if you want to do some post processing stuff, like ambient occlusion or depth of field, you already have the depth texture and normal texture in place.</p>
<p>To get back from the depth to the worldspace, you just multiply the screen space with the inverse of the perspective matrix:</p>
<pre lang="GLSL">float depth = texture2D(depthTexture, uv_var).x*2.0-1.0;
vec3 viewSpace ;
viewSpace .xy = uv *2.0 -1.0;
viewSpace.z=depth;
vec4 worldSpace = perspectiveInvMatrix* vec4(viewSpace,1.0);
worldSpace.xyz/=worldSpace.w;</pre>
<p>But what I really liked about it, is that you can have a lot of dynamic lights in your scene. When you use forward shading, your happy if you can use a couple of lights. But but with deferred shading you can have hundreds. You just render the lights as volumes in a separate pass (sphere for a point light, a cone for a spotlight etc). So you only have to calculate the light on the position where it really affects things, and since you use the normal and depth texture as input, only on the geometry you really see.</p>
<p>The light volumes rendered as normal geometrie:</p>
<p><img class="alignnone" title="Deferred Shading Light volumes" src="http://www.neuroproductions.be/uploads/openglGame/deferredShadingLightVolumes.jpg" alt="" width="700" /></p>
<p>The fragment shader calculation I use for the light volumes:</p>
<pre lang="GLSL">vec3 dir = worldPos.xyz-lightCenter; // worldPos from the depth
float l = length( dir);
float dist =1.0-pow((clamp (l ,0.0,lightSize_var)/lightSize_var),2.0); // quick light falloff
float lambert  =clamp(dot(normalize(dir) , -normal ),0.0,1.0); //shading
gl_FragColor = vec4(lightColor *dist * lambert   ,1.0);</pre>
<p>The result of the Light pass:<br />
<img class="alignnone" title="Deferred Shading Light volumes" src="http://www.neuroproductions.be/uploads/openglGame/deferredPointLightPass.jpg" alt="" width="700" /></p>
<p>I just use a blendfunct GL_ONE, GL_ONE (add) for all the lights, although technically not correct. But it looks good enough.<br />
The lights in the final scene:</p>
<p><img class="alignnone" title="Deferred Shading Light volumes" src="http://www.neuroproductions.be/uploads/openglGame/deferredPointLightOpengl.jpg" alt="" width="700" /></p>
<h3>Lambert texutre lookup</h3>
<p>An other neat trick I discovered while doing research for this, is using a Texture to lookup your shading color (found it in the <a href="http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf" target="_blank">Valve Team Fortress 2 Paper</a>).<br />
The great thing about this is that you can edit your shading in photoshop. In my case I used a 2D texture, so I can have al the subtle light differences between day and night.</p>
<p>This is the texture I use now, but it still needs some work:</p>
<p><img class="alignnone" title="Deferred Shading Opengl" src="http://www.neuroproductions.be/uploads/openglGame/lambertMap.jpg" alt="" /></p>
<p>I just use the shading color for the u and the time for the v lookup.</p>
<p>Here is the plain old shading:<br />
<img class="alignnone" title="Deferred Shading" src="http://www.neuroproductions.be/uploads/openglGame/plainShading.jpg" alt="" width="700" /></p>
<p>And the shading after the look-up:<br />
Night:<br />
<img class="alignnone" title="Deferred Shading Opengl" src="http://www.neuroproductions.be/uploads/openglGame/nightShadingOpengGL.jpg" alt="" width="700" /></p>
<p>Day:</p>
<p><img class="alignnone" title="Deferred Shading opengl" src="http://www.neuroproductions.be/uploads/openglGame/dayShadingOpengl.jpg" alt="" width="700" /></p>
<p>That&#8217;s it for now, hopefully some more blog-posts to follow this up <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Source code and assets at <a href="https://github.com/neuroprod/npDeferredS" target="_blank">Github</a> ( at your own risk  )</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/opengl/making-a-3d-game-with-opengl-deferred-shading-and-stuff/#comments" thr:count="14"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/opengl/making-a-3d-game-with-opengl-deferred-shading-and-stuff/feed/atom/" thr:count="14"/>
		<thr:total>14</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Hairy Kinect Pictures]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/furry-photos-with-kinect/" />
		<id>http://www.neuroproductions.be/?p=627</id>
		<updated>2012-04-23T16:26:35Z</updated>
		<published>2012-02-02T16:50:58Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="Generative art" /><category scheme="http://www.neuroproductions.be" term="Source code &amp; tutorials" />		<summary type="html"><![CDATA[You may remember the Furry Santa. That gave me the idea to use the Kinect 3D data to add hair to [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/furry-photos-with-kinect/"><![CDATA[<p>You may remember the <a href="http://www.neuroproductions.be/experiments/3d-fur-renderer/" target="_blank">Furry Santa</a>. That gave me the idea to use the Kinect 3D data to add hair to everything!</p>
<p>Yes, I know, pretty useless <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  . But I like the results :</p>
<p><img class="alignnone" title="fur render kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_fur_black4.png" alt="" /></p>
<p><img class="alignnone" title="fur rendering kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_fur_black2.png" alt="" /></p>
<p><img class="alignnone" title="fur rendering kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_fur_black6.png" alt="" /></p>
<p><img class="alignnone" title="fur rendering kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_fur_black3.png" alt="" /></p>
<h4>How Does it work?</h4>
<p>In short, make an isosurface of the depth output from the Kinect and calculate the normals.</p>
<p><img class="alignnone" title="fur rendering kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_isosurface.png" alt="" /></p>
<p>Then calculate points on the triangles where a hair starts. Now, start growing the hair in the direction of the normal in that point. Add some random and gravity to the growing direction of the hair. And to finish it of, calculate the lightning on every hair segment for a more realistic effect.</p>
<p>Of course, you can also use the pixel data of the Kinect webcam to make hairs in the original object colours. But I liked the black images more.<br />
<img class="alignnone" title="fur rendering kinect" src="http://www.neuroproductions.be/uploads/blog/fur_kinect/kinect_fur_color.png" alt="" /></p>
<p>It&#8217;s uses <a href="http://www.openframeworks.cc/">openFrameworks</a> + it needs the <a href="https://github.com/ofTheo/ofxKinect" target="_blank">ofxKinect</a> addon.</p>
<p>[update] I now got it now running real-time with a geometry shader:<br />
<iframe src="http://player.vimeo.com/video/40855520?title=0&amp;byline=0&amp;portrait=0" width="700" height="525" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>Source code is a real mess, so at your own risk : <a href="https://github.com/neuroprod/kinectHair" target="_blank">Kinect Hair</a>.</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/furry-photos-with-kinect/#comments" thr:count="12"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/furry-photos-with-kinect/feed/atom/" thr:count="12"/>
		<thr:total>12</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[3D Pixel Editor for iPad with source code]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/cube-construct-a-3d-pixel-editor-for-ipad/" />
		<id>http://www.neuroproductions.be/?p=594</id>
		<updated>2012-03-29T14:08:01Z</updated>
		<published>2012-01-25T09:55:52Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="IOS" /><category scheme="http://www.neuroproductions.be" term="Neuro Productions" /><category scheme="http://www.neuroproductions.be" term="Source code &amp; tutorials" />		<summary type="html"><![CDATA[Yeah, blogpost. After a year doing mostly C++/OpenGL for client (installations and iPad games) I decided it was time to release my [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/cube-construct-a-3d-pixel-editor-for-ipad/"><![CDATA[<p>Yeah, blogpost.</p>
<p>After a year doing mostly C++/OpenGL for client (installations and iPad games) I decided it was time to release my own app. Its a 3D pixel editor for the iPad!</p>
<p>Check out the <a title="3D pixel editor for ipad" href="http://www.cubeconstruct.net/" target="_blank">free 3D pixel art iPad app<br />
</a></p>
<p>Watch the video to see it in action:<br />
<iframe src="http://player.vimeo.com/video/35197228?title=0&amp;byline=0&amp;portrait=0" width="700" height="525" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<h3>How did I make it&#8230;</h3>
<p>From scratch, no Flash, Unity, Cocos2D or some other framework (beside some matrix classes I borrowed form Open Frameworks).  Although there is some Objective C in the mix,the main part is done in C++/ OpenGL ES2. Does it make sense to do it like that? Probably not, but hey, you learn a lot by doing it that way and it is pretty fun to do, and in the end I hopefully have some performance advantages.</p>
<p>For the main part of the 2D interface I  use a Flash like displaylist I made (OpenGL ES2/ bitmap based) . Which give me the freedom to create cool interactive interfaces like in Flash and I still have the performance of C++.</p>
<p>Of course you have UIkit and cocos2D etc for  i-devices. But  the main reason I made it  is that it also runs on native mac and windows and can be implemented in Open Frameworks and Cinder etc . Open Frameworks en Cinder are both nice for quick prototyping, they really lack the ability to create pretty interfaces without to much work.</p>
<p>And because you eat your own dog-food, I also use it on I-devices. On the plus side, its OpenglES2, so it can be nicely integrated with high performance 3D content in IOS + if I ever want to port it to a non IOS OS, it shouldn&#8217;t be to much of a problem.</p>
<p>If you have done ActionScript, you probably recognize the classes, like npDisplayObject, npBitmapSprite, npBitmapMovieClip, npEventdispatcher, npEvent, npTouchEvent, npTweener etc. Its far from complete/finished.  But I already used it in several commercial projects. And I implement and optimise things as I need them.</p>
<p>Both the interface and the 3D are rendered first in there own frame buffer object, This gives the main advantage that in most cases, you only have to render one of the two at the same time,  + the cubes are rendered in a multi sample buffer (on iPad 2), with isn&#8217;t necessary for the interface . Sadly Al those frame buffers slows it a little bit down on the Ipad 1 if you have a few cubes. But if you you use a certain amount of cubes, it also becomes an advantage there.</p>
<h3><del>Yes it&#8217;s a paid app, but&#8230;</del></h3>
<p><del>It was a tuff decision for me to make, I always loved to give things away for free. But hey, maybe some of the time I put in it can be paid back this way. So I can make more apps in the future.</del></p>
<p>Screw it, its <a title="3D pixel editor for ipad" href="http://www.cubeconstruct.net/" target="_blank">free !<br />
</a></p>
<p>But no worries, even if its a paid app in the app store , I still decided to open source it. And if you read my blog and have an iPad, you probably can figure out how to build it (it&#8217;s a complete xcode project)<br />
You get the source code <a href="https://github.com/neuroprod/CubeBuilder" target="_blank">here</a> (Of course,  <a title="3D pixel editor" href="http://www.cubeconstruct.net/" target="_blank">buying</a> a copy would be appreciated  <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/cube-construct-a-3d-pixel-editor-for-ipad/#comments" thr:count="4"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/cube-construct-a-3d-pixel-editor-for-ipad/feed/atom/" thr:count="4"/>
		<thr:total>4</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[WebGL Tadpoles]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/webgl-tadpoles/" />
		<id>http://www.neuroproductions.be/?p=557</id>
		<updated>2013-11-26T13:25:27Z</updated>
		<published>2011-08-14T10:32:37Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="WebGL" />		<summary type="html"><![CDATA[Its been a while since my latest blog post, I spend this year renovating my new house and office. I [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/webgl-tadpoles/"><![CDATA[<p>Its been a while since my latest blog post, I spend this year renovating my new house and office. I also became more and more frustrated by the slow speed of Flash for my experiments, so I started learning C++ and OpenGL. Which is coming along fine now. I made a C++-OpenGL Kinect installation for a client, made an IPad app in C++ and OpenGL ES2 etc.</p>
<p>And although I still do a lot of Flash development for clients, I kind of lost track on what&#8217;s happening on the web. So I was surprised to see what has become of WebGL. And with OpenGL more and more becoming my new love, I thought I give it a try and remake a C++ experiment I did in JavaScript.</p>
<p>It uses derivatives in the shader, which is an optional extension in the WebGL specifications, and as far is I can see, its only supported by Chrome at the moment. If you have the HTML5 audio API enabled, it reacts to the music (very basic, just some speed adjustments).<br />
<a href="http://www.neuroproductions.be/webgl/tadPoles/" target="_blank"><br />
<img src="http://www.neuroproductions.be/uploads/blog/webgl_hatchshader.jpg" alt="" /></a></p>
<h4><a href="http://www.neuroproductions.be/webgl/tadPoles/" target="_blank">» Visit the experiment (needs Google Chrome)</a></h4>
<p><br/></p>
<p>The 30 tadpoles are Inverse Kinematic chains moving in a 3D Perlin Noise vector field. And since they aren&#8217;t static objects, I have to project the vertics and calculate the normals every frame in JavaScript. In that sense, the JavaScript speed is reasonable. But as always, I was hoping for more. In C++ I can easily render +500 tadpoles with 4 times as many triangles per tadpole . It should be interesting to see how fast Flash can do this&#8230; maybe I try that later.</p>
<p>To get some anti-alias, I render it first in a  frame buffer object 9 times the window size (width*3, height*3). So, no complaints about the WebGL speed&#8230; for now&#8230; <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/webgl-tadpoles/#comments" thr:count="5"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/webgl-tadpoles/feed/atom/" thr:count="5"/>
		<thr:total>5</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[A take on Generative Art]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/generative-art/a-take-on-generative-art/" />
		<id>http://www.neuroproductions.be/?p=452</id>
		<updated>2011-08-14T10:36:05Z</updated>
		<published>2010-11-02T12:53:32Z</published>
		<category scheme="http://www.neuroproductions.be" term="Flash 3D" /><category scheme="http://www.neuroproductions.be" term="Generative art" />		<summary type="html"><![CDATA[Ok, I did some generative art-like things before. But it was never my goal, they where always somehow the side [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/generative-art/a-take-on-generative-art/"><![CDATA[<p>Ok, I did some generative art-like things <a title="generative art image distortion" href="http://www.neuroproductions.be/experiments/blowing-up-images/" target="_blank">before</a>. But it was never my goal, they where always somehow the side effect of experimenting with code.</p>
<p>But recently I did a nice project for <a href="http://www.littlemissrobot.com/">Little Miss Robot</a>. They asked me to make an Air application that generates images with code. At that point the code didn&#8217;t really mater. The only thing that counted was the result.</p>
<p>Some of the type of pictures the application creates (click to enlarge):<br />
<a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/genrative_triangles2.png"><br />
<img title="generative triangles 1" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/genrative_triangles2_small.jpg" alt="generative art, perlin noise, delaunay triangulation" width="700" /></a></p>
<p><a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/genrative_triangles.png"><br />
<img title="generative triangles 2" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/genrative_triangles_small.jpg" alt="generative art, perlin noise, delaunay triangulation" width="700" /></a></p>
<p>(no source code for now, but think Perlin Noise and Delaneay triangulation <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) Ill update this post when the app is available. In the meantime, there is a <a href="http://www.vimeo.com/15872096" target="_blank">video</a>.</p>
<p>This whas a big difference in mindset for me. The code was just the medium, not the goal, and I actually liked the approach of making interesting images instead of making interesting code.</p>
<p>I looked around on the internet to see what was actually going on in the <a href="http://www.flickr.com/groups/generatorx/" target="_blank">generative art scene</a>. And one thing I noticed is that a lot of people use photos to extract colours and/or shapes for there art (I also did it).  Which makes a lot of sense, photos always have a nice natural colour scheme. But with everything I saw that uses this technique, the source pictures got somehow lost.  So this gave me the idea to extend the original pictures instead of just using them.</p>
<p>Some results of exploring that concept (click to enlarge):</p>
<p><a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_lines2.png"><br />
<img title="generative lines 1" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_lines2_small.jpg" alt="generative art, perlin noise" width="700" /></a></p>
<p><a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_lines.png"><br />
<img title="generative lines 2" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_lines_small.jpg" alt="generative art, perlin noise" width="700" /></a></p>
<p>Original (public domain) pictures:<br />
<a href="http://www.flickr.com/photos/library_of_congress/2179909780/">http://www.flickr.com/photos/library_of_congress/2179909780/</a><br />
<a href="http://www.flickr.com/photos/library_of_congress/2179146618/">http://www.flickr.com/photos/library_of_congress/2179146618/</a></p>
<p>Source code:  [download#2#nohits]</p>
<p>An other thing I saw where beautiful 3d structures (mostly made with <a title="3D generative art" href="http://structuresynth.sourceforge.net/" target="_blank">structuresynth</a> and rendered with <a href="http://sunflow.sourceforge.net/" target="_blank">sunflow</a>) So I thought it would be nice to make stuff like that in Flash.</p>
<p>Creating 3D structures ain&#8217;t a problem, but two things I really wanted for my renders where depth of field and ambient occlusion. So I messed a round with depth-maps to create screen-space ambient occlusion and custom blur filters for the depth of field. But the result wasn&#8217;t really satisfying. To get a good result I had to ray trace my structures.  Creating a ray tracer in ActionScript seemed like an interesting challenge, so that&#8217;s what I did&#8230;</p>
<p>Some of the ray traced images (click to enlarge) :<a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/fries_generative_art_full.jpg"><br />
<img title="generative art 3D 1" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/fries_generative_art.jpg" alt="generative art, perlin noise, 3D flash ray-tracer" width="700" /></a><br />
<a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_art_cubes_full.jpg"><br />
<img title="generative art 3D 1" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_art_cubes.jpg" alt="generative art, perlin noise, 3D flash ray-tracer" width="700" /></a><br />
Making a ray tracer is quit addictive, and soon I wasn&#8217;t satisfied with my limited feature set and at this point I don&#8217;t feel I have explored those 3D structures enough. So in the next post (coming very soon&#8230;) some more renders and more about the ray tracer + the ray tracer source code. So, stay tuned <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>And finally, a little preview of things to come ( I admit, the shading is a little bit overdone :p ):<br />
<a rel="shadowbox" href="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_art_pipes_full.jpg"><br />
<img title="generative triangles 2" src="http://www.neuroproductions.be/uploads/blog/examples/generative_art_exp/generative_art_pipes.jpg" alt="generative art, perlin noise, delaunay triangulation" width="700" /></a></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/generative-art/a-take-on-generative-art/#comments" thr:count="12"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/generative-art/a-take-on-generative-art/feed/atom/" thr:count="12"/>
		<thr:total>12</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Blowing Up Images]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/blowing-up-images/" />
		<id>http://www.neuroproductions.be/?p=384</id>
		<updated>2010-06-08T15:41:34Z</updated>
		<published>2010-06-06T17:17:01Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="Generative art" /><category scheme="http://www.neuroproductions.be" term="Source code &amp; tutorials" /><category scheme="http://www.neuroproductions.be" term="generative_art" /><category scheme="http://www.neuroproductions.be" term="perlin_noise" />		<summary type="html"><![CDATA[After my previous experiment I thought those shapes that were created looked kinda cool. But those were optimised for speed.  [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/blowing-up-images/"><![CDATA[<p>After <a title="perlin noise transitions" href="http://www.neuroproductions.be/experiments/particle-transition/" target="_blank">my previous experiment</a> I thought those shapes that were created looked kinda cool. But those were optimised for speed.  So this time I tried the same effect but now I aimed for a better quality.</p>
<p>Source code: [download#28#nohits]</p>
<p>The result of a Sunday afternoon rendering:</p>
<p><img class="alignnone" title="generative art perlin noise 5" src="http://www.neuroproductions.be/uploads/blog/examples/noise_generative_art/generative_art_4.png" alt="generative art noise 4" width="700" /></p>
<p><img class="alignnone" title="generative art perlin noise 6" src="http://www.neuroproductions.be/uploads/blog/examples/noise_generative_art/generative_art_6.png" alt="generative art noise 4" width="700" /></p>
<p><img class="alignnone" title="generative art perlin noise 7" src="http://www.neuroproductions.be/uploads/blog/examples/noise_generative_art/generative_art_7.png" alt="generative art noise 5" width="700" /></p>
<p><img class="alignnone" title="generative art  perlin noise 2" src="http://www.neuroproductions.be/uploads/blog/examples/noise_generative_art/generative_art_5.png" alt="generative art noise 2" width="700" /></p>
<p><img class="alignnone" title="generative art noise 1" src="http://www.neuroproductions.be/uploads/blog/examples/noise_generative_art/generative_art_3.png" alt="generative art noise 1" width="700" height="515" /></p>
<p>Update:</p>
<p><a href="http://nocreativity.com/blog/" target="_blank">Ronny Welter</a> used my source code to make a cool video of the rendering process. Now you really see how its created and why I called this post &#8220;Blowing Up Images&#8221; . I also love how he added the shadow so it look like its 3D. Great job Ronny!</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="700" height="394" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=12379381&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="700" height="394" src="http://vimeo.com/moogaloop.swf?clip_id=12379381&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/blowing-up-images/#comments" thr:count="28"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/blowing-up-images/feed/atom/" thr:count="28"/>
		<thr:total>28</thr:total>
	</entry>
		<entry>
		<author>
			<name>Kris</name>
					</author>
		<title type="html"><![CDATA[Particle Transition]]></title>
		<link rel="alternate" type="text/html" href="http://www.neuroproductions.be/experiments/particle-transition/" />
		<id>http://www.neuroproductions.be/?p=368</id>
		<updated>2013-06-07T12:16:44Z</updated>
		<published>2010-06-05T12:28:33Z</published>
		<category scheme="http://www.neuroproductions.be" term="Experiments" /><category scheme="http://www.neuroproductions.be" term="Generative art" /><category scheme="http://www.neuroproductions.be" term="Source code &amp; tutorials" /><category scheme="http://www.neuroproductions.be" term="bitmapdata" /><category scheme="http://www.neuroproductions.be" term="perlinnoise" /><category scheme="http://www.neuroproductions.be" term="perlin_noise" />		<summary type="html"><![CDATA[It&#8217;s been quite silent on this blog lately. The main reason is that I have a lot of work for [...]]]></summary>
		<content type="html" xml:base="http://www.neuroproductions.be/experiments/particle-transition/"><![CDATA[<p>It&#8217;s been quite silent on this blog lately. The main reason is that I have a lot of work for clients (Some great stuff, maybe i&#8217;ll post some of that later). That&#8217;s good for me, but not for my site. To break the silence, a very small test I made. It&#8217;s not that special, but it looks pretty cool, I think&#8230;</p>
<p>It&#8217;s dynamic, but it needs some pre-rendering. so the sliders update in the next animation sequence.</p>
<p>[kml_flashembed publishmethod="static" fversion="10.0.0" useexpressinstall="true" movie="http://www.neuroproductions.be/uploads/blog/examples/particleTrans/SmokeTransition.swf" width="700" height="520" targetclass="flashmovie" align="left" play="false" loop="false" menu="false" quality="high" scale="noscale" salign="tl" wmode="window" bgcolor="#ffffff" devicefont="true" seamlesstabbing="true" swliveconnect="false" allowfullscreen="true" allowscriptaccess="always" allownetworking="all"]</p>
<p><a href="http://adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<p>[/kml_flashembed]</p>
<p>In short, I create particles of every pixel. I pre-render the out animation of the in and out bitmap with the same Perlin Noise. Then I animate them over each other.</p>
<p>Check the source code for the details <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Source code: [download#27#nohits]</p>
<p>Edit: sometimes the example  doesn&#8217;t work in the browser (blame twitter, and there ever changing crossdomain policy <img src='http://www.neuroproductions.be/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
]]></content>
		<link rel="replies" type="text/html" href="http://www.neuroproductions.be/experiments/particle-transition/#comments" thr:count="6"/>
		<link rel="replies" type="application/atom+xml" href="http://www.neuroproductions.be/experiments/particle-transition/feed/atom/" thr:count="6"/>
		<thr:total>6</thr:total>
	</entry>
	</feed>
