<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Outline via glsl?]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=56&amp;type=atom"/>
	<updated>2011-03-17T18:08:22Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=56</id>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=240#p240"/>
			<content type="html"><![CDATA[<p>Yep - that made it.</p><p>Nice. Thumb up.<br />Thanx for all your help and work!</p>]]></content>
			<author>
				<name><![CDATA[Kralle]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=50</uri>
			</author>
			<updated>2011-03-17T18:08:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=240#p240</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=230#p230"/>
			<content type="html"><![CDATA[<p>I will watch to correct the full example, but for now you can try this :</p><p>vec3 N = normalize(normal);</p><p>float ink = dot(normalize(-position), N);<br />ink = clamp(pow(ink*3.0, 20.0), 0.0, 1.0);</p><p>gl_FragColor = vec4(ink, ink, ink, 1.0);</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-03-16T12:05:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=230#p230</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=229#p229"/>
			<content type="html"><![CDATA[<p>how, strange... thank you for the reply.<br />There is maybe a clamp computation or a negative value working differently on your 3d card,<br />it&#039;s probably a small thing to check. I will have a look, if you can also try to modify the shader<br />on your machine tell us.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-03-16T11:34:36Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=229#p229</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=226#p226"/>
			<content type="html"><![CDATA[<p>As it looks for me...<br /><a href="http://img855.imageshack.us/i/inkshade.jpg/">http://img855.imageshack.us/i/inkshade.jpg/</a></p>]]></content>
			<author>
				<name><![CDATA[Kralle]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=50</uri>
			</author>
			<updated>2011-03-15T18:41:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=226#p226</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=224#p224"/>
			<content type="html"><![CDATA[<p>Nice - i will take a look at it.<br />---<br />mmmh - the ink shader looks strange.<br />it seems to be 45 degree rotated (on my system). <br />I can see half white and half black on the teacup.<br />Will post a screen later (after work).</p>]]></content>
			<author>
				<name><![CDATA[Kralle]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=50</uri>
			</author>
			<updated>2011-03-14T10:23:44Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=224#p224</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=223#p223"/>
			<content type="html"><![CDATA[<p>It&#039;s not exactly what you need but I made a simple ink shader example there :<br /><a href="http://www.maratis3d.org/?p=548">http://www.maratis3d.org/?p=548</a></p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-03-14T10:19:10Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=223#p223</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=178#p178"/>
			<content type="html"><![CDATA[<p>Yes, i agree for the environment, it&#039;s globally not a pretty technique. Stay in touch with the website news, I will publish more example and post process will be one.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-03-04T09:08:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=178#p178</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=177#p177"/>
			<content type="html"><![CDATA[<p>Thanx for the fast answer.</p><p>Yeah - i know the &quot;cheap&quot; trick. <br />It works very well on playermodels and static props (boxes, barrels, crates, furniture, etc.)<br />but it&#039;s insane if you want outline in the enviroment, you can&#039;t duplicate and scale the whole level itself.</p>]]></content>
			<author>
				<name><![CDATA[Kralle]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=50</uri>
			</author>
			<updated>2011-03-03T11:18:04Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=177#p177</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=176#p176"/>
			<content type="html"><![CDATA[<p>Hi,<br />for cell shading, you can do it using a glsl shader that you link using blender and custom material,<br />like example named &quot;cartoon t-pot&quot;. Look in &quot;Example/Demos/shaders/&quot; for glsl simple cartoon example.</p><p>For outlines, it depend on the technique you want to use,<br />but it will generally be a post process effect comparing pixels depth and/or normals.</p><p>Post process is not implemented as a one clic feature yet,<br />it can only be done manually using c++ and game plugin,<br />I&#039;m working on a example for this, I hope to finish it soon.</p><p>If you are not programming, there is a &quot;cheap&quot; technique to do outlines,<br />it&#039;s not very evolved but it can give good results and doesn&#039;t need shaders.<br />Using blender, you duplicate your mesh, scale it a little bit and reverse the normals,<br />you then apply to this copy a black material. The copy will create an outilne thanks to z-buffer,<br />it is not a pretty technique, but it has been used in lots of commercial games.<br />(in blender, make sure to disable &quot;double sided&quot; for both meshs)</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-03-03T11:02:21Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=176#p176</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Outline via glsl?]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=174#p174"/>
			<content type="html"><![CDATA[<p>Hi - Just to get it right (inside my brain..)</p><p>If i want normal rendering and also a black outline (like in toon shading but without the toon shading)...<br />Then i need to write a glsl shader and add them in the blender export panel under materials/maritas/customshader in the vertex/fragment shader slots?</p><p>Found goggling the following code, haven&#039;t been able to test it yet, but could it work?</p><p>for Vertex: <br />varying vec3 normal, lightDir; <br />varying vec2 texCoord; <br />void main() <br />{&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; vec4 ecPos; <br />&nbsp; &nbsp; &nbsp; &nbsp; ecPos = vec4(gl_ModelViewMatrix * gl_Vertex); <br />&nbsp; &nbsp; &nbsp; &nbsp; lightDir = normalize(vec3(gl_LightSource[0].position) - ecPos.xyz); <br />&nbsp; &nbsp; &nbsp; &nbsp; normal = normalize(gl_NormalMatrix * gl_Normal); <br />&nbsp; &nbsp; &nbsp; &nbsp; texCoord = vec2(gl_MultiTexCoord0); <br />&nbsp; &nbsp; &nbsp; &nbsp; gl_Position = ftransform(); <br />} </p><p>for Fragment: <br />varying vec3 normal, lightDir; <br />varying vec2 texCoord; <br />uniform sampler2D texture; <br />void main() <br />{ <br />&nbsp; &nbsp; &nbsp; &nbsp; float intensity; <br />&nbsp; &nbsp; &nbsp; &nbsp; vec3 n; <br />&nbsp; &nbsp; &nbsp; &nbsp; vec4 _color; <br />&nbsp; &nbsp; &nbsp; &nbsp; n = normalize(normal); <br />&nbsp; &nbsp; &nbsp; &nbsp; intensity = dot(lightDir, n); <br />&nbsp; &nbsp; &nbsp; &nbsp; if (intensity &gt; 0.98) <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _color = vec4(1.0,1.0,1.0,1.0); <br />&nbsp; &nbsp; &nbsp; &nbsp; else if (intensity &gt; 0.5) <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _color = vec4(0.8,0.8,0.8,1.0); <br />&nbsp; &nbsp; &nbsp; &nbsp; else if (intensity &gt; 0.35) <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _color = vec4(0.4,0.4,0.4,1.0); <br />&nbsp; &nbsp; &nbsp; &nbsp; else <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _color = vec4(0.0,0.0,0.0,1.0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; gl_FragColor = _color * texture2D(texture, texCoord);&nbsp; &nbsp;<br />}</p>]]></content>
			<author>
				<name><![CDATA[Kralle]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=50</uri>
			</author>
			<updated>2011-03-02T15:54:44Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=174#p174</id>
		</entry>
</feed>
