<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Simple GLSL Bump-Mapping / Normal-Mapping</title>
	<atom:link href="http://r3dux.org/2011/05/simple-glsl-bump-mapping-normal-mapping/feed/" rel="self" type="application/rss+xml" />
	<link>http://r3dux.org/2011/05/simple-glsl-bump-mapping-normal-mapping/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simple-glsl-bump-mapping-normal-mapping</link>
	<description>A number-pimping side project from the valleys in *NEW* upside-down flavour.</description>
	<lastBuildDate>Tue, 15 May 2012 23:01:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: r3dux</title>
		<link>http://r3dux.org/2011/05/simple-glsl-bump-mapping-normal-mapping/#comment-6873</link>
		<dc:creator>r3dux</dc:creator>
		<pubDate>Tue, 26 Jul 2011 04:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=4446#comment-6873</guid>
		<description>My shaders and source code probably don&#039;t work on your old ATI card because of the GLSL version - it&#039;s likely that your old ATI card doesn&#039;t support GLSL #330, but it will probably support #120 or #130 or #140 or whatever.

Give me the link to where you got the shaders you provided and I&#039;ll take a look and see what I can do.</description>
		<content:encoded><![CDATA[<p>My shaders and source code probably don&#8217;t work on your old ATI card because of the GLSL version &#8211; it&#8217;s likely that your old ATI card doesn&#8217;t support GLSL #330, but it will probably support #120 or #130 or #140 or whatever.</p>
<p>Give me the link to where you got the shaders you provided and I&#8217;ll take a look and see what I can do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shomari</title>
		<link>http://r3dux.org/2011/05/simple-glsl-bump-mapping-normal-mapping/#comment-6872</link>
		<dc:creator>shomari</dc:creator>
		<pubDate>Mon, 25 Jul 2011 22:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://r3dux.org/?p=4446#comment-6872</guid>
		<description>Hi your bump mapping shader does not work on my old ati card. I however have found one somebody wrote and it does work with one exception i get flashing textures. This greatly reduces the effect and does not look professional. Can you please take a look and make some minor modifications to the shader programs please. 

[fragment shader]
uniform sampler2D TexUnit;
uniform sampler2D BaseTexUnit;
uniform vec4 SurfaceColor;
uniform float AmbientFactor;
uniform float DiffuseFactor;
uniform float SpecularFactor;
uniform float Shininess;

varying vec3 LightDir;
varying vec3 ViewDir;

void main()
{
  vec3 normal = vec3(texture2D(TexUnit, gl_TexCoord[0].st));
  vec3 base = vec3(texture2D(BaseTexUnit, gl_TexCoord[0].st)); //shomari
  
  normal = vec3(2.0)*normal - vec3(1.0);
  normal = normalize(normal);
  vec3 light = normalize(LightDir);
  vec3 view = normalize(ViewDir);
  float diffuseCoeff = max(dot(light,normal),0.0);
  float specularCoeff = 0.0;
  if (diffuseCoeff &gt; 0.0) {
    vec3 reflectedLight = reflect(-light,normal);
    specularCoeff = pow(max(dot(view, reflectedLight),0.0), Shininess) ;
 }
  
  vec3 color = 
    vec3(DiffuseFactor*diffuseCoeff + AmbientFactor) * base +
    vec3(specularCoeff*SpecularFactor) ;

  color = min(color,vec3(1.0));
  gl_FragColor = vec4(color,1.0);
}



[vertex shader]
uniform vec4 LightPos;

attribute vec3 Tangent;  // align with s-coord of texture map

varying vec3 ViewDir;
varying vec3 LightDir;

const bool shaderTool =  true;  // using Apple&#039;s Shader Builder Tool?

void main() {
  vec3 eyeNormal = normalize(gl_NormalMatrix * gl_Normal);
  vec3 eyeTangent = gl_NormalMatrix * (shaderTool ? vec3(-1,0,0) : Tangent);
  vec3 eyeBinormal = normalize(cross(eyeNormal, eyeTangent));
  eyeTangent = cross(eyeBinormal, eyeNormal);
  vec4 eyeVertex = gl_ModelViewMatrix*gl_Vertex;
  vec3 eyeLightDir = normalize(vec3(LightPos - eyeVertex));
  LightDir.x = dot(eyeLightDir,eyeTangent);
  LightDir.y = dot(eyeLightDir,eyeBinormal);
  LightDir.z = dot(eyeLightDir,eyeNormal);
  vec3 eyeViewDir = normalize(-eyeVertex.xyz);
  ViewDir.x = dot(eyeViewDir,eyeTangent);
  ViewDir.y = dot(eyeViewDir,eyeBinormal);
  ViewDir.z = dot(eyeViewDir,eyeNormal);
  gl_TexCoord[0] = gl_MultiTexCoord0;
  gl_Position = ftransform();
}</description>
		<content:encoded><![CDATA[<p>Hi your bump mapping shader does not work on my old ati card. I however have found one somebody wrote and it does work with one exception i get flashing textures. This greatly reduces the effect and does not look professional. Can you please take a look and make some minor modifications to the shader programs please. </p>
<p>[fragment shader]<br />
uniform sampler2D TexUnit;<br />
uniform sampler2D BaseTexUnit;<br />
uniform vec4 SurfaceColor;<br />
uniform float AmbientFactor;<br />
uniform float DiffuseFactor;<br />
uniform float SpecularFactor;<br />
uniform float Shininess;</p>
<p>varying vec3 LightDir;<br />
varying vec3 ViewDir;</p>
<p>void main()<br />
{<br />
  vec3 normal = vec3(texture2D(TexUnit, gl_TexCoord[0].st));<br />
  vec3 base = vec3(texture2D(BaseTexUnit, gl_TexCoord[0].st)); //shomari</p>
<p>  normal = vec3(2.0)*normal &#8211; vec3(1.0);<br />
  normal = normalize(normal);<br />
  vec3 light = normalize(LightDir);<br />
  vec3 view = normalize(ViewDir);<br />
  float diffuseCoeff = max(dot(light,normal),0.0);<br />
  float specularCoeff = 0.0;<br />
  if (diffuseCoeff &gt; 0.0) {<br />
    vec3 reflectedLight = reflect(-light,normal);<br />
    specularCoeff = pow(max(dot(view, reflectedLight),0.0), Shininess) ;<br />
 }</p>
<p>  vec3 color =<br />
    vec3(DiffuseFactor*diffuseCoeff + AmbientFactor) * base +<br />
    vec3(specularCoeff*SpecularFactor) ;</p>
<p>  color = min(color,vec3(1.0));<br />
  gl_FragColor = vec4(color,1.0);<br />
}</p>
<p>[vertex shader]<br />
uniform vec4 LightPos;</p>
<p>attribute vec3 Tangent;  // align with s-coord of texture map</p>
<p>varying vec3 ViewDir;<br />
varying vec3 LightDir;</p>
<p>const bool shaderTool =  true;  // using Apple&#8217;s Shader Builder Tool?</p>
<p>void main() {<br />
  vec3 eyeNormal = normalize(gl_NormalMatrix * gl_Normal);<br />
  vec3 eyeTangent = gl_NormalMatrix * (shaderTool ? vec3(-1,0,0) : Tangent);<br />
  vec3 eyeBinormal = normalize(cross(eyeNormal, eyeTangent));<br />
  eyeTangent = cross(eyeBinormal, eyeNormal);<br />
  vec4 eyeVertex = gl_ModelViewMatrix*gl_Vertex;<br />
  vec3 eyeLightDir = normalize(vec3(LightPos &#8211; eyeVertex));<br />
  LightDir.x = dot(eyeLightDir,eyeTangent);<br />
  LightDir.y = dot(eyeLightDir,eyeBinormal);<br />
  LightDir.z = dot(eyeLightDir,eyeNormal);<br />
  vec3 eyeViewDir = normalize(-eyeVertex.xyz);<br />
  ViewDir.x = dot(eyeViewDir,eyeTangent);<br />
  ViewDir.y = dot(eyeViewDir,eyeBinormal);<br />
  ViewDir.z = dot(eyeViewDir,eyeNormal);<br />
  gl_TexCoord[0] = gl_MultiTexCoord0;<br />
  gl_Position = ftransform();<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

