<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>talino.org &#187; Tutorials</title>
	<atom:link href="http://www.talino.org/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.talino.org</link>
	<description>Permanently under construction</description>
	<lastBuildDate>Sat, 24 Sep 2011 07:42:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Turning an iPhone/iPad into a studio recording light</title>
		<link>http://www.talino.org/tutorials/turning-an-iphoneipad-into-a-studio-recording-light/</link>
		<comments>http://www.talino.org/tutorials/turning-an-iphoneipad-into-a-studio-recording-light/#comments</comments>
		<pubDate>Sat, 25 Sep 2010 21:19:07 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[OSC]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[recording]]></category>

		<guid isPermaLink="false">http://www.talino.org/?p=396</guid>
		<description><![CDATA[<a href="/tutorials/turning-an-iphoneipad-into-a-studio-recording-light/"><img class="alignleft" src="/resources/images/tutorials/OSC/OSC-thumb.PNG" alt="" /></a>A functional example of OSC address rewrites: using TouchOSC and OSCulator to add a Recording Light behavior to an iOS device.]]></description>
			<content:encoded><![CDATA[<p>In the last couple of years, two ingenious pieces of software — Camille Troillard&#8217;s <a href="http://www.osculator.net/">OSCulator</a> and Hexler&#8217;s <a href="http://hexler.net/software/touchosc">TouchOSC</a> — have had a tremendous influence on the way musicians, composers and performers can interact with computers. Gone are the days of dedicated hardware controllers, which always seem to either have flimsy knobs, not enough pixels on their LCDs or two or three faders less than the amount you&#8217;d be comfortable with (when they don&#8217;t, they cost <a href="http://www.jazzmutant.com/lemur_overview.php">a couple of thousands of dollars</a>). As with any new and experimental technology, the whole thing is in active development and many concepts are either hard to grasp or difficult to implement. Surprisingly, most of the stuff you&#8217;re likely to need is already working perfectly well and very easy to set up.<br />
<span id="more-396"></span><br />
If you&#8217;ve never tried any of this fancy OSC stuff, please have a look at the official OSCulator and TouchOSC documentation (which are pretty basic and incomplete at this stage). Then experiment with some of your own inventions. Then come back.</p>
<p>One of the difficult things to handle, for me at least, has been bidirectional communication between the interface (TouchOSC) and the sound generator (Logic Pro, in my case). Translating OSC events from TouchOSC to MIDI messages that Logic Pro can understand is fairly easy, thanks to OSCulator. However, getting things such as toggle buttons to work properly and reliably is something that has proven to be somewhat intellectually challenging (in a <a href="http://en.wikipedia.org/wiki/Riemann_hypothesis">relative way</a>, of course). I was therefore quite happy when I discovered I could find still another use for an iPhone, iPod Touch or – better still – iPad: a fully-functional recording light. You&#8217;ve seen it all over the place: the kind of luminescent fixture which says &#8220;ON AIR&#8221; or &#8220;RECORDING&#8221; or something to that effect, and which essentially warns the person about to open the door to the studio that the tape (or what&#8217;s left of it these days) is currently running. This tutorial will show how you can turn your $200-$700 iOS device into a recording light, saving you <a href="http://www.markertek.com/Studio-Gear/Studio-Warning-Lights-Signs/340-ON-AIR.xhtml?MWL-2">at least $111</a> in the process (and helping you show your clientèle how hip, classy or frivolous you are by hanging iPads and iPhones all over your studio).</p>
<p>I&#8217;d also like to point out that TouchOSC is $4,99 and OSCulator is around $20. Plus you get to pick up your recording light at the end of the day to check your mail.</p>
<p><a href="http://www.talino.org/wp/wp-content/uploads/2010/09/OSC-TouchOSC.png" rel="lightbox[396]"><img class="aligncenter size-medium wp-image-398" title="OSC-TouchOSC" src="http://www.talino.org/wp/wp-content/uploads/2010/09/OSC-TouchOSC-300x203.png" alt="" width="300" height="203" /></a></p>
<p>Start by designing your recording light. With the free TouchOSC Editor, this is easy. I named the page &#8220;RecordingLight&#8221;, added a couple of Toggle Buttons (called, surprisingly, &#8220;toggle1&#8243; and &#8220;toggle2&#8243; in my setup). They won&#8217;t be used for input — obviously the recording light will be protected behind a glass fixture. I&#8217;ve also created a &#8220;Label V&#8221; object which will, soon enough, hold a &#8220;RECORDING&#8221; text string (it&#8217;s a V object rather than an H because the entire Layout Orientation is horizontal, a quirk which should someday be fixed). The label&#8217;s text size has been set to 70, but the text string itself is empty, so that nothing is displayed unless recording is taking place. Upload the TouchOSC file into the iOS device as usual.</p>
<p>Now, in Logic Pro, add a Recording Light control surface device (Logic Pro &gt; Preferences &gt; Control Surfaces &gt; Setup&#8230;, then go through New &gt; Install &gt; (other) Recording Light). Set the device&#8217;s Out Port to &#8220;OSCulator In (8000)&#8221; (presuming you&#8217;re using the defaults) and the Input to &#8220;OSCulator Out&#8221;. This makes sure the device&#8217;s bidirectional communication is going through OSCulator.</p>
<p><a href="http://www.talino.org/wp/wp-content/uploads/2010/09/OSC-RecodringLight.png" rel="lightbox[396]"><img class="aligncenter size-medium wp-image-399" title="OSC-RecodringLight" src="http://www.talino.org/wp/wp-content/uploads/2010/09/OSC-RecodringLight-300x103.png" alt="" width="300" height="103" /></a></p>
<p>With this basic setup out of the way, start recording in Logic. If everything is working properly, OSCulator will add a new event based on what it received from Logic. It should be something akin to &#8220;/midi/note/2&#8243; with three parameters (pitch, velocity and trigger). Click on &#8220;0: pitch&#8221; and select Edit &gt; Demux. Then start recording in Logic again. The event in OSCulator will change to the specific note sent by the Recording Light device: &#8220;/midi/note/2 &gt; 25&#8243;.</p>
<p>If you&#8217;d like to know what&#8217;s happening in more detail, use Kurt Revis&#8217; excellent (and free) <a href="http://www.snoize.com/MIDIMonitor/">MIDI Monitor</a> software. This will show you that the &#8220;Recording Light&#8221; control surface in Logic simply sends a C#0 Note On message when recording, and a corresponding Note Off message when recording stops.</p>
<p>Now we need to tell OSCulator to send these events to the two toggle buttons we&#8217;ve created in TouchOSC so that they light up at the proper time. On the &#8220;1: trigger&#8221; line, select the Event Type &#8220;OSC Routing&#8221;. This means we&#8217;ll be translating the MIDI event into a custom address (or destination). Under &#8220;Value&#8221; select New and create a new Rewrite address called &#8220;/RecordingLight/toggle1&#8243; (remember, this is the name we gave to the first toggle button in TouchOSC). Then duplicate the &#8220;1: trigger&#8221; event by pressing Command-D. This allows us to send the trigger to another control, the &#8220;toggle2&#8243; button. Under &#8220;Value&#8221;, select New and add a Rewrite address called &#8220;/RecordingLight/toggle2&#8243;. The toggle buttons in TouchOSC will automatically react properly to Note On and Note Off messages.</p>
<p>Finally, when recording takes place, we&#8217;d want the (initially) empty label we created to say &#8220;RECORDING&#8221;. This should be replaced by an empty string when recording stops and needs to be set up manually. The two different message rewrites will be defined using an option in OSCulator&#8217;s Route Editor. Duplicate the &#8220;1: trigger&#8221; once more and set its Rewrite address to &#8220;/RecordingLight/label1&#8243;. Double-click on the &#8220;Arguments&#8221; cell, delete everything in the Arguments field that pops up and type RECORDING followed by a space. This will have the effect of setting the label1 control to the string &#8220;RECORDING&#8221; whenever recording in engaged in Logic. At the bottom of the window, set &#8220;Route when&#8221; to &#8220;The value goes from 0 to positive&#8221;.</p>
<p>Duplicate the &#8220;1: trigger&#8221; event one last time and set its Value to the new Rewrite address &#8220;/RecordingLight/label1&#8243; with a new argument: Alt-Space (the only way I could figure out of sending an empty string to TouchOSC – it will look a bit funny in OSCulator but it works). Set the options to Route when &#8220;The value goes from positive to 0&#8243;. This will make sure the empty string is set when recording is stopped.</p>
<p>The above setup works flawlessly in Logic. The on/off states of the recording look like this, assuming you&#8217;ve hanged your iOS device somewhere in sight:</p>
<div id="attachment_404" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.talino.org/wp/wp-content/uploads/2010/09/recording0.jpg" rel="lightbox[396]"><img class="size-medium wp-image-404 " title="recording0" src="http://www.talino.org/wp/wp-content/uploads/2010/09/recording0-300x182.jpg" alt="" width="300" height="182" /></a><p class="wp-caption-text">Off</p></div>
<div id="attachment_406" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.talino.org/wp/wp-content/uploads/2010/09/recording11.jpg" rel="lightbox[396]"><img class="size-medium wp-image-406" title="recording1" src="http://www.talino.org/wp/wp-content/uploads/2010/09/recording11-300x210.jpg" alt="" width="300" height="210" /></a><p class="wp-caption-text">On</p></div>
<p>This is a pretty basic application of using TouchOSC to fake an &#8220;official&#8221; control surface in Logic. I was trying to do the same thing with more complex devices, hoping to remote control Logic with a customized interface. By that I mean, of course, proper bidirectional communication (such as getting Cycle, Metronome &amp; Record buttons to stay lit and mirror the state of the sequencer, or displaying SMPTE timecode). Remote controlling Logic with simple one-way messages in TouchOSC is another story, is very easy to do and has been done many times.</p>
<div id="attachment_410" class="wp-caption aligncenter" style="width: 210px"><a href="http://www.talino.org/wp/wp-content/uploads/2010/09/LogicRemote1.png" rel="lightbox[396]"><img class="size-medium wp-image-410" title="LogicRemote" src="http://www.talino.org/wp/wp-content/uploads/2010/09/LogicRemote1-200x300.png" alt="" width="200" height="300" /></a><p class="wp-caption-text">A one-way remote controller</p></div>
<p>The devices I&#8217;ve tried to analyze — Mackie Control, Logic Control, iControl and TranzPort — all proved difficult to emulate with the current state of OSCulator and TouchOSC documentation. Whether using SysEx or Continuous Controller events, the above devices&#8217; messaging schemes are a pain to figure out and translate both ways properly (at least in the limited time I have for such experiments). If anyone cares to study further I&#8217;d be glad to hear about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/turning-an-iphoneipad-into-a-studio-recording-light/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Install Python 2.6.1 without trashing Ubuntu</title>
		<link>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/</link>
		<comments>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 20:33:01 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.talino.org/?p=105</guid>
		<description><![CDATA[<a href="/tutorials/install-python-261-without-trashing-ubuntu/"><img class="alignleft" src="/resources/images/tutorials/python261-ubuntu/thumbs/python261-ubuntu.jpg" alt="" /></a>Getting an independent Python 2.6.1 version running smoothly on <a href="http://www.ubuntu.com/">Ubuntu 8.10 ("Intrepid")</a>, without interfering with the system's reliance on Python 2.5 and without breaking the entire package dependency system.]]></description>
			<content:encoded><![CDATA[<p><a href="/tutorials/install-python-261-without-trashing-ubuntu/"><img class="alignleft" src="/resources/images/tutorials/python261-ubuntu/thumbs/python261-ubuntu.jpg" alt="" /></a>After <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10870&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">several</a> <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10924&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">trials</a> and <a href="http://python-forum.org/pythonforum/viewtopic.php?f=1&amp;t=10958&amp;start=0&amp;sid=a3a82a1171e4cd15e6544735d79d9f56">tribulations</a>, I finally managed to get an independent Python 2.6.1 version running smoothly on <a href="http://www.ubuntu.com/">Ubuntu 8.10 (&#8220;Intrepid&#8221;)</a>, without interfering with the system&#8217;s reliance on Python 2.5 and without breaking the entire package dependency system. The procedure described here has been successfully carried out on the <a href="http://www.geteasypeasy.com/">Easy Peasy</a> distribution of Ubuntu (ex-&#8221;Ubuntu-eee&#8221;), specifically tailored for the <a href="http://eeepc.asus.com/">Asus EEE-PC</a>. It should work, though, with any other 8.10 version of Ubuntu. It has also been tested successfully on Ubuntu 8.04 (&#8220;Hardy&#8221;).<br />
<span id="more-105"></span><br />
A lot of the following information will be obvious to people with a thorough knowledge of both Linux and Python. However, coming from Mac OSX, things haven&#8217;t been that obvious. For the poor souls who will be frantically googling for &#8220;zlib&#8221;, &#8220;zipimport.ZipImportError&#8221;, &#8220;setuptools&#8221;, &#8220;ipython&#8221;, &#8220;readline&#8221; and &#8220;ubuntu&#8221;, I offer a series of steps which, so far, haven&#8217;t disturbed the operating system and allow one to run the essential <a href="http://ipython.scipy.org/moin/">IPython</a> environment (and a lot more) without pulling one&#8217;s hair out. It&#8217;s actually quick and easy and involves no hacking whatsoever (I wouldn&#8217;t know how to hack either Python or Linux anyhow).</p>
<p>DISCLAIMER: My knowledge of linux is superficial. I write the following with the intent of helping out newbies such as myself. Do not hold me reponsible if you follow my method and end up with a system that&#8217;s pushing up the daisies.</p>
<p>NOTE: This method has been tested on <a href="http://www.gnome.org/">GNOME</a>, the default desktop environment for my distribution. I haven&#8217;t tried it with <a href="http://www.kde.org/">KDE</a> and, now that it&#8217;s finally working, I don&#8217;t think I will.</p>
<p>ACKNOWLEDGEMENT: I would never have gotten Python 2.6.1 and Ubuntu to work together if it hadn&#8217;t been for the precious help of wacky, a member of the <a href="http://www.python-forum.org/pythonforum/index.php">Python forum</a>, who saw me through several nightmarish reinstallations of both Ubuntu and Python. Several of his suggestions have been incorporated into the steps below.</p>
<p>I suggest you read through the entire list of steps so that you have an idea of what&#8217;s going to happen before actually running any command.</p>
<ol>
<li>Install a fresh copy of Ubuntu 8.10 if your system has been hopelessly pulverized by repeated tests, errors and packages scattered in the wrong places.</li>
<li>Before doing anything directly related to Python, you need to install the packages listed below. The list is an amalgam of several suggestions I found around the web, so one package or more might not be absolutely essential. But since it works, here&#8217;s the list:
<ul>
<li>build-essential</li>
<li>libncursesw5-dev</li>
<li>libreadline5-dev</li>
<li>libssl-dev</li>
<li>libgdbm-dev</li>
<li>libbz2-dev</li>
<li>libc6-dev</li>
<li>libsqlite3-dev</li>
<li>libdb-dev</li>
<li>tk-dev</li>
</ul>
<p>The easiest way to install a package is to use the <em>aptitude</em> command. Make sure you&#8217;re connected to the internet, open a terminal session and type the following: <code>sudo aptitude install package-name</code> You will be prompted for your password the first time you invoke the <em>sudo</em> command, which executes everything typed after it as a &#8220;superuser&#8221; (or &#8220;root&#8221; user). Instead of entering the command for each and every package, you can may prefer to enter them all at once (all of the following should be typed on a single line): <code>sudo aptitude install build-essential libncursesw5-dev libreadline5-dev libssl-dev libgdbm-dev libbz2-dev libc6-dev libsqlite3-dev libdb-dev tk-dev</code></li>
<li>Download and extract the <a href="http://www.python.org/download/">Python 2.6.1 source</a>. From inside the source directory, enter (still and always, one single line):<br />
<code>./configure --prefix=/home/yourusername/python/2.6</code>This will setup Python to install into a &#8216;python/2.6&#8242; directory inside your home directory, far away from anything system-like. You may choose to simply name the directory &#8216;python&#8217;, but the &#8217;2.6&#8242; subdirectory will help separate the installation from yet another custom setup, such as version 3.0, if you ever need to install one. Note, though, that this doesn&#8217;t mean I&#8217;ve tested the steps described in this tutorial with Python 3.0.</li>
<li>Compile Python with the standard command:<code>make</code>When the compile process finishes, read the few last lines it printed: you might get a couple of modules which can&#8217;t be found. I don&#8217;t remember their names but from searching around I gather that a lot of people can&#8217;t seem to find them and that nobody really cares. Most importantly, make sure that you don&#8217;t get a module missing error for <em>zlib</em> or <em>readline</em>, which are essential for the following steps. The packages installed previously will have taken care of that, though.</li>
<li>Install Python. I tried to do a <em>make altinstall</em> (after going through the Python source readme file), but for some reason I ended up without an executable. So just go through a regular install. Since you&#8217;re installing the Python files into your home directory, you don&#8217;t need to use <em>sudo</em>:<br />
<code>make install</code></li>
<li>Now, if you enter <em>python</em> in the terminal you should get the default Python version that comes with Ubuntu (currently 2.5.2). Typing <em>which python</em> should point to /usr/bin/python, not to the directory you just installed 2.6.1 into. All of this is normal and is actually what you&#8217;re looking for.</li>
<li>Optional: if you need an additional Python module (such as <a href="http://numpy.scipy.org/">Numpy</a>), install it from its source directory by typing: <code>/home/yourusername/python/2.6/bin/python setup.py install --prefix=/home/yourusername/python/2.6</code> This runs the setup script using the 2.6.1 interpreter and installs the module into the 2.6.1 directory structure (since we&#8217;re using the same prefix we specified when installing Python itself).</li>
<li>Create a symbolic link to the 2.6.1 interpreter so that the next step doesn&#8217;t blow up in your face: <code>sudo ln -s /home/yourusername/python/2.6/bin/python /usr/local/bin/python2.6</code> It is important that you <strong>do not</strong> use a different name of your fancy for the link. Now, if you enter <em>python</em> you&#8217;ll still have 2.5.2, whereas entering <em>python2.6</em> will launch, well, 2.6.1. This will also make sure that non-system versions of Python have to be run explicitly. Keeping the &#8216;python&#8217; command reserved for the exclusive use of the system&#8217;s Python version is likely to avoid headaches in the future.</li>
<li>In order to use the <em>easy_install</em> command which facilitates the installation of additional modules, you first need to install <a href="http://peak.telecommunity.com/DevCenter/setuptools">setuptools</a>: download the <a href="http://pypi.python.org/pypi/setuptools#downloads">egg file</a> for Python 2.6 and enter: <code>sh setuptools-0.6c9-py2.6.egg</code> This is the reason why the symbolic link created in the previous step must be called &#8216;python2.6&#8242; (the setuptools script runs a <em>python2.6 exec</em> command and will complain about a missing 2.6 version if it&#8217;s not linked with &#8216;python2.6&#8242;).</li>
<li>Optional but highly recommended: install <a href="http://ipython.scipy.org/moin/">IPython</a>, an enhanced command-line environment for Python. Do not download anything manually. With <em>setuptools</em> installed, you can simply go into your Python <em>bin</em> directory (with <em>cd /home/yourusername/python/2.6/bin</em>) and type: <code>./easy_install IPython</code>Apparently you may also enter the following directly, which saves you the directory switching part: <code>easy_install-2.6 IPython</code> I haven&#8217;t tried it myself, though. Anyway, download and install will be automatic.</li>
<li>You have to add the path to IPython to your terminal environment, so that the executable can be launched from any directory. Add the following line to the end of the <em>.bashrc</em> file which is located in your home directory. <code>PATH=$PATH:/home/yourusername/python/2.6/bin</code> I suppose you could create a symbolic link instead but i haven&#8217;t tried it.</li>
<li>If you use <a href="http://www.geany.org/">Geany</a> for Python development, you need to edit one of its configuration files so that the application&#8217;s <em>Run</em> command executes the proper interpreter: <code>sudo gedit /usr/share/geany/filetypes.python</code> Modify the <em>run_cmd</em> line to read: <code>run_cmd=python2.6 "%f"</code> This will use the symbolic link you created earlier.</li>
</ol>
<p>You can now run IPython, develop in the Geany IDE, and still install packages through aptitude or the Synaptic Package Manager without all hell breaking loose. If you&#8217;re using a tiny screen and touchpad I strongly recommend installing <a href="http://do.davebsd.com/">GNOME Do</a> to avoid mousing around too much. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/install-python-261-without-trashing-ubuntu/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Faking Global Illumination</title>
		<link>http://www.talino.org/tutorials/gi/</link>
		<comments>http://www.talino.org/tutorials/gi/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 13:57:31 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://192.168.0.4:8888/tutorials/gi/</guid>
		<description><![CDATA[<a href="/tutorials/gi/"><img class="alignleft" src="/resources/images/tutorials/gi/thumbs/gi.jpg"/></a>Instead of waiting 27 hours for a Global Illumination render to finish, it's possible to achieve realistic results by faking natural light. There are a zillion techniques for achieving that. Here's one of them.]]></description>
			<content:encoded><![CDATA[<p><a href="/tutorials/gi/"><img class="alignleft" src="/resources/images/tutorials/gi/thumbs/gi.jpg" alt="" /></a>The first image of mine that actually got printed in a proper magazine (<a href="http://www.3dworldmag.com">3d World</a>) was geometrically very simple. A few boxes, extruded surfaces etc. What  made it stand out, in my opinion, are three things: First, it is proportionally correct, based on a real-world environment studied down to the most ridiculous details, of which many are too small to be seen (big mistake). Second, it uses high-resolution bitmapped textures which were hand-painted and then dirtied in precise places, and third, it uses very diffuse lighting which works well under the circumstances (one very strong light source coming from above), and which is the object of this tutorial. A hi-res version of the image can be found in the <a href="http://www.talino.org/3d/">cgi section</a>.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_01.jpg" alt="Simple model, nice lighting" width="300" height="200" /><p class="wp-caption-text">Simple model, nice lighting</p></div>
<h3>First steps</h3>
<p>I had spent two days trying to light this thing, using preposterous light arrays (10x10x10 attenuated omnis), domelights, whatever. But I found that the following method works well, simply because it gives you precise control over every surface. It&#8217;s a bit more tedious, but it works (at least it did for me).</p>
<p>Start by adding one Omni Light in the middle of the scene. A very warm color, a low multiplier (0.2) and a progressive attenuation, it will act as an ambient light surrounding the area where the sunlight hits the floor. It also simulates the subtle yellow light reflected from the beige floor. It shouldn&#8217;t affect specular highlights so I turn this off.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_02.jpg" alt="Start with almost nothing" width="300" height="200" /><p class="wp-caption-text">Start with almost nothing</p></div>
<h3>Light from the Sun</h3>
<p>Next comes the sunlight itself, which is a Direct Light. It shines through a skylight above which is actually modeled, so I don&#8217;t need a projection map. The light multiplier is set at 0.8 and there&#8217;s no need for attenuation. With shadow-mapped shadows at their defaults you get this, which is an OK shadow.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_03.jpg" alt="Add direct lighting" width="300" height="200" /><p class="wp-caption-text">Add direct lighting</p></div>
<h3>Separate the walls</h3>
<p>What I do now is simply separate lights and surfaces using the Exclude/Include function of each light. Now, for example, I add a spotlight which includes all the objects on the front wall, as well as the wall itself.</p>
<p>Almost everything about the light is at its default setting, except the attenuation which start a bit in front of the wall, and ends behind it. Since the spot is at an angle, the attenuation factor varies over the surface and looks quite nice.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_04.jpg" alt="Light the back wall" width="300" height="200" /><p class="wp-caption-text">Light the back wall</p></div>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_05.jpg" alt="Simulate attenuation" width="300" height="200" /><p class="wp-caption-text">Simulate attenuation</p></div>
<p>The left wall (and all its associated objects) is going through the same treatment. The spot shines a bit from behind, and has its attenuation factor set to achieve the same principle described above.</p>
<p>Same drill for the right wall.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_06.jpg" alt="Light the left wall" width="300" height="200" /><p class="wp-caption-text">Light the left wall</p></div>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_07.jpg" alt="And the right one" width="300" height="200" /><p class="wp-caption-text">And the right one</p></div>
<h3>Finishing touches</h3>
<p>In order to obtain a natural-looking light for the floor and the railing, two spots were added (including only the required objects, of course). They are pointing at the floor from opposite directions and are set up so as to attenuate progressively over the surface. Both have their Multiplier at around 0.8 &#8211; this prevents overexposure of the surface but still keeps a nice strong light.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_08.jpg" alt="And the floor" width="300" height="200" /><p class="wp-caption-text">And the floor</p></div>
<p>Because the right door was to be rendered closely, I dedicated two more spotlights to it. This was enough to consider the image finished.</p>
<h3>Conclusion</h3>
<p>Another advantage of this technique is that it allows you to quickly render any part of your scene, from almost any angle, without worrying about the lighting at all.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/gi/gi_09.jpg" alt="The finished image" width="300" height="200" /><p class="wp-caption-text">The finished image</p></div>
<p>Don&#8217;t expect to get perfect results the first time. It took a lot of tweaking to get the attenuation, color and multiplier right for each light. 3D artists should consider this as fun, although I had some persons asking why I didn&#8217;t just photograph the bloody thing. Anyway, I hope this gave you some ideas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/gi/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Maya Expressions 1</title>
		<link>http://www.talino.org/tutorials/exp1/</link>
		<comments>http://www.talino.org/tutorials/exp1/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 13:43:33 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://192.168.0.4:8888/uncategorized/exp1/</guid>
		<description><![CDATA[<a href="/tutorials/exp1/"><img class="alignleft" src="/resources/images/tutorials/exp1/thumbs/exp1.jpg"/></a>As an introduction to the basics of using expressions in Maya, this tutorial shows how to make simple wings flap at a controllable speed without setting a single keyframe.]]></description>
			<content:encoded><![CDATA[<p><a href="/tutorials/exp1/"><img class="alignleft" src="/resources/images/tutorials/exp1/thumbs/exp1.jpg"/></a>Once you figure out the basics of expressions in Maya, you&#8217;ll find yourself using them all the time, avoiding manual keyframing as much as possible. Expressions are, in my opinion, Maya&#8217;s strongest feature. In order to explain the basic idea of using them, this tutorial will show how to create a very simple animation: a bug flapping its wings with a controllable speed attribute. The model is very sketchy, since it&#8217;s not the focus of this tutorial.</p>
<h3>Quick modeling</h3>
<p>Create three Nurbs spheres, and move and scale them so that you get a very rough representation of a body with a couple of wings. Name the wings &#8220;rWing&#8221; and &#8220;lWing&#8221;, and name the body &#8220;bug&#8221; or whatever. Throw a basic texture on them if you wish.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_02.jpg" alt="It's a bird!" width="300" /><p class="wp-caption-text">It's a bird!</p></div>
<p>Move the pivot points of both wings so that they can rotate around the proper axis.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_03.jpg" alt="Proper pivoting..." width="300" /><p class="wp-caption-text">Proper pivoting...</p></div>
<p>Parent the wings to the main body so that they move with it.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_04.jpg" alt="...and parenting" width="300" /><p class="wp-caption-text">...and parenting</p></div>
<h3>The Expression Editor</h3>
<p>Open the Expression Editor (Window > Animation Editors > Expression Editor&#8230;). You&#8217;ll find it useful to assign a hotkey to that (ALT+e is unassigned by default and is a good choice).</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_05.jpg" alt="The not-so-daunting Expression Window" width="300" /><p class="wp-caption-text">The not-so-daunting Expression Window</p></div>
<p>On the left you&#8217;ll see your currently selected object, and on the right the list of its keyable attributes. Expression are typed into the bottom box. It&#8217;s important to know that expressions do NOT relate to the currently selected object. You can write expressions for anything, another object, a shader, whatever you want. If have an object selected, though, it&#8217;s easier to know the exact name of an attribute you want to control, since all keyable attributes at listed on the right.</p>
<p>Type &#8220;wingFlap&#8221; into the Expression Name box, and type the following into the Expression box at the bottom of the dialog box:</p>
<p><code>lWing.rotateX = time * 10;</code></p>
<p>Click &#8220;Create&#8221;. This creates the expression.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_06.jpg" alt="Your first expression" width="300" /><p class="wp-caption-text">Your first expression</p></div>
<p>The syntax is very simple: you type the object name (or, rather, the node name), followed by a period and the attribute you want to control. In this case, we want to control the X rotation of the left wing&#8217;s transform node. The &#8220;time&#8221; attribute is a built-in value in Maya, which returns the current time of the animation in seconds. Its multiplied by ten so that the result is more immediately visible (the flapping is faster). The semicolon simply marks the end of every statement in Maya. Click &#8220;Play&#8221;, and the you&#8217;ll see the wing rotate as time goes by. Check the Hypergraph, and you&#8217;ll see lWing controlled by the wingFlap expression. Also, in the Channel Box, lWing&#8217;s rotateX attribute turns orange to show that it&#8217;s controlled by something and that you can&#8217;t change it directly.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_07.jpg" alt="A transform node controlled by an expression" width="300" /><p class="wp-caption-text">A transform node controlled by an expression</p></div>
<h3>The Sine function</h3>
<p>The simplest way to create a back-and-forth motion is to use a sine function. Modify the expression so that it looks like this:</p>
<p><code>lWing.rotateX = sin (time * 10) * 40;</code></p>
<p>If the expression has disappeared from the Expression Editor, simply click Select Filter > By Expression Name and click on wingFlap.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_08.jpg" alt="Finding lost expressions" width="300" /><p class="wp-caption-text">Finding lost expressions</p></div>
<p>The result of the sine function is multiplied by forty so that the motion describes a larger arc. Otherwise, the flapping goes back and both between two very small values.</p>
<p>Click &#8220;Edit&#8221;. This button, which replaced the &#8220;Create&#8221; button, updates the expression to reflect the changes you&#8217;ve made. If you get the message &#8220;Error: Expression invalid after edit&#8221;, check your syntax. If you play the animation after this error without correcting it, Maya evaluates the last valid expression that you entered.</p>
<p>Play the animation. The wing flaps back and forth.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_09.jpg" alt="The wing flaps. Wow." width="300" /><p class="wp-caption-text">The wing flaps. Wow.</p></div>
<p>To get both wings to flap, copy and paste the expression into the line below, but change lWing to rWing, so that the whole expression now reads:</p>
<p><code>lWing.rotateX = sin (time * 10) * 40;</br><br />
rWing.rotateX = sin (time * 10) * 40;</code></p>
<p>You&#8217;ll see a motion which isn&#8217;t at the cutting-edge of aerodynamics. This is because the X rotation of the opposite wing should be reversed.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_10.jpg" alt="You're going the wrong way" width="300" /><p class="wp-caption-text">You're going the wrong way</p></div>
<p>Add a minus sign before the sine function of the right wing, to read:</p>
<p><code>lWing.rotateX = sin (time * 10) * 40;</br><br />
rWing.rotateX = -sin (time * 10) * 40;</code></p>
<p>Play the animation. The bug now has more chances of survival.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_11.jpg" alt="That's more like it" width="300" /><p class="wp-caption-text">That's more like it</p></div>
<h3>Controlling the wing speed</h3>
<p>Now suppose you want to control the wings&#8217; flapping speed. Currently, the speed is determined by the *10 part of the expression. Let&#8217;s create an attribute for wing speed that would allow us to change the speed dynamically, and even keyframe it. In the Attribute Editor, select the bug&#8217;s transform node (the one simply called &#8220;bug&#8221;), and choose Attributes > Add Attributes. </p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_12.jpg" alt="Creating a new attribute" width="300" /><p class="wp-caption-text">Creating a new attribute</p></div>
<p>Type WingSpeed into the Attribute Name field, make sure Float is selected, and set 0 as Minimum value, 10 as Maximum and 5 as the Default value. Make sure that &#8220;Make Attribute Keyable&#8221; is checked (so that is shows up in the Channel Box), and click on OK.</p>
<p>The Add button allows you to add several attributes without closing the window every time.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_13.jpg" alt="The new wingSpeed attribute" width="300" /><p class="wp-caption-text">The new wingSpeed attribute</p></div>
<p>In the Extra Attributes folder of the bug&#8217;s transform node, you now have a fresh new attribute called wingspeed, nicely displayed with a space (Wing Speed) because of the capital S. It&#8217;s set at the default of 5, and doesn&#8217;t do anything at the moment.</p>
<p>Back in the Expression Editor, change the 10 value to bug.WingSpeed in both lines. They should now read:</p>
<p><code>lWing.rotateX = sin (time * bug.WingSpeed) * 40;</br><br />
rWing.rotateX = -sin (time * bug.WingSpeed) * 40;</code></p>
<h3>Conclusion</h3>
<p>Notice a couple of things: the capitalization (it&#8217;s very important to type the attribute name exactly as you defined it) and the fact that we&#8217;re controlling the wings via an attribute which belongs to the bug node, hence the bug.WingSpeed. Move the Wing Speed slider around and see how it affects the wings&#8217; motion.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp1/exp1_13.jpg" alt="Final expression" width="300" /><p class="wp-caption-text">Final expression</p></div>
<p>Play around with this in order to get a feel for the almost infinite possibilities it offers. Try to control the size of the wing arc (currently 40) with another, new attribute. Also, you can attach the bug node to a turbulence field, and try to control the wing speed via, for example, the translateY attribute of the bug, so that its wings flap more quickly when it approach the ground. Bear in mind that you&#8217;ve still haven&#8217;t set a single keyframe. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/exp1/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Maya Expressions 2</title>
		<link>http://www.talino.org/tutorials/exp2/</link>
		<comments>http://www.talino.org/tutorials/exp2/#comments</comments>
		<pubDate>Sun, 19 Nov 2006 13:15:39 +0000</pubDate>
		<dc:creator>Tal</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://192.168.0.4:8888/tutorials/exp2/</guid>
		<description><![CDATA[<a href="/tutorials/exp2/"><img class="alignleft" src="/resources/images/tutorials/exp2/thumbs/exp2.jpg"/></a>The hidden distanceBetween node - and the more common clamp function - are explained using a simple example: making two spheres glow as they approach each other.]]></description>
			<content:encoded><![CDATA[<p><a href="/tutorials/exp2/"><img class="alignleft" src="/resources/images/tutorials/exp2/thumbs/exp2.jpg"/></a>One day, a mischievous Alias|Wavefront programmer took the decision to create  a wonderfully useful function in Maya. He or she then proceeded to hide it  deeply enough inside the interface so that as few people as possible could hope to find it (although I think I saw it somewhere more visible in Maya 6).  The function is called the distanceBetween node, and is the object of this  tutorial. If you&#8217;re new to expressions, you might want to check out my first  tutorial on the subject before tackling this one.</p>
<p>What this node basically does is take two vector inputs (such as Translate X, Y and Z), calculate the distance between them, and then output the result into a distance attribute. This allows for some very basic effects to be achieved with little fuss. </p>
<p>The distanceBetween node doesn&#8217;t have to have translate values as inputs, but they are the best way to explain how it works. So here goes.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_01.jpg" alt="The distanceBetween node" width="300" /><p class="wp-caption-text">The distanceBetween node</p></div>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_02.jpg" alt="A simple vector" width="300" /><p class="wp-caption-text">A simple vector</p></div>
<h3 class="topaligned">Creating the node</h3>
<p>In the Command Line, type the following MEL command:</p>
<p><code>createNode distanceBetween</code></p>
<p>and press Enter.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_03.jpg" alt="Now isn't that user-friendly" width="300" /><p class="wp-caption-text">Now isn't that user-friendly</p></div>
<p>As you probably figured out, this command creates the node. Following the logic which dictates that this node should be hidden from most mortals, it doesn&#8217;t appear in the Outliner, Hypershade or Hypergraph. You&#8217;ll need to go to the Outliner, and turn off DAG Objects Only from the Display menu.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_04.jpg" alt="Still invisible..." width="300" /><p class="wp-caption-text">Still invisible...</p></div>
<p>Tada. Since you&#8217;ll spend quite some time hunting for it later, you might find it useful to create a button which selects it for you. Just select another node and then select the distanceBetween1 node again. Open the Script Editor, highlight the &#8220;select -r distanceBetween1 ;&#8221; command which will show up there and middle-drag it to a shelf.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_05.jpg" alt="...but not for long" width="300" /><p class="wp-caption-text">...but not for long</p></div>
<h3 class="topaligned">A simple application</h3>
<p>Now for the fun part. Create a couple of spheres and assign the same material to both of them. Give it a nice, popular color such as red. Open the Connection Editor (Window > General Editors > Connection Editor&#8230;), select one of the spheres and click Reload Left. Select the distanceBetween1 node (either through the Outliner or with your shelf button), and click Reload Right.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_06.jpg" alt="Connecting the node" width="300" /><p class="wp-caption-text">Connecting the node</p></div>
<p>Towards the bottom of the list on the left, click the Translate attribute. On the right-hand side, click the Point1 attribute. This connects the sphere&#8217;s XYZ translate values to the distanceBetween node&#8217;s first input.</p>
<p>Select the second sphere and click Reload Left in the Connection Editor. This time, connect the Translate attribute to the Point2 attribute. Check the Hypergraph to see how the nodes are connected.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_07.jpg" alt="Two vector inputs" width="300" /><p class="wp-caption-text">Two vector inputs</p></div>
<p>The resulting value, which is contained in the distanceBetween1.distance attribute, can be used in an infinite number of ways. Let&#8217;s assume that we want the spheres to glow when they get close to one another. You could connect the distance attribute to, say, the incandescence R, G &#038; B values for the material you assigned (remember that distance is a float value, so it goes into each channel separately), but this can be problematic. The distance is measured in world units, and unless your spheres stay within a 0 to 1 distance from each other, you can get funky results. It&#8217;s better to write an expression for it.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_08.jpg" alt="Mapping the Distance to Incandescence" width="300" /><p class="wp-caption-text">Mapping the Distance to Incandescence</p></div>
<h3 class="topaligned">An expression for more control</h3>
<p>Assuming the material assigned to both spheres is called blinn1, create a new expression with the following lines (ignore any line breaks, and you might double check your spelling if you get an error, incandescence is a particularily treacherous attribute to type in):</p>
<p><code>blinn1.incandescenceR = (10-distanceBetween1.distance)/8 ;</br><br />
blinn1.incandescenceG = (10-distanceBetween1.distance)/8 ;</br><br />
blinn1.incandescenceB = (10-distanceBetween1.distance)/8 ;</code></p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_09.jpg" alt="An expression might be more handy..." width="300" /><p class="wp-caption-text">An expression might be more handy...</p></div>
<p>What this does is take the distance and subtract it from 10, so that the spheres glow when they approach each other, instead of when they move away. The 10 value determines at what distance the glow starts. The result is then further divided by 8 so that the transition of the glow is more gradual. Move the spheres around in textured mode to see it in action. Also, try this with different values and see what happens.</p>
<p>There&#8217;s still a problem. When the spheres are farther than 10 units apart in this example, the incandescence becomes negative and they go completely black. Remedy this by adding a clamp function, so that the expression reads:</p>
<p><code>blinn1.incandescenceR = clamp(0,1,(10-distanceBetween1.distance)/8) ;</code></p>
<p>The same should go for the Green and Blue channels.</p>
<div class="wp-caption aligncenter" style="width: 310px"><img src="/resources/images/tutorials/exp2/exp2_10.jpg" alt="...if it's written correctly" width="300" /><p class="wp-caption-text">...if it's written correctly</p></div>
<p>What this does is specify Minimum and Maximum values (the 0 and the 1) to be allowed for the third value in the function (the distance value in this case).</p>
<p>For some eye candy, move the spheres apart so that they don&#8217;t share any axis, and attach them both to a Newton field positioned between them.</p>
<p>Nicolas Aithadi has created a <a href="http://morphose.free.fr/Tutorials/CornellBox/CornellBox.htm">Cornell Box simulation</a> using the distanceBetween node. I actually wrote this tutorial because I got confused half way about what should be connected where. </p>
<p>Emmanuel Campin, author of the SkyLightControl MEL Script, has an even more involved example which <a href="http://www.highend3d.com/maya/tutorials/emmanuel2/">fakes soft shadows with Dmaps.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.talino.org/tutorials/exp2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

