<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Romz blog</title>
	<atom:link href="http://mouaif.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mouaif.wordpress.com</link>
	<description>Computer graphics, shaders, generative coding</description>
	<lastBuildDate>Tue, 27 Jan 2009 23:24:50 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='mouaif.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/7ab57f45dbcac10ed7cead5fb4de2f98?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Romz blog</title>
		<link>http://mouaif.wordpress.com</link>
	</image>
			<item>
		<title>Levels control shader</title>
		<link>http://mouaif.wordpress.com/2009/01/28/levels-control-shader/</link>
		<comments>http://mouaif.wordpress.com/2009/01/28/levels-control-shader/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 23:19:23 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[contrast]]></category>
		<category><![CDATA[glsl]]></category>
		<category><![CDATA[hlsl]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[levels]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[romz]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=152</guid>
		<description><![CDATA[A little piece of code to reproduce the Levels control of Photoshop&#8230;

Input levels:
I already talked about the gamma correction (mid-tone slider), and I won&#8217;t explain what the shadows and highlights (black/white points) sliders are doing (excellent article here) but basically these can be used to remap the tonal range of the image. Here is how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=152&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A little piece of code to reproduce the Levels control of Photoshop&#8230;</p>
<p><img class="alignnone size-full wp-image-157" title="levels-all" src="http://mouaif.files.wordpress.com/2009/01/levels-all.jpg?w=405&#038;h=301" alt="levels-all" width="405" height="301" /></p>
<h2><span style="color:#000080;">Input levels:</span></h2>
<p>I already talked about the gamma correction (mid-tone slider), and I won&#8217;t explain what the shadows and highlights (black/white points) sliders are doing (<a title="photoshop levels control" href="http://www.cambridgeincolour.com/tutorials/levels.htm" target="_blank">excellent article here</a>) but basically these can be used to remap the tonal range of the image. Here is how it&#8217;s calculated:</p>
<p style="text-align:left;"><span style="color:#333333;">#define GammaCorrection(color, gamma)  pow(color, vec3(1.0 / gamma))<br />
#define LevelsControlInputRange(color, minInput, maxInput) min(max(color &#8211; vec3(minInput), vec3(0.0)) / (vec3(maxInput) &#8211; vec3(minInput)), vec3(1.0))<br />
#define LevelsControlInput(color, minInput, gamma, maxInput) GammaCorrection(LevelsControlInputRange(color, minInput, maxInput), gamma)</span></p>
<p style="text-align:left;">Example with values from the 1st screenshot (blackpoint = 90/255, gamma = 4, whitepoint = 150/255), red: original color, green: blackpoint &amp; whitepoint modified, blue: same with gamma:</p>
<p style="text-align:left;"><img class="alignnone size-full wp-image-170" title="levels-input" src="http://mouaif.files.wordpress.com/2009/01/levels-input.jpg?w=440&#038;h=454" alt="levels-input" width="440" height="454" /></p>
<h2><span style="color:#000080;">Output levels:</span></h2>
<p>This is useful to shorten the tonal range meaning compressing it to reduce contrast and shift it, <a title="photoshop output levels" href="http://www.zuberphotographics.com/content/photoshop/levels-output.htm" target="_blank">details here</a>.</p>
<p style="text-align:left;"><span style="color:#333333;">#define LevelsControlOutputRange(color, minOutput, maxOutput) mix(vec3(minOutput), vec3(maxOutput), color)</span></p>
<p style="text-align:left;">Example with values from the 1st screenshot (min output = 40/255, max output = 180/255), red: original color, green: output levels applied:</p>
<p style="text-align:left;"><img class="alignnone size-full wp-image-171" title="levels-output" src="http://mouaif.files.wordpress.com/2009/01/levels-output.jpg?w=440&#038;h=454" alt="levels-output" width="440" height="454" /></p>
<h2><span style="color:#000080;">Putting it all together:</span></h2>
<p style="text-align:left;"><span style="color:#333333;">#define LevelsControl(color, </span><span style="color:#333333;">minInput, gamma, maxInput</span><span style="color:#333333;">, minOutput, maxOutput) </span><span style="color:#333333;">LevelsControlOutputRange(</span><span style="color:#333333;">LevelsControlInput(color, minInput, gamma, maxInput)</span><span style="color:#333333;">, minOutput, maxOutput</span><span style="color:#333333;">)</span></p>
<p style="text-align:left;">Same example but both input and output levels taken into account, red: original color, green: final result:</p>
<p style="text-align:left;"><img class="alignnone size-full wp-image-172" title="levels-output-input" src="http://mouaif.files.wordpress.com/2009/01/levels-output-input.jpg?w=440&#038;h=454" alt="levels-output-input" width="440" height="454" /></p>
<p>So these macros make it quite easy to increase or reduce contrast, shift and clip tonal range, lighten or darken shadows and highlights. I added the (GLSL / HLSL) code to the <a title="Photoshop math shaders" href="http://blog.mouaif.org/2009/01/05/photoshop-math-with-glsl-shaders/">Photoshop Math shaders</a>.</p>
<p style="text-align:left;">
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=152&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2009/01/28/levels-control-shader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/levels-all.jpg" medium="image">
			<media:title type="html">levels-all</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/levels-input.jpg" medium="image">
			<media:title type="html">levels-input</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/levels-output.jpg" medium="image">
			<media:title type="html">levels-output</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/levels-output-input.jpg" medium="image">
			<media:title type="html">levels-output-input</media:title>
		</media:content>
	</item>
		<item>
		<title>Photoshop gamma correction shader</title>
		<link>http://mouaif.wordpress.com/2009/01/22/photoshop-gamma-correction-shader/</link>
		<comments>http://mouaif.wordpress.com/2009/01/22/photoshop-gamma-correction-shader/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 23:52:11 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[glsl]]></category>
		<category><![CDATA[hlsl]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[romz]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=133</guid>
		<description><![CDATA[After reproducing contrast, hue, saturation, brightness controls of Photoshop in pixel shaders, here is the gamma correction filter  

Photoshop
There are 2 ways of changing gamma in Photoshop:

Image &#124; Adjustments &#124; Exposure&#8230;
Image &#124; Adjustments &#124; Levels&#8230; (or CTRL+L) and then move the midtone slider.

Gamma correction is not the same thing than Brightness at all, even [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=133&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After reproducing contrast, hue, saturation, brightness controls of Photoshop in pixel shaders, here is the gamma correction filter <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-140" title="gamma-correction-photoshop-levels" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-photoshop-levels.jpg?w=440&#038;h=342" alt="gamma-correction-photoshop-levels" width="440" height="342" /></p>
<h2><span style="color:#000080;"><strong>Photoshop</strong></span></h2>
<p>There are 2 ways of changing gamma in Photoshop:</p>
<ul style="text-align:left;">
<li>Image | Adjustments | <strong>Exposure&#8230;</strong></li>
<li>Image | Adjustments | <strong>Levels&#8230;</strong> (or CTRL+L) and then move the <strong>midtone slider</strong>.</li>
</ul>
<p><a title="gamma correction definition" href="http://en.wikipedia.org/wiki/Gamma_correction" target="_blank">Gamma correction</a> is not the same thing than Brightness at all, even if it can give the impression it is. For example here is the histogram of my original image:</p>
<p><img class="alignnone size-full wp-image-137" title="gamma-correction-levels-before" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-before.jpg?w=405&#038;h=301" alt="gamma-correction-levels-before" width="405" height="301" /></p>
<p>Then after setting the gamma to 0.5 (it compresses the highlights and stretches the shadows):</p>
<p><img class="alignnone size-full wp-image-136" title="gamma-correction-levels-after" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-after.jpg?w=405&#038;h=301" alt="gamma-correction-levels-after" width="405" height="301" /></p>
<p>And here it is after lowering the brightness (Image | Adjustments | <strong>Brightness/Contrast&#8230;</strong>):</p>
<p><img class="alignnone size-full wp-image-135" title="gamma-correction-levels-after-brightness" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-after-brightness.jpg?w=405&#038;h=301" alt="gamma-correction-levels-after-brightness" width="405" height="301" /></p>
<p>Here you can see it clipped the values after some threshold in the shadows (and also in the highlights) and you&#8217;re loosing a lot of lighting information in this case. That&#8217;s actually why I wanted to have also a gamma control in my post-processing effects.</p>
<h2><span style="color:#000080;"><strong>Shader</strong></span></h2>
<p>A little macro:</p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Gamma from 9.99 to 0.1<br />
#define GammaCorrection(color, gamma)   pow(color, 1.0 / (gamma))</span></p>
<p style="padding-left:30px;"><span style="color:#333333;">color = GammaCorrection(</span><span style="color:#333333;">color</span><span style="color:#333333;">, 0.1);</span></p>
<p>Here are the curves it produces with extreme values (limits of Photoshop [9.99, 0.1]):</p>
<p><img class="alignnone size-full wp-image-138" title="gamma-correction-curves_tn" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-curves_tn.jpg?w=440&#038;h=518" alt="gamma-correction-curves_tn" width="440" height="518" /></p>
<p>So you see it stays in the same range and give a non-linear luminance (if correction value is different than 1). By the way I used this awesome <a title="Walterzorn function grapher" href="http://www.walterzorn.com/grapher/grapher_e.htm" target="_blank">web function grapher</a> here.</p>
<p>By zooming and taking a very close look I noticed a few tiny differences with Photoshop in the shadows (seriously you need to toggle screenshot from shader and photoshopped image quickly and scan the image to see where it&#8217;s not the same). Photoshop on the left, shader version on the right (gamma = 0.1).</p>
<p><img class="alignnone size-full wp-image-141" title="gamma-correction-comparison" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-comparison.jpg?w=440&#038;h=221" alt="gamma-correction-comparison" width="440" height="221" /></p>
<p>I also saw that the gamma in Photoshop (on the left) produced some banding artefacts somewhere, and it didn&#8217;t in my shader (on the right),  well.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> :</p>
<p><img class="alignnone size-full wp-image-142" title="gamma-correction-comparison2" src="http://mouaif.files.wordpress.com/2009/01/gamma-correction-comparison2.jpg?w=440&#038;h=221" alt="gamma-correction-comparison2" width="440" height="221" /></p>
<p>I added the code in my <a title="photoshop math glsl hlsl shader" href="http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/">Photoshop Math (GLSL/HLSL) shaders</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/133/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/133/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/133/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=133&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2009/01/22/photoshop-gamma-correction-shader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-photoshop-levels.jpg" medium="image">
			<media:title type="html">gamma-correction-photoshop-levels</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-before.jpg" medium="image">
			<media:title type="html">gamma-correction-levels-before</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-after.jpg" medium="image">
			<media:title type="html">gamma-correction-levels-after</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-levels-after-brightness.jpg" medium="image">
			<media:title type="html">gamma-correction-levels-after-brightness</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-curves_tn.jpg" medium="image">
			<media:title type="html">gamma-correction-curves_tn</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-comparison.jpg" medium="image">
			<media:title type="html">gamma-correction-comparison</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/gamma-correction-comparison2.jpg" medium="image">
			<media:title type="html">gamma-correction-comparison2</media:title>
		</media:content>
	</item>
		<item>
		<title>Photoshop math with HLSL shaders</title>
		<link>http://mouaif.wordpress.com/2009/01/08/photoshop-math-with-hlsl-shaders/</link>
		<comments>http://mouaif.wordpress.com/2009/01/08/photoshop-math-with-hlsl-shaders/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 21:04:42 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[hlsl]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[Ogre]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[romz]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=123</guid>
		<description><![CDATA[See my original post about Photoshop math in GLSL (blending modes, contrast, desaturation, RGB to HSL). Now it&#8217;s also in HLSL!
Download PhotoshopMath.hlsl
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=123&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>See my <a title="photoshop math glsl hlsl shader | Romain Dura | Romz" href="http://blog.mouaif.org/2009/01/05/photoshop-math-with-glsl-shaders/">original post</a> about Photoshop math in GLSL (blending modes, contrast, desaturation, RGB to HSL). Now it&#8217;s also in HLSL!</p>
<p><strong>Download <a title="photoshop math hlsl shader | Romain Dura | Romz" href="http://www.box.net/shared/y1tpmj61r8">PhotoshopMath.hlsl</a></strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=123&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2009/01/08/photoshop-math-with-hlsl-shaders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>
	</item>
		<item>
		<title>Photoshop math with GLSL shaders</title>
		<link>http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/</link>
		<comments>http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 22:41:00 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[glsl]]></category>
		<category><![CDATA[Ogre]]></category>
		<category><![CDATA[Photography]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[post-effect]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shader]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=94</guid>
		<description><![CDATA[I usualy play with Photoshop to try post-processing effects on photos or game screenshots, it&#8217;s a lot faster than coding directly anything in shaders, but at the end I wanted to see my effects running in real-time. So I adapted a big part of the C-like code from this famous Photoshop blending mode math page [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=94&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I usualy play with Photoshop to try post-processing effects on photos or game screenshots, it&#8217;s a lot faster than coding directly anything in shaders, but at the end I wanted to see my effects running in real-time. So I adapted a big part of the C-like code from this famous <a title="photoshop blending mode math" href="http://www.nathanm.com/photoshop-blending-math/" target="_blank">Photoshop blending mode math</a> page + missing blending modes to GLSL (and now HLSL!) code and I added a few other useful things from Photoshop, such as Hue/Saturation/Luminance conversion, desaturation, contrast.</p>
<p>For example, I tried combining a few things in my Editor:</p>
<p><img class="alignnone size-full wp-image-98" title="photoshopmath_tn" src="http://mouaif.files.wordpress.com/2009/01/photoshopmath_tn.jpg?w=440&#038;h=198" alt="photoshopmath_tn" width="440" height="198" /></p>
<p><img class="alignnone size-full wp-image-99" title="photoshopmath_editor_tn" src="http://mouaif.files.wordpress.com/2009/01/photoshopmath_editor_tn.jpg?w=440&#038;h=344" alt="photoshopmath_editor_tn" width="440" height="344" /></p>
<p>Translating Photoshop operations on layers gives this kind of code:</p>
<p><span style="color:#333333;"> uniform sampler2D Tex;<br />
uniform sampler1D GradientMap;<br />
uniform sampler1D GradientGround;</span></p>
<p><span style="color:#333333;">varying vec2 uv;</span></p>
<p><span style="color:#333333;">void main()<br />
{</span></p>
<p style="padding-left:30px;"><span style="color:#333333;">vec3 color = texture2D(Tex, uv).xyz;</span></p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Split-tone<br />
vec4 colorDesat = Desaturate(color, 1.0);<br />
vec3 splitColor = texture1D(GradientMap, colorDesat.r).rgb;<br />
vec3 pass1 = BlendColor(color, splitColor);</span></p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Vertical gradient<br />
vec4 verticalGradientColor = texture1D(GradientGround, uv.y);<br />
vec3 pass2 = mix(pass1, BlendColor(pass1, verticalGradientColor.rgb), verticalGradientColor.a);</span></p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Luminosity<br />
vec3 pass3 = mix(pass2, BlendLuminosity(pass2, color + vec3(0.08)), 0.5);</span></p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Linear light at 40%<br />
vec3 pass4 = mix(pass3, BlendLinearLight(pass3, color), 0.4);</span></p>
<p style="padding-left:30px;"><span style="color:#333333;"> // Final<br />
gl_FragColor = vec4(pass4, 1.0);</span></p>
<p><span style="color:#333333;">}</span></p>
<p>Here is the list of blending modes and functions I got:</p>
<p><strong>Blending modes:</strong></p>
<ul>
<li>Normal</li>
<li>Lighten</li>
<li>Darken</li>
<li>Multiply</li>
<li>Average</li>
<li>Add</li>
<li>Substract</li>
<li>Difference</li>
<li>Negation</li>
<li>Exclusion</li>
<li>Screen</li>
<li>Overlay</li>
<li>SoftLight</li>
<li>HardLight</li>
<li>ColorDodge</li>
<li>ColorBurn</li>
<li>LinearDodge</li>
<li>LinearBurn</li>
<li>LinearLight</li>
<li>VividLight</li>
<li>PinLight</li>
<li>HardMix</li>
<li>Reflect</li>
<li>Glow</li>
<li>Phoenix</li>
<li>Hue</li>
<li>Saturation</li>
<li>Color</li>
<li>Luminosity</li>
</ul>
<p><strong>Functions:</strong></p>
<ul>
<li>Desaturation</li>
<li>RGBToHSL (RGB to Hue/Saturation/Luminance)</li>
<li>HSLToRGB (Hue/Saturation/Luminance to RGB)</li>
<li>Contrast</li>
</ul>
<p>Here is my GLSL code, almost all the blending modes are macros and some do per-channel operation so it could run faster using vector operations with masks (to take into account the values per component), but still I guess it could help <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Download <a title="photoshop math glsl shader | Romain Dura | Romz" href="http://www.box.net/shared/hijgkl6tt9" target="_blank">PhotoshopMath.glsl</a></strong></p>
<p><strong>&#8211;</strong></p>
<p><strong>Update:</strong></p>
<p>Oh and by the way you noticed the <a title="split tone photoshop tutorial" href="http://www.magicalplacesfineart.com/blog/2008/08/photoshop-cs-tutorial-how-to-split-tone-a-photo-in-30-seconds-or-less/" target="_blank">Split-Tone</a> pass in my example:</p>
<p><span style="color:#333333;">// Split-tone<br />
vec4 colorDesat = Desaturate(color, 1.0);<br />
vec3 splitColor = texture1D(GradientMap, colorDesat.r).rgb;<br />
vec3 result = BlendColor(color, splitColor);</span></p>
<p>It&#8217;s just the same thing than the <em>Gradient Map&#8230;</em> of the <em>Create new fill or adjustment layer</em> in Photoshop but blended in Color mode, which reminds me <a title="color temperature effect as shader" href="http://blog.mouaif.org/2008/03/13/practical-light-and-color-shader/">Color Temperature</a> and <a title="cross processing effect as shader" href="http://blog.mouaif.org/2008/06/11/crossprocessing-shader/">Cross-Processing</a> effects <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#8211;</p>
<p><strong>Update:</strong></p>
<p>I updated the .glsl file, because I forgot a line in the <em>ContrastSaturationBrightness()</em> function and I had some issues on specific hardware due to conditional returns, so now it&#8217;s fixed.</p>
<p>And now, here is the HLSL version <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Download <a title="photoshop math hlsl shader | Romain Dura | Romz" href="http://www.box.net/shared/y1tpmj61r8">PhotoshopMath.hlsl</a></strong></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/94/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/94/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/94/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=94&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/photoshopmath_tn.jpg" medium="image">
			<media:title type="html">photoshopmath_tn</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2009/01/photoshopmath_editor_tn.jpg" medium="image">
			<media:title type="html">photoshopmath_editor_tn</media:title>
		</media:content>
	</item>
		<item>
		<title>Real-Time Peter de Jong Attractors</title>
		<link>http://mouaif.wordpress.com/2008/12/15/real-time-peter-de-jong-attractors-2/</link>
		<comments>http://mouaif.wordpress.com/2008/12/15/real-time-peter-de-jong-attractors-2/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 20:57:32 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ogre attractors real-time romz]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/2008/12/15/real-time-peter-de-jong-attractors-2/</guid>
		<description><![CDATA[A simple B&#38;W version. Again, everything is done on the CPU, running at 80fps on my single core 3500+. 10000 iterations per frame. Random but still a bit too cyclic due to my way of changing the attractor&#8217;s parameters (almost same frequency and amplitude a bit too extreme causing these empty frames). It also does [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=90&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A simple B&amp;W version. Again, everything is done on the CPU, running at 80fps on my single core 3500+. 10000 iterations per frame. Random but still a bit too cyclic due to my way of changing the attractor&#8217;s parameters (almost same frequency and amplitude a bit too extreme causing these empty frames). It also does produce blank frames with specific parameter values (not necessarily extremes), wonder if that&#8217;s the same with Clifford attractors.</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=2261840&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2261840&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/90/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/90/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/90/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=90&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/12/15/real-time-peter-de-jong-attractors-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>
	</item>
		<item>
		<title>Attractors &amp; Quartz Composer</title>
		<link>http://mouaif.wordpress.com/2008/11/11/attractors-quartz-composer/</link>
		<comments>http://mouaif.wordpress.com/2008/11/11/attractors-quartz-composer/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 17:04:54 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[attractors]]></category>
		<category><![CDATA[nodebox]]></category>
		<category><![CDATA[Ogre]]></category>
		<category><![CDATA[quartz composer]]></category>
		<category><![CDATA[romz]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=81</guid>
		<description><![CDATA[I&#8217;ve been playing a bit more with NodeBox the other day, trying to render Peter De Jong attractors. Something I already tried in my (unnamed) Editor with Ogre. Here is a video my first real-time experiment with Ogre (30FPS on a 3500+, don&#8217;t care about the GPU since the attractors iterations run on the CPU):


	
	
	
	


Actually [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=81&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve been playing a bit more with NodeBox the other day, trying to render <a title="paul bourke peter de jong attractors" href="http://local.wasp.uwa.edu.au/~pbourke/fractals/peterdejong/" target="_blank">Peter De Jong attractors</a>. Something I already tried in my (unnamed) Editor with Ogre. Here is a video my first real-time experiment with Ogre (30FPS on a 3500+, don&#8217;t care about the GPU since the attractors iterations run on the CPU):</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=2215070&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2215070&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<p>Actually I accelerated the video 3x the normal speed.</p>
<p>So, I tried to do it another way with NodeBox and I started from this <a title="nodebox peter de jong attractors" href="http://nodebox.net/code/index.php/shared_2008-02-29-18-05-38" target="_blank">little code</a> (thanks btw) and made things animated and exported to a movie (things like this go very slow in real-time with this tool):</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=2215129&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2215129&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<p>And then during a <em>right click / Open with &#8230;</em> I just remembered I had <a title="quartz composer apple" href="http://developer.apple.com/graphicsimaging/quartz/quartzcomposer.html" target="_blank">Quartz Composer</a>. I had no idea how it works but this is actually the kind of tool I was looking for lately <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Here are 2 quick tests I made from my previous B&amp;W video:</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=2215108&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2215108&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=2215166&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=2215166&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<p>A few simple image operators and blending patches and we&#8217;re done.</p>
<p><img class="alignnone size-full wp-image-84" title="qc-attractors" src="http://mouaif.files.wordpress.com/2008/11/qc-attractors.png?w=440&#038;h=172" alt="qc-attractors" width="440" height="172" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=81&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/11/11/attractors-quartz-composer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/11/qc-attractors.png" medium="image">
			<media:title type="html">qc-attractors</media:title>
		</media:content>
	</item>
		<item>
		<title>Experimenting NodeBox</title>
		<link>http://mouaif.wordpress.com/2008/06/13/experimenting-nodebox/</link>
		<comments>http://mouaif.wordpress.com/2008/06/13/experimenting-nodebox/#comments</comments>
		<pubDate>Fri, 13 Jun 2008 09:00:44 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[2d]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computational]]></category>
		<category><![CDATA[image processing]]></category>
		<category><![CDATA[nodebox]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=79</guid>
		<description><![CDATA[Heya! I recently discovered NodeBox, amazing software dedicated to computational art / creative &#38; generative programming. I&#8217;m not gonna (re-)present anything about it, but here are some videos of my first two attempts with this fantastic tool.
Just changed 1 or 2 things from this little tutorial. If you keep looking at the center point, after [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=79&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Heya! I recently discovered <a title="nodebox official" href="http://nodebox.net">NodeBox</a>, amazing software dedicated to computational art / creative &amp; generative programming. I&#8217;m not gonna (re-)present anything about it, but here are some videos of my first two attempts with this fantastic tool.</p>
<p>Just changed 1 or 2 things from this <a title="nodebox graphics state tutorial" href="http://nodebox.net/code/index.php/Graphics_State" target="_blank">little tutorial</a>. If you keep looking at the center point, after watching the video, you&#8217;ll see the stopped image rotating in the inverse direction, heh.</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=1161833&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1161833&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<p>The next one is another variation with some colors and cubes, and just a different way to rotate some objects.</p>
<p><span style='text-align:center; display: block;'>
<object type="application/x-shockwave-flash" width="400" height="300" data="http://www.vimeo.com/moogaloop.swf?clip_id=1163327&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA">
	<param name="quality" value="best" />
	<param name="allowfullscreen" value="true" />
	<param name="scale" value="showAll" />
	<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=1163327&amp;server=www.vimeo.com&amp;fullscreen=1&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=01AAEA" />
</object>
</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mouaif.wordpress.com/79/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mouaif.wordpress.com/79/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=79&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/06/13/experimenting-nodebox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>
	</item>
		<item>
		<title>CrossProcessing shader</title>
		<link>http://mouaif.wordpress.com/2008/06/11/crossprocessing-shader/</link>
		<comments>http://mouaif.wordpress.com/2008/06/11/crossprocessing-shader/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 10:17:30 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[cross processing]]></category>
		<category><![CDATA[game dev]]></category>
		<category><![CDATA[glsl]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[shader]]></category>
		<category><![CDATA[xpro]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=56</guid>
		<description><![CDATA[Hi ! I&#8217;m doing a lot of image processing at work since a few weeks, and there a lots of things I wanna try, from post processes to dynamic geometry, but I would need another life for that. After having watched some (really nice) super cars videos (just check at the first one showing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=56&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi ! I&#8217;m doing a lot of image processing at work since a few weeks, and there a lots of things I wanna try, from post processes to dynamic geometry, but I would need another life for that. After having watched some (really nice) <a title="super cars movies" href="http://www.supercarmovies.com/html/interface.html" target="_blank">super cars videos</a> (just check at the first one showing the Corvette to see what I mean), I&#8217;ve been talking with <a title="nicouf flickr photos" href="http://www.flickr.com/photos/nicouf" target="_blank">Nico</a> about the <a title="cross processing definition" href="http://en.wikipedia.org/wiki/Cross_processing" target="_blank">Cross Processing</a> effect, also called <em>xpro</em>, used in photography, and probably in the Corvette video.</p>
<p><img src="http://mouaif.files.wordpress.com/2008/06/corvette-xpro4.jpg?w=440&#038;h=183" alt="corvette cross processing" width="440" height="183" /></p>
<p><img src="http://mouaif.files.wordpress.com/2008/06/corvette-xpro2.jpg?w=440&#038;h=183" alt="corvette cross processing" width="440" height="183" /></p>
<p><img src="http://mouaif.files.wordpress.com/2008/06/corvette-xpro3.jpg?w=440&#038;h=183" alt="corvette cross processing" width="440" height="183" /></p>
<p><img src="http://mouaif.files.wordpress.com/2008/06/corvette-xpro1.jpg" alt="corvette cross processing" /></p>
<p>After a quick talk (thanks) I made a simple pixel shader that post process a given scene with this nice effect <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I followed this <a title="cross processing photoshop tutorial" href="http://www.photoshopsupport.com/tutorials/or/cross-processing.html" target="_blank">Photoshop tutorial</a> to make it, here are the steps to work with the shader:</p>
<ul>
<li>Make a black-to-white gradient</li>
<li>Add a New fill or adjustment layer, select Curves, and set the curves just like in the tutorial</li>
</ul>
<p><img src="http://mouaif.files.wordpress.com/2008/06/curves-xpro-photoshop.jpg" alt="cross processing curves gradient" width="440" height="47" /></p>
<ul>
<li>Save the 1D image, it&#8217;ll be used in the pixel shader just like a curve modifier</li>
<li>Modify the final color of your pixels with this (GLSL) code:</li>
</ul>
<p style="padding-left:60px;"><span style="color:#0000ff;">vec3 <span style="color:#000000;">curvesColor</span><span style="color:#000000;">;</span></span></p>
<p style="padding-left:60px;"><span style="color:#000000;">curvesColor.r = </span><span style="color:#993300;">texture1D</span><span style="color:#000000;">(curveTex, pixelColor.r ).r;</span><br />
<span style="color:#000000;">curvesColor.g = </span><span style="color:#993300;">texture1D</span><span style="color:#000000;">(curveTex, pixelColor.g).g;</span><br />
<span style="color:#000000;">curvesColor.b = </span><span style="color:#993300;">texture1D</span><span style="color:#000000;">(curveTex, pixelColor.b).b;</span></p>
<p style="padding-left:60px;"><span style="color:#0000ff;"><span style="color:#339966;">gl_FragColor</span><span style="color:#000000;">.</span><span style="color:#000000;">rgb = curvesColor;</span></span></p>
<p>And voila ! Here are some screenshots I took in <strong><em><span style="color:#003366;">Reverse</span></em></strong> (my end of studies project [team of 6 students]), maybe not the best example for this kind of effect but anyway:</p>
<p style="text-align:center;"><strong>Without</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without1-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without1.jpg" alt="reverse no cross processing shader" /></a></p>
<p style="text-align:center;"><strong>Without</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without2-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without2.jpg" alt="reverse no cross processing shader" /></a></p>
<p style="text-align:center;">
<p style="text-align:center;"><strong>With</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with1-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with1.jpg" alt="reverse no cross processing shader" /></a></p>
<p style="text-align:center;"><strong>With</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with2-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with2.jpg" alt="reverse no cross processing shader" /></a></p>
<p style="text-align:center;"><strong>With</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with3-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with3.jpg" alt="reverse no cross processing shader" /></a></p>
<p style="text-align:center;"><strong>With</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with4-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with4.jpg" alt="reverse no cross processing shader" /></a></p>
<p>In fact it makes me think about <em>color temperature</em> again, but this time the color is modifyed per channel and is dependent to the color components themselves instead of the luminance component of the pixel.</p>
<p>One more screen with all the effects combined during turbo (dolly zoom, desaturation, radial motion blur):</p>
<p style="text-align:center;"><strong>With</strong><br />
<a title="reverse no cross processing shader" href="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with5-effects-big.jpg" target="_blank"><img src="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with5-effects.jpg" alt="reverse no cross processing shader" /></a></p>
<p>Well, I guess these are the first public screenshots of the final version of the game <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Oh and <a title="photoshop blending math" href="http://www.nathanm.com/photoshop-blending-math/" target="_blank">by the way</a> &#8230;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mouaif.wordpress.com/56/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mouaif.wordpress.com/56/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=56&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/06/11/crossprocessing-shader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/corvette-xpro4.jpg" medium="image">
			<media:title type="html">corvette cross processing</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/corvette-xpro2.jpg" medium="image">
			<media:title type="html">corvette cross processing</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/corvette-xpro3.jpg" medium="image">
			<media:title type="html">corvette cross processing</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/corvette-xpro1.jpg" medium="image">
			<media:title type="html">corvette cross processing</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/curves-xpro-photoshop.jpg" medium="image">
			<media:title type="html">cross processing curves gradient</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without1.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-without2.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with1.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with2.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with3.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with4.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/06/xpro-reverse-with5-effects.jpg" medium="image">
			<media:title type="html">reverse no cross processing shader</media:title>
		</media:content>
	</item>
		<item>
		<title>Kinda color temperature</title>
		<link>http://mouaif.wordpress.com/2008/05/06/kinda-color-temperatur/</link>
		<comments>http://mouaif.wordpress.com/2008/05/06/kinda-color-temperatur/#comments</comments>
		<pubDate>Tue, 06 May 2008 21:19:28 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[color temperature gaming lighting]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=51</guid>
		<description><![CDATA[Hi all, I&#8217;m not dead.
I saw an interesting image the other day, that directly made me think about the color temperature concept. It comes from the game Fallen Empire: Legions, upcoming Tribes clone running in a web browser on instantaction.com. It produces another interesting effect, because it seems to use another color palette and still [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=51&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Hi all, I&#8217;m not dead.</p>
<p>I saw an interesting image the other day, that directly made me think about the <a title="color temperature concept post" href="http://mouaif.wordpress.com/2008/03/13/practical-light-and-color-shader/">color temperature</a> concept. It comes from the game <em>Fallen Empire: Legions</em>, upcoming <em>Tribes</em> clone running in a web browser on <a title="instant action" href="http://instantaction.com/">instantaction.com</a>. It produces another interesting effect, because it seems to use another color palette and still link it to the luminance of the object&#8217;s pixels.</p>
<p><a title="fallen empire legions" href="http://www.nofrag.com/images/00382f.jpg"><img src="http://mouaif.files.wordpress.com/2008/05/legions-color-temperature.jpg?w=440&#038;h=414" alt="legions color temperature" width="440" height="414" /></a></p>
<p>Maybe they&#8217;re not doing anything like this to get this particular lighting and they are using multiple lights or even any photoshop treatment, but it could be and <a title="it's like that" href="http://youtube.com/watch?v=ZsBfPhtSWl8">that&#8217;s the way</a> I interpreted it <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mouaif.wordpress.com/51/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mouaif.wordpress.com/51/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=51&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/05/06/kinda-color-temperatur/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/05/legions-color-temperature.jpg" medium="image">
			<media:title type="html">legions color temperature</media:title>
		</media:content>
	</item>
		<item>
		<title>Patriotic</title>
		<link>http://mouaif.wordpress.com/2008/04/01/patriotic/</link>
		<comments>http://mouaif.wordpress.com/2008/04/01/patriotic/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 22:35:19 +0000</pubDate>
		<dc:creator>Romz</dc:creator>
				<category><![CDATA[My life]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[night]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[san francisco]]></category>
		<category><![CDATA[USA]]></category>

		<guid isPermaLink="false">http://mouaif.wordpress.com/?p=50</guid>
		<description><![CDATA[
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=50&subd=mouaif&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://flickr.com/photos/romzr/2380582873/"><img src="http://mouaif.files.wordpress.com/2008/04/dsc_1482_tn.jpg?w=440&#038;h=295" alt="san francisco usa flag" height="295" width="440" /></a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/mouaif.wordpress.com/50/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/mouaif.wordpress.com/50/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mouaif.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mouaif.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mouaif.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mouaif.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mouaif.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mouaif.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mouaif.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mouaif.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mouaif.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mouaif.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mouaif.wordpress.com&blog=2876789&post=50&subd=mouaif&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://mouaif.wordpress.com/2008/04/01/patriotic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/19a6829daad771b326b97fdb34b86fce?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Romz</media:title>
		</media:content>

		<media:content url="http://mouaif.files.wordpress.com/2008/04/dsc_1482_tn.jpg" medium="image">
			<media:title type="html">san francisco usa flag</media:title>
		</media:content>
	</item>
	</channel>
</rss>