<?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: luma displacement map with 2 images</title>
		<atom:link href="http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/feed</link>
		<description></description>
		<pubDate>Thu, 20 Jun 2013 00:35:39 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-41904</guid>
					<title><![CDATA[luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-41904</link>
					<pubDate>Fri, 23 Jan 2009 15:25:56 +0000</pubDate>
					<dc:creator>legaultsalvail@videotron.ca</dc:creator>

					<description>
						<![CDATA[
						<p>I&#8217;m looking for a shader like td.lumadisplace.jxs with the function of taking the luma map of the first image to displace the second image.</p>
<p>Does anyone have heard about something like that?</p>
<p>Thanks</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149550</guid>
					<title><![CDATA[Re: luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149550</link>
					<pubDate>Sun, 25 Jan 2009 10:53:19 +0000</pubDate>
					<dc:creator>nesa</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>perhaps you could use td.repos.jxs to achieve similar effect, or you  <br />
could try modifying lumadisplace shader to use two texture inputs.</p>
<p>-nesa</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149551</guid>
					<title><![CDATA[Re: luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149551</link>
					<pubDate>Sun, 25 Jan 2009 17:24:42 +0000</pubDate>
					<dc:creator>legaultsalvail@videotron.ca</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks. The problem is that I don&#8217;t understand what does the td.repos.jxs do exactly. The only doc I&#8217;ve found was inside the code: &#8220;distortion based on position map in second inlet&#8221;</p>
<p>Do you know what this shader does and how to use it?</p>
<p>Unfortunately, I&#8217;m not very good to program GLSL so it will be quite long for me to change the code of the lumadisplace for 2 textures&#8230;</p>
<p>Tank!</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149552</guid>
					<title><![CDATA[Re: luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149552</link>
					<pubDate>Sun, 25 Jan 2009 19:18:33 +0000</pubDate>
					<dc:creator>legaultsalvail@videotron.ca</dc:creator>

					<description>
						<![CDATA[
						<p>Ok, I&#8217;ve found how to use the repos.jxs shader. That&#8217;s almost what I was looking for isn&#8217;t?</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149553</guid>
					<title><![CDATA[Re: luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149553</link>
					<pubDate>Sun, 25 Jan 2009 23:05:26 +0000</pubDate>
					<dc:creator>nesa</dc:creator>

					<description>
						<![CDATA[
						<p>Yes that&#8217;s exactly what you want to use:)</p>
<p>If you look at the td.repos.jxs in text editor, you&#8217;ll see this line:</p>
<p>	vec4 look = texture2DRect(tex1,texcoord1);//sample repos texture</p>
<p>which assigns color&#038;alpha value from second texture going into  <br />
jit.gl.slab into a variable named &#8216;look&#8217;.<br />
texcoord1 is variable containing the coordinates of the pixel you want  <br />
to read.</p>
<p>the value of &#8216;look&#8217; is later used to modify texture coordinates of the  <br />
first texture:</p>
<p>	vec2 abso = look.ra*texdim0*amt;//absolute coordinates</p>
<p>which means &#8216;repos coordinate is value of &#8216;look&#8217; multiplied by the  <br />
size of first texture(texdim0) and then multiplied by the amount  <br />
parameter.</p>
<p>look.ra means that shader uses only red&#038;alpha channels.<br />
this is where one of the differences between lumadisplace and repos  <br />
takes place &#8211; repos uses red channel to modify X coordinate and alpha  <br />
channel for Y coordinate &#8211; just like jit.repos.</p>
<p>near the end of the file you&#8217;ll see:</p>
<p>	vec4 repos = texture2DRect(tex0, coord);</p>
<p>this is where the first texture(first inlet of jit.gl.slab) is being  <br />
sampled for the final output, using the coordinates modified by the  <br />
second texture.</p>
<p>So, this is a ruff overview of what&#8217;s going on in td.repos.jxs. If you  <br />
want to modify it to use the luma value to offset both x&#038;y  <br />
coordinates, you would need to first calculate the luminance of the  <br />
pixel, and then use it to offset both coordinates by the same amount.</p>
<p>Now you could take a look into saturation shader(cc.saturate.ip.jxs),  <br />
and see how luminance is calculated:</p>
<p>	vec3 intensity = vec3 (dot(texColor, LumCoeff));</p>
<p>here they calculate the dot product between color and  <br />
&#8216;grayish&#8217;(LumCoeff) values. Lumcoeef is defined earlier in the shader  <br />
as a constant value:</p>
<p>	const vec3 LumCoeff = vec3 (0.2125, 0.7154, 0.0721);</p>
<p>So you could use these two lines to create a modified version of  <br />
td.repos.jxs &#8211; first you should duplicate the file and rename it to  <br />
td.lumarepos.jxs.</p>
<p>Then you can open td.lumarepos.jxs, and start hacking by pasting the  <br />
lines for calculating luminance.<br />
But you should take care not to brake the structure of jitter shader,  <br />
so first you could paste &#8216;const&#8217; line after the &#8216;uniform&#8217; declarations  <br />
and before void main() function.</p>
<p>Next step is to add the dot product calculation to your new shader.<br />
In repos shader, &#8216;look&#8217; variable contains color information of the  <br />
second texture:</p>
<p>	vec4 look = texture2DRect(tex1,texcoord1);//sample repos texture</p>
<p>And this is what you can use to calculate the luminance(instead of  <br />
texColor used in saturation shader), by adding this line right after  <br />
reading the texture:</p>
<p>	vec4 look = texture2DRect(tex1,texcoord1);//sample repos texture<br />
	look = vec4 (dot(look, LumCoeff));</p>
<p>and now you have a lumadisplace&#038;repos crossbred mutant shader!</p>
<p>But if you&#8217;re not interested in learning glsl, then you can just  <br />
insert &#8216;cc.saturate.ip.jxs&#8217; slab with &#8216;@param alpha 0.&#8217; between your  <br />
displacement texture and right inlet of slab contating  td.repos.jxs  <br />
to achieve the same result:)</p>
<p>hope this helps,<br />
nesa</p>
<p>On Jan 25, 2009, at 8:18 PM, Julien-Robert wrote:</p>
<p>><br />
> Ok, I&#8217;ve found how to use the repos.jxs shader. That&#8217;s almost what I  <br />
> was looking for isn&#8217;t?<br />
> &#8211;<br />
> Julien-Robert<br />
> <a href="mailto:jitter@cycling74.com">jitter@cycling74.com</a>`</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149554</guid>
					<title><![CDATA[Re: luma displacement map with 2 images]]></title>
					<link>http://cycling74.com/forums/topic/luma-displacement-map-with-2-images/#post-149554</link>
					<pubDate>Mon, 26 Jan 2009 04:49:55 +0000</pubDate>
					<dc:creator>legaultsalvail@videotron.ca</dc:creator>

					<description>
						<![CDATA[
						<p>Thanks a lot for all these explanations!</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

