<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Shaders question]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=169&amp;type=atom"/>
	<updated>2011-09-25T01:27:04Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=169</id>
		<entry>
			<title type="html"><![CDATA[Re: Shaders question]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=659#p659"/>
			<content type="html"><![CDATA[<p>Great to know they can be used <img src="http://forum.maratis3d.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p><p>About that doc, maybe i can find something on the net or its maratis-specific changes ?</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2011-09-25T01:27:04Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=659#p659</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Shaders question]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=658#p658"/>
			<content type="html"><![CDATA[<p>Hi, it looks interesting,<br />the software generate glsl shaders, so it&#039;s possible to adapt them,<br />there is just some difference that make them incompatible as-it :</p><p>The difference is mainly the use of the data (vertex, normal, uv...) and the matrices.</p><p>This software use fixed functions that are now deprecated and that Maratis doesn&#039;t use to be sure that the shaders will be compatible with openglES and future versions of openGL. I should make a doc about it.</p><p>Mesh data :</p><p>attribute vec3 Vertex;<br />attribute vec3 Normal;<br />attribute vec3 Tangent;<br />attribute vec3 Color;</p><p>Matrices :</p><p>- &quot;gl_ModelViewMatrix&quot; is replaced by &quot;ModelViewMatrix&quot; (declared on top with &quot;uniform mat4 ModelViewMatrix;&quot;)<br />- &quot;gl_NormalMatrix&quot; is replaced by &quot;NormalMatrix&quot; (declared on top with &quot;uniform mat4 NormalMatrix;&quot;)<br />- &quot;gl_ModelViewProjectionMatrix&quot; is replaced by &quot;ProjModelViewMatrix&quot;<br />etc</p><p>exemple :</p><div class="codebox"><pre><code>varying vec3  Normal;
varying vec3  EyeDir;
varying vec4  EyePos;
varying float LightIntensity;

uniform vec3  LightPos;

void main(void) 
{
    gl_Position    = ftransform();
    Normal         = normalize(gl_NormalMatrix * gl_Normal);
    vec4 pos       = gl_ModelViewMatrix * gl_Vertex;
    EyeDir         = pos.xyz;
    EyePos           = gl_ModelViewProjectionMatrix * gl_Vertex;
    LightIntensity = max(dot(normalize(LightPos - EyeDir), Normal), 0.0);
}</code></pre></div><p>Will be :</p><div class="codebox"><pre><code>varying vec3  Normal;
varying vec3  EyeDir;
varying vec4  EyePos;
varying float LightIntensity;

// Maratis Mesh data
attribute vec3 Vertex;
attribute vec3 Normal;

// Maratis standard matrices
uniform mat4 ModelViewMatrix;
uniform mat4 ProjModelViewMatrix;
uniform mat4 NormalMatrix;

// 4 nearest Maratis lights
uniform vec4 LightPosition[4];

void main(void) 
{
    gl_Position = ProjModelViewMatrix * vec4(Vertex, 1.0);
    Normal = normalize((NormalMatrix * vec4(Normal, 1.0)).xyz);
    vec4 pos = ModelViewMatrix * vec4(Vertex, 1.0);
    EyeDir = pos.xyz;
    EyePos = ProjModelViewMatrix * vec4(Vertex, 1.0);
    LightIntensity = max(dot(normalize(LightPosition[0] - EyeDir), Normal), 0.0);
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2011-09-24T10:00:21Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=658#p658</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Shaders question]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=656#p656"/>
			<content type="html"><![CDATA[<p>Hello !</p><p>Into another net-wandering session i found an old program who almost dissappeared from the face of the net :<br /><a href="http://mew.cx/glsl/shadergen/ShaderGen.jpg">http://mew.cx/glsl/shadergen/ShaderGen.jpg</a><br />Its main use was to generate vert and frag shaders easly, it does the job but for some reason when i try to use<br />them in maratis, the object is just invisible (standard renderer) or unaffected at all (fixed renderer)</p><p>From the same devs, another program named &quot;GLSL demo&quot; :<br /><span class="postimg"><img src="http://dl.dropbox.com/u/19970067/Questions/screenshot.1_1.png" alt="PunBB bbcode test" /></span><span class="postimg"><img src="http://dl.dropbox.com/u/19970067/Questions/screenshot.3_1.png" alt="PunBB bbcode test" /></span></p><p>There&#039;s alot of shaders in it, below, a glass shader and a toon-like shader, but its the same problem than ShaderGen, <br />object is invisble.</p><p>Here&#039;s the link of the &quot;site&quot; (The official site is dead and the compagny too, its a backup site maintained by someone)<br /><a href="http://mew.cx/glsl/">http://mew.cx/glsl/</a></p><p>And a sample of the shaders from GLSL demo program :<br />vert shader : <a href="http://dl.dropbox.com/u/19970067/Questions/Glass.vert">http://dl.dropbox.com/u/19970067/Questions/Glass.vert</a><br />frag shader : <a href="http://dl.dropbox.com/u/19970067/Questions/Glass.frag">http://dl.dropbox.com/u/19970067/Questions/Glass.frag</a></p><p>and a copy of the license, just in case : <a href="http://dl.dropbox.com/u/19970067/Questions/3Dlabs-license.txt">http://dl.dropbox.com/u/19970067/Questi &#133; icense.txt</a></p><p>Theres some amazing shaders in this, that would be awesome if they works in maratis, <br />but i dont know if its possible to adapt them ?</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2011-09-24T02:39:11Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=656#p656</id>
		</entry>
</feed>
