<?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"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Hue Shader &#8211; kind of works, anyone want to take a stab at it?</title>
		<atom:link href="http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 18:40:19 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-39196</guid>
					<title><![CDATA[Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-39196</link>
					<pubDate>Thu, 07 Aug 2008 18:51:03 +0000</pubDate>
					<dc:creator>vade</dc:creator>

					<description>
						<![CDATA[
						<p>Hello..</p>
<p>I noticed there was a lack of a hue rotation shader, which makes certain things difficult. I took a stab at it, and it &#8230; kind of works. Im not certain what I am doing wrong, and frankly, kindof moved on. So I post it here for those who want to give it a shot and repair it:</p>
<p>// <a href="http://www.graficaobscura.com/matrix/index.html" rel="nofollow">http://www.graficaobscura.com/matrix/index.html</a> &#8211; Hue rotation Matrix calculations. </p>
<p>This should be pretty straightforward, so I assume im making an assumption I should not be about either the linear RGB colorspace (which, im 99 % sure is what textures are usually handed off as), </p>
<p>Other than that, anyone? Beuller?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137646</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137646</link>
					<pubDate>Thu, 07 Aug 2008 18:53:05 +0000</pubDate>
					<dc:creator>vade</dc:creator>

					<description>
						<![CDATA[
						<p>By The way, I STILL CANT EDIT MESSAGES, EVEN 0.5 NANO SECONDS AFTER I POSTED THEM. GOD I CANT STAND THE FORUM !~@#!@#</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137647</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137647</link>
					<pubDate>Fri, 08 Aug 2008 08:29:40 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>is it possible your code is right-multiplying the rotation matrices<br />
while the original code is left-multiplying?</p>
<p>best-<br />
parag.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137648</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137648</link>
					<pubDate>Fri, 08 Aug 2008 10:24:50 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>no nevermind.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137649</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137649</link>
					<pubDate>Fri, 08 Aug 2008 10:33:10 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>is this right?</p>
<p>
// based on &#8220;Hue Rotation while preserving luminance&#8221;<br />
// <a href="http://www.graficaobscura.com/matrix/index.html" rel="nofollow">http://www.graficaobscura.com/matrix/index.html</a><br />
// Paul Haeberli<br />
//<br />
// ported to glsl by vade</p>
<p>
uniform float hue;</p>
<p>// define our varying texture coordinates<br />
varying vec2 texcoord0;<br />
// define our rectangular texture samplers<br />
uniform sampler2DRect tex0;</p>
<p>
// no need to compute these&#8230;<br />
const float sqrt2 = 1.414213562373095;<br />
const float sqrt3 = 1.732050807568877;<br />
const float oneoversqrt2 = 0.707106781186548;<br />
const float oneoversqrt3 = 0.577350269189626;</p>
<p>//const vec4 lumcoeff = vec4(0.299,0.587,0.114, 1.0);<br />
const vec4 lumcoeff = vec4(0.3086,0.6094,0.0820, 1.0);</p>
<p>const float zsx = lumcoeff.x/lumcoeff.z;<br />
const float zsy = lumcoeff.y/lumcoeff.z;</p>
<p>// matrix functions.</p>
<p>mat4 ident =  mat4(1.0, 0.0, 0.0, 0.0,<br />
						0.0, 1.0, 0.0, 0.0,<br />
						0.0, 0.0, 1.0, 0.0,<br />
						0.0, 0.0, 0.0, 1.0);</p>
<p>
// red<br />
mat4 rotateXMat(float rs, float rc)<br />
{<br />
	return mat4(1.0, 0.0, 0.0, 0.0,<br />
				0.0, rc,  rs,  0.0,<br />
				0.0, -rs, rc,  0.0,<br />
				0.0, 0.0, 0.0, 1.0);<br />
}</p>
<p>// green<br />
mat4 rotateYMat(float rs, float rc)<br />
{<br />
	return mat4(rc,  0.0, -rs, 0.0,<br />
				0.0, 1.0, 0.0, 0.0,<br />
				rs,  0.0, rc,  0.0,<br />
				0.0, 0.0, 0.0, 1.0);<br />
}				</p>
<p>// blue							<br />
mat4 rotateZMat( float rs, float rc)<br />
{<br />
	return mat4(rc,  rs,  0.0, 0.0,<br />
				-rs, rc,  0.0, 0.0,<br />
				0.0, 0.0, 1.0, 0.0,<br />
				0.0, 0.0, 0.0, 1.0);							<br />
}</p>
<p>mat4 shearZMatrix(float dx, float dy)<br />
{<br />
	return mat4(1.0, 0.0, dx,  0.0,<br />
				0.0, 1.0, dy,  0.0,<br />
				0.0, 0.0, 1.0, 0.0,<br />
				0.0, 0.0, 0.0, 1.0);<br />
}</p>
<p>vec4 xformpnt(mat4 matrix, vec4 inputVec)<br />
{</p>
<p>   return vec4( inputVec.x*matrix[0][0] + inputVec.y*matrix[1][0] +<br />
inputVec.z*matrix[2][0] + matrix[3][0],<br />
		inputVec.x*matrix[0][1] + inputVec.y*matrix[1][1] +<br />
inputVec.z*matrix[2][1] + matrix[3][1],<br />
		inputVec.x*matrix[0][2] +  inputVec.y*matrix[1][2] +<br />
inputVec.z*matrix[2][2] + matrix[3][2], 1.0);<br />
}</p>
<p>
void main (void)<br />
{</p>
<p>	vec4 inputVec = texture2DRect(tex0, texcoord0);</p>
<p>	// setup our transform mat &#8211; cant convert a const<br />
	mat4 transformMat = ident;					</p>
<p>	// rotate grey vector into positive Z<br />
	transformMat = rotateXMat(oneoversqrt2, oneoversqrt2) * transformMat;<br />
	transformMat = rotateYMat(-oneoversqrt3, sqrt2/sqrt3) * transformMat;</p>
<p>	// shear to preserve lumanince<br />
	vec4 something = xformpnt(transformMat, inputVec);<br />
	float zsx = something.x/something.z;<br />
	float zsy = something.x/something.z;<br />
	transformMat = shearZMatrix(zsx,zsy) * transformMat;</p>
<p>	// rotate hue, make angle input in degrees</p>
<p>	float hue_rs = sin(radians(hue));<br />
	float hue_rc = cos(radians(hue));<br />
	transformMat = rotateZMat(hue_rs, hue_rc) * transformMat;</p>
<p>	// unshear to preserve luminance<br />
	transformMat = shearZMatrix(-zsx,-zsy) * transformMat;</p>
<p>	// unrotate<br />
	transformMat = rotateYMat(oneoversqrt3, sqrt2/sqrt3 ) * transformMat;<br />
	transformMat = rotateXMat(-oneoversqrt2, oneoversqrt2) * transformMat;</p>
<p>	// do the hue transformation on our pixels<br />
	inputVec *= transformMat;</p>
<p>	// convert to a vec with proper rgb values from our mat4.</p>
<p>//	gl_FragColor = vec4(input0Mat[0][0], input0Mat[1][1],<br />
input0Mat[2][2], input0Mat[3][3] );</p>
<p>	gl_FragColor = inputVec;<br />
}</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137650</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137650</link>
					<pubDate>Fri, 08 Aug 2008 15:53:20 +0000</pubDate>
					<dc:creator>vade</dc:creator>

					<description>
						<![CDATA[
						<p>Looks like we have a winner! Great stuff. Ill upload a zip with everything bundled, with credits to you in the source, of course. Thanks, I know a few folks who will really appreciate this.</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137651</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137651</link>
					<pubDate>Fri, 08 Aug 2008 16:21:43 +0000</pubDate>
					<dc:creator>vade</dc:creator>

					<description>
						<![CDATA[
						<p>Here is the full shader jxs with vert and frag. I did not include an example/help patch.</p>
<p>The only parameter is &#8216;hue&#8217;, in degrees.</p>
<p>Thanks again PKM. I noticed your fixes do a bunch of additional matrix multiplies in there. Nice catches. :) This actually is of great help with some other stuff im working on :)</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137652</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137652</link>
					<pubDate>Fri, 08 Aug 2008 17:15:00 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>Sorry vade- I had a serious type in there originally with an x instead<br />
of a y and not using the lumcoeffs.  Just change these lines:</p>
<p>       vec4 something = xformpnt(transformMat, inputVec);<br />
       float zsx = something.x/something.z;<br />
       float zsy = something.x/something.z;<br />
       transformMat = shearZMatrix(zsx,zsy) * transformMat;</p>
<p>to:</p>
<p>       vec4 something = xformpnt(transformMat, lumcoeff);<br />
       float zsx = something.x/something.z;<br />
       float zsy = something.y/something.z;<br />
       transformMat = shearZMatrix(zsx,zsy) * transformMat;</p>
<p>
Though to be honest, it looks more interesting with the typo&#8230;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137653</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137653</link>
					<pubDate>Fri, 08 Aug 2008 17:35:26 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>Or maybe this is actually what it should be? But how does gl_FragColor<br />
accept that 4&#215;4 * 1&#215;4 = 4&#215;4?</p>
<p>       vec4 inputVec = texture2DRect(tex0, texcoord0);</p>
<p>       // setup our transform mat &#8211; cant convert a const<br />
       mat4 transformMat = ident;</p>
<p>       // rotate grey vector into positive Z<br />
       transformMat = rotateXMat(oneoversqrt2, oneoversqrt2) * transformMat;<br />
       transformMat = rotateYMat(-oneoversqrt3, sqrt2/sqrt3) * transformMat;</p>
<p>       // shear to preserve lumanince<br />
       vec4 something = xformpnt(transformMat, lumcoeff);<br />
       float zsx = something.x/something.z;<br />
       float zsy = something.y/something.z;<br />
       transformMat = shearZMatrix(zsx,zsy) * transformMat;</p>
<p>       // rotate hue, make angle input in degrees</p>
<p>       float hue_rs = sin(radians(hue));<br />
       float hue_rc = cos(radians(hue));<br />
       transformMat = rotateZMat(hue_rs, hue_rc) * transformMat;</p>
<p>       // unshear to preserve luminance<br />
       transformMat = shearZMatrix(-zsx,-zsy) * transformMat;</p>
<p>       // unrotate<br />
       transformMat = rotateYMat(oneoversqrt3, sqrt2/sqrt3 ) * transformMat;<br />
       transformMat = rotateXMat(-oneoversqrt2, oneoversqrt2) * transformMat;</p>
<p>       // do the hue transformation on our pixels<br />
       inputVec = transformMat * inputVec;</p>
<p>       // convert to a vec with proper rgb values from our mat4.</p>
<p>       gl_FragColor = inputVec;</p>
<p>
Ok I&#8217;m checking gimp/ps in a second to see what it&#8217;s really supposed<br />
to look like&#8230;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137654</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137654</link>
					<pubDate>Fri, 08 Aug 2008 17:38:51 +0000</pubDate>
					<dc:creator>PKM</dc:creator>

					<description>
						<![CDATA[
						<p>ok yea the last one i sent is what photoshop says.</p>
<p>sorry for the confusion!  :)</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137655</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137655</link>
					<pubDate>Tue, 16 Jun 2009 03:39:01 +0000</pubDate>
					<dc:creator>.mmb</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>I just tried loading this shader into a jit.gl.slab, and for some reason everything just passes through completely unaffected. Sending &#8220;param hue $1&#8243; doesn&#8217;t seem to do anything. Any thoughts as to why this might be the case?</p>
<p>.mmb</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137656</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137656</link>
					<pubDate>Wed, 15 Sep 2010 13:58:20 +0000</pubDate>
					<dc:creator>julienrobert</dc:creator>

					<description>
						<![CDATA[
						<p>I tried your shader and I got the error: &#8220;jit.gl.shader: error reading shader xml file&#8221;</p>
<p>I think it misses some part of the codes to make it working&#8230; I&#8217;m quite beginner in coding shader&#8230;</p>
<p>could you send the whole finale version of the shader please?</p>
<p>Thanks</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137657</guid>
					<title><![CDATA[Re: Hue Shader &#8211; kind of works, anyone want to take a stab at it?]]></title>
					<link>http://cycling74.com/forums/topic/hue-shader-kind-of-works-anyone-want-to-take-a-stab-at-it/#post-137657</link>
					<pubDate>Thu, 16 Sep 2010 18:12:26 +0000</pubDate>
					<dc:creator>laserpilot</dc:creator>

					<description>
						<![CDATA[
						<p>Yeah I tried taking a stab at this one a few weeks ago&#8230;if you get stuck in a bind without a working shader and need something similar and are on a mac..I use this: [jit.gl.imageunit @fx "Hue Adjust"] ..the imageunits can be useful in certain situations, but a normal glsl shader would be nice too..will just take some time for vade to come back around here, he still comes though</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

