<br />
<b>Warning</b>:  Declaration of Jetpack_IXR_Client::query() should be compatible with IXR_Client::query(...$args) in <b>/home/clients/7267bc096562fcdb78c0ab60d3ac51fb/web/blog/wp-content/plugins/jetpack/class.jetpack-ixr-client.php</b> on line <b>91</b><br />
{"id":1165,"date":"2017-09-16T09:46:30","date_gmt":"2017-09-16T09:46:30","guid":{"rendered":"http:\/\/barradeau.com\/blog\/?p=1165"},"modified":"2017-09-16T09:48:42","modified_gmt":"2017-09-16T09:48:42","slug":"generating-things-with-code-1-of-2","status":"publish","type":"post","link":"http:\/\/barradeau.com\/blog\/?p=1165","title":{"rendered":"Generating things with\u00a0code\u00a0(1 of 2)\u00a0"},"content":{"rendered":"<p>this article was initially published on <a href=\"https:\/\/medium.com\/@nicoptere\/generating-things-with-code-ddbca45ceddc\">Medium<\/a>, I&#8217;m posting it here for the record.<!--more--><\/p>\n<section class=\"section section--body section--first\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h1 class=\"graf graf--h3 graf-after--figure graf--title\"><\/h1>\n<h1 class=\"graf graf--h3 graf-after--figure graf--title\">PCG, data and\u00a0space<\/h1>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h3 id=\"c05f\" class=\"graf graf--h3 graf--leading\">1. PROCEDURAL CONTENT GENERATION (PCG)<\/h3>\n<p id=\"93dc\" class=\"graf graf--p graf-after--h3\">The essence of generative design is to use\u00a0<em class=\"markup--em markup--p-em\">functions\u200a\u2014\u200asimple, independent actions\u200a\u2014\u200a<\/em>and\u00a0<em class=\"markup--em markup--p-em\">algorithms\u200a\u2014\u200aseries of actions required to solve a given task\u200a\u2014\u200a<\/em>to build systems that create series of non-repeating results.\u00a0<span class=\"markup--quote markup--p-quote is-other\" data-creator-ids=\"f522e622e636\">PCGs encompass the programmatic generation of content, they often rely on pseudo-random data and are essentially the task of\u00a0<em class=\"markup--em markup--p-em\">designing a process<\/em><\/span>\u00a0rather than an\u00a0<em class=\"markup--em markup--p-em\">object.\u00a0<\/em>PCGs are massively used in object design, games, art, vfx, architecture\u2026<\/p>\n<h4 id=\"0ab3\" class=\"graf graf--h4 graf-after--p\">DATA \/ SPACE \/\u00a0PROCESS<\/h4>\n<p id=\"1c68\" class=\"graf graf--p graf-after--h4\">The coding platform, the language, the tools &amp; tool-chain, the capture devices &amp; data sources are irrelevant. This will obviously have an impact on the final result if chosen poorly but it is of no importance when designing a generative system. Generating things with code is language &amp; platform agnostic.<\/p>\n<p id=\"7056\" class=\"graf graf--p graf-after--p\">On the other hand, there are 3 important things to\u00a0<span class=\"markup--quote markup--p-quote is-other\" data-creator-ids=\"f522e622e636\">take into account when generating something with code: the\u00a0<strong class=\"markup--strong markup--p-strong\">data<\/strong>\u00a0you\u2019ll be using, the\u00a0<strong class=\"markup--strong markup--p-strong\">space<\/strong>\u00a0in which they\u2019ll be displayed and the\u00a0<strong class=\"markup--strong markup--p-strong\">process<\/strong>\u00a0that will transform the data.<\/span><\/p>\n<p id=\"86fa\" class=\"graf graf--p graf-after--p\">A generative system should allow you to perform the following tasks:<br \/>\n<strong class=\"markup--strong markup--p-strong\">modelisation:<\/strong>\u00a0create the model of a system\u00a0<strong class=\"markup--strong markup--p-strong\"><br \/>\nsimulation:\u00a0<\/strong>use the model to process data<br \/>\n<strong class=\"markup--strong markup--p-strong\">exploration:<\/strong>\u00a0alter the model\u2019s and or the simulation\u2019s parameter<br \/>\n<strong class=\"markup--strong markup--p-strong\">visualization:<\/strong>\u00a0rendering the simulation as 2D or 3D graphics, video, tangible objects, installations\u2026<\/p>\n<h4 id=\"282e\" class=\"graf graf--h4 graf-after--p\">DOWNSIDES<\/h4>\n<ul class=\"postList\">\n<li id=\"eda8\" class=\"graf graf--li graf-after--h4\">the mathematical uniqueness is not enough to create significant differences between outcomes<\/li>\n<li id=\"ab0c\" class=\"graf graf--li graf-after--li\">it is hard to maintain consistent variations while using numerous variables<\/li>\n<li id=\"c1ed\" class=\"graf graf--li graf-after--li\">it is hard to assess \u201cgood\u201d settings, human curation is often required<\/li>\n<\/ul>\n<h4 id=\"b00b\" class=\"graf graf--h4 graf-after--li\">UPSIDES<\/h4>\n<ul class=\"postList\">\n<li id=\"6601\" class=\"graf graf--li graf-after--h4\">PCGs are very good at serial content<\/li>\n<li id=\"5ee4\" class=\"graf graf--li graf-after--li\">the computer does the boring part<\/li>\n<li id=\"f35b\" class=\"graf graf--li graf-after--li\">few parameters give many variations<\/li>\n<li id=\"b142\" class=\"graf graf--li graf-after--li\"><em class=\"markup--em markup--li-em\">emergent<\/em>\u00a0behaviors can produce surprising or unexpected results<\/li>\n<\/ul>\n<p id=\"cbf7\" class=\"graf graf--p graf-after--li\"><a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/galaxykate0.tumblr.com\/post\/139774965871\/so-you-want-to-build-a-generator\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"http:\/\/galaxykate0.tumblr.com\/post\/139774965871\/so-you-want-to-build-a-generator\">Kate Compton has written an extensive post<\/a>\u00a0about PCG, you\u2019ll find lots of practical advices from a seasoned professional.<\/p>\n<h4 id=\"23dd\" class=\"graf graf--h4 graf-after--p\">EXAMPLES<\/h4>\n<\/div>\n<div class=\"section-inner sectionLayout--fullWidth\">\n<figure id=\"d585\" class=\"graf graf--figure graf--layoutFillWidth graf-after--h4\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*lIz15TvFzPJd4PUl0c6b8A.png\" data-width=\"1920\" data-height=\"1080\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"40\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*lIz15TvFzPJd4PUl0c6b8A.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*lIz15TvFzPJd4PUl0c6b8A.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"e627\" class=\"graf graf--p graf-after--figure\"><a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/www.nomanssky.com\/\" target=\"_blank\" rel=\"noopener nofollow\" data-href=\"https:\/\/www.nomanssky.com\/\">Hello Games\u200a\u2014\u200ano man\u2019s sky<\/a><\/p>\n<p id=\"2331\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">model<\/strong>: universe generator<br \/>\n<strong class=\"markup--strong markup--p-strong\">simulation<\/strong>: update the model with game logic<br \/>\n<strong class=\"markup--strong markup--p-strong\">exploration<\/strong>: interact with the simulation<br \/>\n<strong class=\"markup--strong markup--p-strong\">visualization<\/strong>: rendering a 3D scene<\/p>\n<\/div>\n<div class=\"section-inner sectionLayout--fullWidth\">\n<figure id=\"ba54\" class=\"graf graf--figure graf--layoutFillWidth graf-after--p\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*df096GNAj56_rOe7siPQPQ.png\" data-width=\"1920\" data-height=\"1080\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"40\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*df096GNAj56_rOe7siPQPQ.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*df096GNAj56_rOe7siPQPQ.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"8e34\" class=\"graf graf--p graf-after--figure\"><a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/n-e-r-v-o-u-s.com\/index.php\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"http:\/\/n-e-r-v-o-u-s.com\/index.php\">nervous systems\u200a\u2014\u200aKINEMATICS FOLD<\/a><\/p>\n<p id=\"7134\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">model<\/strong>: triangle based patch modeler<br \/>\n<strong class=\"markup--strong markup--p-strong\">simulation<\/strong>: apply physics rules to the model<br \/>\n<strong class=\"markup--strong markup--p-strong\">exploration<\/strong>: change the input 3D model<br \/>\n<strong class=\"markup--strong markup--p-strong\">visualization<\/strong>: 3D renders &amp; 3D print<\/p>\n<\/div>\n<div class=\"section-inner sectionLayout--fullWidth\">\n<figure id=\"da92\" class=\"graf graf--figure graf--layoutFillWidth graf-after--p\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*PLzL3NHJr4zZpsVW75PX9g.png\" data-width=\"1920\" data-height=\"1080\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"40\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*PLzL3NHJr4zZpsVW75PX9g.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/2000\/1*PLzL3NHJr4zZpsVW75PX9g.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"2720\" class=\"graf graf--p graf-after--figure\"><a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/wearechopchop.com\/%E2%80%9Cunnamed-soundsculpture%E2%80%9D\/\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"http:\/\/wearechopchop.com\/%E2%80%9Cunnamed-soundsculpture%E2%80%9D\/\">We Are Chopchop\u200a\u2014\u200aunnamed soundsculpture<\/a><\/p>\n<p id=\"1675\" class=\"graf graf--p graf-after--p\"><strong class=\"markup--strong markup--p-strong\">model<\/strong>: represent a 3D object in time and space<br \/>\n<strong class=\"markup--strong markup--p-strong\">simulation<\/strong>: playback of a recorded sequence<br \/>\n<strong class=\"markup--strong markup--p-strong\">exploration<\/strong>: move a virtual camera through space<br \/>\n<strong class=\"markup--strong markup--p-strong\">visualization<\/strong>: render particles in 3D<\/p>\n<p id=\"8618\" class=\"graf graf--p graf-after--p\">In this example, the simulation\u2019s rules\u200a\u2014\u200athe algorithm or the system\u200a\u2014\u200acan be described as follows:<\/p>\n<ul class=\"postList\">\n<li id=\"c5cb\" class=\"graf graf--li graf-after--p\">spawn a particle at a random location on a 3D mesh at a given time<\/li>\n<li id=\"47bf\" class=\"graf graf--li graf-after--li\">make the particle fall over time and chek if it hits the floor<\/li>\n<li id=\"aa19\" class=\"graf graf--li graf-after--li\">if the particle hits the floor, make it disappear after a while and respawn<\/li>\n<\/ul>\n<p id=\"99ac\" class=\"graf graf--p graf-after--li graf--trailing\">The particles move &amp; disappear\u00a0<em class=\"markup--em markup--p-em\">procedurally<\/em>, we know the initial position and the simulation will determine where the particle ends. This generative system can work with any 4 dimensional data set (3D position over time).<\/p>\n<p class=\"graf graf--p graf-after--li graf--trailing\">\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body\">\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h3 id=\"c4c1\" class=\"graf graf--h3 graf--leading\">2. DATA<\/h3>\n<p id=\"29b6\" class=\"graf graf--p graf-after--h3\">The universe is a\u00a0<em class=\"markup--em markup--p-em\">continuous<\/em>\u00a0system yet computers need to process\u00a0<em class=\"markup--em markup--p-em\">discrete<\/em>data. In a nutshell, the difference is that continuous data are\u00a0<strong class=\"markup--strong markup--p-strong\">measured<\/strong>\u00a0while discrete data are\u00a0<strong class=\"markup--strong markup--p-strong\">counted<\/strong>. The reason for that is simple\u00a0; the precision of the data that a computer works with are limited. For instance, the continuous\u00a0<em class=\"markup--em markup--p-em\">time\u00a0<\/em>must become an\u00a0<em class=\"markup--em markup--p-em\">interval<\/em>\u00a0for us to use it in a generative system. The\u00a0<em class=\"markup--em markup--p-em\">light\u00a0<\/em>must become a\u00a0<em class=\"markup--em markup--p-em\">color palette<\/em>, a chemical\u00a0<em class=\"markup--em markup--p-em\">reaction\u00a0<\/em>must be described as a\u00a0<em class=\"markup--em markup--p-em\">process<\/em>, a\u00a0<em class=\"markup--em markup--p-em\">phenomenon\u00a0<\/em>will have to become a\u00a0<em class=\"markup--em markup--p-em\">simulation etc.<\/em><\/p>\n<p id=\"6b9f\" class=\"graf graf--p graf-after--p\">Any given object can be described by a number of\u00a0<em class=\"markup--em markup--p-em\">dimensions<\/em>, in code we often refer to these dimensions as\u00a0<em class=\"markup--em markup--p-em\">properties\u00a0<\/em>or\u00a0<em class=\"markup--em markup--p-em\">fields<\/em>\u00a0but that\u2019s somewhat restrictive<em class=\"markup--em markup--p-em\">.<\/em>\u00a0The values of each dimension of an object can vary without affecting the others. In the case of light, the\u00a0<em class=\"markup--em markup--p-em\">direction<\/em>,\u00a0<em class=\"markup--em markup--p-em\">speed<\/em>,\u00a0<em class=\"markup--em markup--p-em\">wavelength\u00a0<\/em>and\u00a0<em class=\"markup--em markup--p-em\">energy<\/em>\u00a0can vary independently\u00a0; they\u2019re all distinct\u00a0<em class=\"markup--em markup--p-em\">dimensions\u00a0<\/em>of the light and we can model and simulate them in code as the properties of an object.<\/p>\n<h4 id=\"9693\" class=\"graf graf--h4 graf-after--p\">computer representation of uni-dimensional data<\/h4>\n<p id=\"6f2e\" class=\"graf graf--p graf-after--h4\">Once a\u00a0<em class=\"markup--em markup--p-em\">dimension\u00a0<\/em>is discrete, we can use it in our models and simulations. Depending on the\u00a0<em class=\"markup--em markup--p-em\">granularity<\/em>\u00a0of the dimension, we can use various\u00a0<em class=\"markup--em markup--p-em\">data-holders<\/em>\u00a0the simplest of which is the\u00a0<em class=\"markup--em markup--p-em\">bit<\/em>\u00a0that can only hold 2 values\u00a0: 0 \/ 1. An obvious limitation is that it can only describe whether a given property of the object \u201cis\u201d or \u201cisn\u2019t\u201d. If we need a finer grain, we should use different data types, what I like to call the \u201c1D extension pack\u201d which contains:<\/p>\n<ul class=\"postList\">\n<li id=\"6d64\" class=\"graf graf--li graf-after--p\">byte \/ octet: 8 bits &amp; 256 integer values<\/li>\n<li id=\"f5d8\" class=\"graf graf--li graf-after--li\">float, uint, double: 16, 32, 64 bits<\/li>\n<li id=\"cebe\" class=\"graf graf--li graf-after--li\">character: 7 bits (US ASCII ), 32 bits (UTF-32)<\/li>\n<\/ul>\n<p id=\"c2dc\" class=\"graf graf--p graf-after--li\">acknowledged that in the computers\u2019s memory, a number or a character is stored as an array of bits, we could argue that a number or a character are themselves N-dimensional objects.<\/p>\n<figure id=\"14cb\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<p><img decoding=\"async\" class=\"graf-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*xAIaLrrRD76yZJlV.png\" data-image-id=\"0*xAIaLrrRD76yZJlV.png\" data-width=\"590\" data-height=\"75\" \/><\/p>\n<\/div><figcaption class=\"imageCaption\"><a class=\"markup--anchor markup--figure-anchor\" href=\"https:\/\/en.wikipedia.org\/wiki\/Single-precision_floating-point_format#\/media\/File:Float_example.svg\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"https:\/\/en.wikipedia.org\/wiki\/Single-precision_floating-point_format#\/media\/File:Float_example.svg\">https:\/\/en.wikipedia.org\/wiki\/Single-precision_floating-point_format#\/media\/File:Float_example.svg<\/a><\/figcaption><\/figure>\n<h4 id=\"ce15\" class=\"graf graf--h4 graf-after--figure\">data in 2 dimensions<\/h4>\n<p id=\"5e57\" class=\"graf graf--p graf-after--h4\">The next step towards complexity is to use series of uni-dimensional data, for instance:<\/p>\n<ul class=\"postList\">\n<li id=\"bd00\" class=\"graf graf--li graf-after--p\">a string: \u201cGenerating things with code\u201d<\/li>\n<li id=\"7902\" class=\"graf graf--li graf-after--li\">a typed linear array: [\u201ca\u201d, \u201cb\u201d, \u201cc\u201d] \/ [ 0, 1, 2 ]<\/li>\n<li id=\"1568\" class=\"graf graf--li graf-after--li\">an (empty) image: [ width * height ]<\/li>\n<\/ul>\n<p id=\"7b23\" class=\"graf graf--p graf-after--li\">the object is already multi dimensional\u00a0; each dimension can be altered without affecting the whole. The string can be longer or shorter without altering the letters, and the letters can change without altering the length of the sentence, the image\u2019s width can change without altering its height, a.s.o.<\/p>\n<h3 id=\"9413\" class=\"graf graf--h3 graf-after--p\">n-dimensional data<\/h3>\n<p id=\"f1d3\" class=\"graf graf--p graf-after--h3\">If we extrapolate further, N-dimensional data are a combinatorics of many uni-dimensional data, here are some 3D objects:<\/p>\n<ul class=\"postList\">\n<li id=\"ed22\" class=\"graf graf--li graf-after--p\">an opaque color: { R, G, B }<\/li>\n<li id=\"8e03\" class=\"graf graf--li graf-after--li\">a vector: { X, Y, Z }<\/li>\n<li id=\"2003\" class=\"graf graf--li graf-after--li\">a greyscale pixel: { X, Y, greyscale }<\/li>\n<\/ul>\n<p id=\"2adc\" class=\"graf graf--p graf-after--li\">As the name suggests, N-dimensional data can represent any number of dimensions, here are some more complex (yet fairly common) data-holders:<\/p>\n<ul class=\"postList\">\n<li id=\"3d79\" class=\"graf graf--li graf-after--p\">pixel + color: { X, Y, R, G, B }<\/li>\n<li id=\"e553\" class=\"graf graf--li graf-after--li\">pixel + color &amp; alpha: { X, Y, R, G, B, A }<\/li>\n<li id=\"9795\" class=\"graf graf--li graf-after--li\">stereo sound: { left, right, time, sampling rate }<\/li>\n<li id=\"9cce\" class=\"graf graf--li graf-after--li\">video: size, color depth, sound, time<\/li>\n<li id=\"8b6d\" class=\"graf graf--li graf-after--li\">3D object: positions, indices, normals, colors, uvs, textures\u2026<\/li>\n<\/ul>\n<p id=\"ffe6\" class=\"graf graf--p graf-after--li\">From the\u00a0<em class=\"markup--em markup--p-em\">dimensions\u2019\u00a0<\/em>perspective, a single tweet can potentially be represented in ~72 dimensions, often themselves N-dimensional. The underlying idea is that we often overlook the complexity of the simplest things\u00a0; a short text, a limited set of colors, an IP address are complex N-dimensional objects.<\/p>\n<h3 id=\"f990\" class=\"graf graf--h3 graf-after--p\">data acquisition<\/h3>\n<p id=\"0962\" class=\"graf graf--p graf-after--h3\">We are also surrounded by devices that allow us to capture rich data from our surroundings. A\u00a0<strong class=\"markup--strong markup--p-strong\">smartphone<\/strong>\u00a0can capture photos, videos, sounds &amp; GPS positions but also has a set of \u201chidden\u201d sensors:<\/p>\n<pre name=\"84ff\" id=\"84ff\" class=\"graf graf--pre graf-after--p\">TYPE_ACCELEROMETER Motion detection (shake, tilt, etc.).\r\nTYPE_AMBIENT_TEMPERATURE Monitoring air temperatures.\r\nTYPE_GRAVITY Motion detection (shake, tilt, etc.).\r\nTYPE_GYROSCOPE Rotation detection (spin, turn, etc.).\r\nTYPE_LIGHT Controlling screen brightness.\r\nTYPE_LINEAR_ACCELERATION Monitoring acceleration along an axis.\r\nTYPE_MAGNETIC_FIELD Creating a compass.\r\nTYPE_ORIENTATION Determining device position.\r\nTYPE_PRESSURE Monitoring air pressure changes.\r\nTYPE_PROXIMITY Phone position during a call.\r\nTYPE_RELATIVE_HUMIDITY Monitoring absolute &amp; relative humidity.<\/pre>\n<p id=\"0f5f\" class=\"graf graf--p graf-after--pre\">All these sensors (and more) are readily accessible and can be recorded from the smartphones as an input to our generative system.<\/p>\n<p id=\"129b\" class=\"graf graf--p graf-after--p\">The\u00a0<strong class=\"markup--strong markup--p-strong\">open data\u00a0<\/strong>available to us have grown exponentially for the past years, they are rather oriented towards statistical analysis, mostly \u201cgeo-social\u201d and often geolocated. This is especially true for cartography but not only.<\/p>\n<p id=\"735d\" class=\"graf graf--p graf-after--p\">We can also use some\u00a0<strong class=\"markup--strong markup--p-strong\">tracking devices<\/strong>\u00a0such as a webcam or a microphone as with a smartphone but also mainstream devices like a Kinect (video, depth, 3D point clouds, infrared video, skeletal information), the Leap Motion that precisely scans a smaller area and returns a well defined point cloud and descriptors for hands and fingers positions. More recently the VR devices like the Oculus Rift (mostly 3 DOF) and the HTC Vive (room scale 6 DOF) that allow to precisely capture the orientation and position of a headset and hand held devices in space and time.<\/p>\n<p id=\"84a2\" class=\"graf graf--p graf-after--p\">If this is\u2019nt enough, it\u2019s possible to build\u00a0<strong class=\"markup--strong markup--p-strong\">custom devices<\/strong>\u00a0starting with Arduino boards and Processing and adding all manners of cheap sensors: gesture detection, heat detector, 360\u00b0 scanners, wind, rain, smoke sensors\u2026<\/p>\n<p id=\"1049\" class=\"graf graf--p graf-after--p\">And finally, let\u2019s not forget that we can\u00a0<em class=\"markup--em markup--p-em\">synthesize\u00a0<\/em>data. The most basic form of\u00a0<strong class=\"markup--strong markup--p-strong\">synthetic data<\/strong>\u00a0is obviously the random, noise, fractals and turbulence generators, but other techniques have emerged in the past years that deserve a mention.\u00a0<strong class=\"markup--strong markup--p-strong\">Photogrammetry\u00a0<\/strong>is one of them, it consists in re-building a 3D model from a set of 2D pictures (see\u00a0<a class=\"markup--anchor markup--p-anchor\" href=\"http:\/\/ccwu.me\/vsfm\/\" target=\"_blank\" rel=\"nofollow noopener\" data-href=\"http:\/\/ccwu.me\/vsfm\/\">visualSFM<\/a>\u00a0for more information). Convolutional Neural Networks, Generative Adversarial Networks, what we usually call\u00a0<strong class=\"markup--strong markup--p-strong\">AI\u00a0<\/strong>that gained a huge momentum since deepdream and partially solves one of the downsides of PCGs I mentioned above ( \u2018it is hard to assess \u201cgood\u201d settings\u2019 )<\/p>\n<p id=\"852f\" class=\"graf graf--p graf-after--p graf--trailing\">In short, there are more and more data available and they become more and more complex. Reduced to sets of\u00a0<em class=\"markup--em markup--p-em\">uni-dimensional<\/em>\u00a0variables, these data can\u00a0<em class=\"markup--em markup--p-em\">shift<\/em>\u00a0between various\u00a0<em class=\"markup--em markup--p-em\">spaces.<\/em><\/p>\n<\/div>\n<\/div>\n<\/section>\n<section class=\"section section--body section--last\">\n<div class=\"section-divider\"><\/div>\n<div class=\"section-content\">\n<div class=\"section-inner sectionLayout--insetColumn\">\n<h3 class=\"graf graf--h3 graf--leading\"><\/h3>\n<h3 id=\"3cc7\" class=\"graf graf--h3 graf--leading\">3. SPACES<\/h3>\n<p id=\"41a8\" class=\"graf graf--p graf-after--h3\">Spaces are fields of representation, a place where the data can exist. They have specific qualities that can help you highlight the traits of the data you\u2019re using. The important thing to acknowledge is their umber of dimensions\u00a0; N-dimensional data require N-dimensional space to be fully displayed.<\/p>\n<h4 id=\"fff8\" class=\"graf graf--h4 graf-after--p\">2D euclidean spaces<\/h4>\n<\/div>\n<div class=\"section-inner sectionLayout--outsetColumn\">\n<figure id=\"0c6c\" class=\"graf graf--figure graf--layoutOutsetCenter graf-after--h4\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*UDeIr69NxpSidcSpukdQjQ.png\" data-width=\"1800\" data-height=\"900\" data-action=\"zoom\" data-action-value=\"1*UDeIr69NxpSidcSpukdQjQ.png\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"37\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*UDeIr69NxpSidcSpukdQjQ.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*UDeIr69NxpSidcSpukdQjQ.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"c75b\" class=\"graf graf--p graf-after--figure\">The 2D cartesian space (above left) will let you display 2D data in a simple manner based on their X and Y values. It\u2019s the space of a page, a print or a map there is few to no work to get the data to fit and it\u2019s easy to draw lines between data points. The polar space (above right) is a way to represent 2D data as an Angle\/Radius pairs, displaying data in the 2D cartesian plane requires a simple transform ( x=sin(A)*R &amp; y=cos(A)*R ), once transformed, you can draw lines and most graphic APIs have methods to draw arcs between data points.<\/p>\n<h4 id=\"3b61\" class=\"graf graf--h4 graf-after--p\">3D euclidean spaces<\/h4>\n<p id=\"f8f7\" class=\"graf graf--p graf-after--h4\">Extending the 2D cartesian (X\/Y) space to 3D is trivial, first our object needs a third dimension (Z), then we need a third dimension in space to display it. It\u2019s the most used 3D space, it\u2019s very intuitive to use and to understand. But there are some lesser known 3D spaces.<\/p>\n<\/div>\n<div class=\"section-inner sectionLayout--outsetColumn\">\n<figure id=\"9b73\" class=\"graf graf--figure graf--layoutOutsetCenter graf-after--p\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*WcvIcaENLLwjQpKAVrbbPg.png\" data-width=\"1800\" data-height=\"900\" data-action=\"zoom\" data-action-value=\"1*WcvIcaENLLwjQpKAVrbbPg.png\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"37\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*WcvIcaENLLwjQpKAVrbbPg.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*WcvIcaENLLwjQpKAVrbbPg.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"5c96\" class=\"graf graf--p graf-after--figure\">The cylindrical space (above left) and the spherical space (above right) are both\u00a0<em class=\"markup--em markup--p-em\">extensions\u00a0<\/em>to the 2D polar space and a good example of what happens when you add a dimension to your data. Both data points are 3-dimensional: Angle\/Radius +\u00a0<em class=\"markup--em markup--p-em\">something<\/em>. In the case of the cylindrical space, the 3rd dimension will be used to\u00a0<em class=\"markup--em markup--p-em\">extrude\u00a0<\/em>the data point along the Z axis while in the spherical space, the 3rd dimension of the data point will encode a second angle that will move the data point on the Z axis\u00a0<em class=\"markup--em markup--p-em\">as if<\/em>\u00a0it moved on the surface of a sphere. Two important things to note\u00a0:<\/p>\n<ul class=\"postList\">\n<li id=\"041e\" class=\"graf graf--li graf-after--p\">data shape spaces and spaces shape data<\/li>\n<li id=\"36b1\" class=\"graf graf--li graf-after--li\">data can\u00a0<em class=\"markup--em markup--li-em\">shift<\/em>\u00a0between spaces of same dimensions<\/li>\n<\/ul>\n<h4 id=\"db28\" class=\"graf graf--h4 graf-after--li\">color spaces<\/h4>\n<figure id=\"7a75\" class=\"graf graf--figure graf--layoutOutsetLeft graf-after--h4\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*hfZlGn5jwg0nDTSp.png\" data-width=\"1024\" data-height=\"1024\" data-action=\"zoom\" data-action-value=\"0*hfZlGn5jwg0nDTSp.png\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"75\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/600\/0*hfZlGn5jwg0nDTSp.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/600\/0*hfZlGn5jwg0nDTSp.png\" \/><\/div>\n<\/div><figcaption class=\"imageCaption\">colors mapped to a 3D\u00a0space<\/figcaption><\/figure>\n<p id=\"283d\" class=\"graf graf--p graf-after--figure\">A good example of the above mentioned\u00a0<em class=\"markup--em markup--p-em\">shift<\/em>\u00a0is the colors spaces. A color is usually stored as a triplet of values: Red, Green and Blue ranging from 0 to 0xFF to match the way they are used by graphic APIS (color = R&lt;&lt;16|G&lt;&lt;8|B).<\/p>\n<p id=\"49cb\" class=\"graf graf--p graf-after--p\">As they have the same number of dimensions as a 3D point, we can map these data points directly to a 3D cartesian space where X=R, Y=G and Z=B and as we saw above, they can also be mapped to cylindrical and spherical spaces (HSL colors).<\/p>\n<p id=\"0529\" class=\"graf graf--p graf-after--p\">That\u2019s a very important feature when working with generative systems\u00a0; it\u2019s a sort of synesthesia where colors can become positions, positions can become sounds, sounds can become colors a.s.o.<\/p>\n<h4 id=\"3aea\" class=\"graf graf--h4 graf-after--p\">higher dimensions<\/h4>\n<p id=\"2ccd\" class=\"graf graf--p graf-after--h4\">Colors are a good example because they have a low number of dimensions, there is at most 4: RGB + Alpha (opacity). Now what if we wanted to represent the 4th dimension of a color set? We know how to display our colors in a 3D space but what does a 4D space look like?<\/p>\n<\/div>\n<div class=\"section-inner sectionLayout--outsetColumn\">\n<figure id=\"4d92\" class=\"graf graf--figure graf--layoutOutsetCenter graf-after--p\" data-scroll=\"native\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"1*kEfvOwWmXgLs87vxcbDj_Q.png\" data-width=\"1800\" data-height=\"902\" data-action=\"zoom\" data-action-value=\"1*kEfvOwWmXgLs87vxcbDj_Q.png\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"37\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*kEfvOwWmXgLs87vxcbDj_Q.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/1000\/1*kEfvOwWmXgLs87vxcbDj_Q.png\" \/><\/div>\n<\/div>\n<\/figure>\n<\/div>\n<div class=\"section-inner sectionLayout--insetColumn\">\n<p id=\"0349\" class=\"graf graf--p graf-after--figure\">The above illustrates what a 4D space could look like, the 4th dimension (usually, the time) would be represented by the orange axis.<\/p>\n<p id=\"3850\" class=\"graf graf--p graf-after--p\">To represent high dimensional space data, we\u2019ll often need to\u00a0<em class=\"markup--em markup--p-em\">project\u00a0<\/em>them onto a lower dimension. This operation will obliterate the values of some dimensions, and we will have to find a way to represent the parameters that \u201cwent missing\u201d during the projection. In the above illustration, it is very difficult to locate the points drawn on the right in the 4D space as not one but 2 dimensions went missing during the projection.<\/p>\n<figure id=\"59f4\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*s8hN2ViMV2HMbrBP.jpg\" data-width=\"545\" data-height=\"353\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"47\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*s8hN2ViMV2HMbrBP.jpg\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*s8hN2ViMV2HMbrBP.jpg\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"8539\" class=\"graf graf--p graf-after--figure\">This color palette is the 2D projection of a 3D object and the spectrum ramp represents the dimension that \u201cwent missing\u201d.<\/p>\n<figure id=\"d80f\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*T3ixqTg-5z9no3t0.jpg\" data-width=\"480\" data-height=\"360\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"55\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*T3ixqTg-5z9no3t0.jpg\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*T3ixqTg-5z9no3t0.jpg\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"aba4\" class=\"graf graf--p graf-after--figure\">Above is the projection of a 3D scene onto a 2D surface, the\u00a0<em class=\"markup--em markup--p-em\">depth<\/em>\u00a0data is lost<br \/>\nand a\u00a0<em class=\"markup--em markup--p-em\">depth buffer<\/em>\u00a0is used to represent the \u201cmissing data\u201d as a greyscale: the brightest the pixel, the closest our data point was to the camera. depending on the space your using, there are some strategies to reduce the\u00a0<em class=\"markup--em markup--p-em\">dimensionality<\/em>\u00a0of your dataset.<\/p>\n<figure id=\"bb3c\" class=\"graf graf--figure graf-after--p\">\n<div class=\"aspectRatioPlaceholder is-locked\">\n<div class=\"aspectRatioPlaceholder-fill\"><\/div>\n<div class=\"progressiveMedia js-progressiveMedia graf-image is-canvasLoaded is-imageLoaded\" data-image-id=\"0*0X-7QGh3lUpiKRBS.png\" data-width=\"960\" data-height=\"960\" data-action=\"zoom\" data-action-value=\"0*0X-7QGh3lUpiKRBS.png\" data-scroll=\"native\"><canvas class=\"progressiveMedia-canvas js-progressiveMedia-canvas\" width=\"75\" height=\"75\"><\/canvas><img decoding=\"async\" class=\"progressiveMedia-image js-progressiveMedia-image\" src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*0X-7QGh3lUpiKRBS.png\" data-src=\"https:\/\/cdn-images-1.medium.com\/max\/800\/0*0X-7QGh3lUpiKRBS.png\" \/><\/div>\n<\/div>\n<\/figure>\n<p id=\"9387\" class=\"graf graf--p graf-after--figure\">The above picture is the result of the t-SNE algorithm applied to the\u00a0<strong class=\"markup--strong markup--p-strong\">MNIST dataset<\/strong>\u00a0; high dimensional feature vectors are grouped by similarity then projected in 2D. In general, making sense of high dimensional data is hard (or lossy) and you should keep the dimensions\u2019 count as low as possible.<\/p>\n<h4 id=\"6dbe\" class=\"graf graf--h4 graf-after--p\">other types of\u00a0spaces<\/h4>\n<p id=\"2c07\" class=\"graf graf--p graf-after--h4 graf--trailing\">As a final note, there exist many other types of spaces. If we think of geometry only, the\u00a0<strong class=\"markup--strong markup--p-strong\">non-euclidean spaces\u00a0<\/strong>and\u00a0<strong class=\"markup--strong markup--p-strong\">hyperbolic spaces\u00a0<\/strong>are very interesting to explore (and not too hard to implement). There is of course the\u00a0<strong class=\"markup--strong markup--p-strong\">physical\/tangible space<\/strong>, you\u2019ll probably need some extra hardware like a laser cutter, a 3D printer or a CNC milling machine but holding the results of your generative system in your hands is very rewarding. Also worth noting the\u00a0<strong class=\"markup--strong markup--p-strong\">sound<\/strong>\u00a0which usually requires a physical space to be explored but generates a\u00a0<em class=\"markup--em markup--p-em\">space in space<\/em>.<\/p>\n<\/div>\n<\/div>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>this article was initially published on Medium, I&#8217;m posting it here for the record.<\/p>\n","protected":false},"author":1,"featured_media":1168,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sharing_disabled":false,"spay_email":"","jetpack_publicize_message":""},"categories":[3],"tags":[],"jetpack_featured_media_url":"http:\/\/barradeau.com\/blog\/wp-content\/uploads\/2017\/09\/1-W_svHdvHpa0Sbv65qwKLxQ.png","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p4oXhx-iN","_links":{"self":[{"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1165"}],"collection":[{"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1165"}],"version-history":[{"count":5,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1165\/revisions"}],"predecessor-version":[{"id":1171,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1165\/revisions\/1171"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/1168"}],"wp:attachment":[{"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1165"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/barradeau.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}