<?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: Depth Shadow maps</title>
	<atom:link href="http://www.flashbang.se/archives/87/feed" rel="self" type="application/rss+xml" />
	<link>http://www.flashbang.se/archives/87</link>
	<description>Exploring the lighter side of graphics</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:15:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Aviel</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-567</link>
		<dc:creator>Aviel</dc:creator>
		<pubDate>Fri, 03 Jun 2011 17:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-567</guid>
		<description>I have screwed around with it, and I only bug other people as a last resort. I probably screwed something up with the buffers, because I&#039;ve verified that my shader isn&#039;t the problem.</description>
		<content:encoded><![CDATA[<p>I have screwed around with it, and I only bug other people as a last resort. I probably screwed something up with the buffers, because I&#8217;ve verified that my shader isn&#8217;t the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Wallström</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-566</link>
		<dc:creator>Peter Wallström</dc:creator>
		<pubDate>Fri, 03 Jun 2011 14:10:22 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-566</guid>
		<description>There is no common reason for that, if it&#039;s done right it just works, if you did something wrong it should render something even though it&#039;s probably wrong, the only things i can think of is if your running openGL 3.x in forward compatible mode and the shader doesn&#039;t compile (and you have no error checking) it wouldn&#039;t render anything.
or if you happen to render something over the screen it might also go black.
Alternatively since it uses a fbo for the shadow map if you don&#039;t switch to the back buffer nothing will ever render.
So it&#039;s probably something you did wrong for some reason, try messing around with the code and comment out parts and see what happens.</description>
		<content:encoded><![CDATA[<p>There is no common reason for that, if it&#8217;s done right it just works, if you did something wrong it should render something even though it&#8217;s probably wrong, the only things i can think of is if your running openGL 3.x in forward compatible mode and the shader doesn&#8217;t compile (and you have no error checking) it wouldn&#8217;t render anything.<br />
or if you happen to render something over the screen it might also go black.<br />
Alternatively since it uses a fbo for the shadow map if you don&#8217;t switch to the back buffer nothing will ever render.<br />
So it&#8217;s probably something you did wrong for some reason, try messing around with the code and comment out parts and see what happens.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aviel</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-565</link>
		<dc:creator>Aviel</dc:creator>
		<pubDate>Fri, 03 Jun 2011 06:53:08 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-565</guid>
		<description>Is there any common reason why this code might just render blackness, or have I made a very specific and serious screwup?</description>
		<content:encoded><![CDATA[<p>Is there any common reason why this code might just render blackness, or have I made a very specific and serious screwup?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Wallström</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-47</link>
		<dc:creator>Peter Wallström</dc:creator>
		<pubDate>Mon, 16 Aug 2010 18:02:02 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-47</guid>
		<description>Your right, it should be 
pos= gl_ModelViewMatrix * gl_Vertex;

at certiain angles the difference is so small i didn&#039;t notice it, the reason it&#039;s there in the first place was because pos was originally used for something else.</description>
		<content:encoded><![CDATA[<p>Your right, it should be<br />
pos= gl_ModelViewMatrix * gl_Vertex;</p>
<p>at certiain angles the difference is so small i didn&#8217;t notice it, the reason it&#8217;s there in the first place was because pos was originally used for something else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ruxbin</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-46</link>
		<dc:creator>ruxbin</dc:creator>
		<pubDate>Mon, 16 Aug 2010 14:48:56 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-46</guid>
		<description>Hey,nice shadow map tutorial.
But one thing I&#039;m not quite sure is about the following code in vertex shader
&quot;pos= gl_ModelViewProjectionMatrix * gl_Vertex;&quot;
which I think should be pos=gl_ModelView * gl_Vertex. Because we are considering camera coordinates while multiplying with gl_ModelViewProjectionMatrix  will transform to the clip coordinates space.
And after changing the code, I do see difference :)
Is that right? Or U write that code 4 some specific reason?
Thx</description>
		<content:encoded><![CDATA[<p>Hey,nice shadow map tutorial.<br />
But one thing I&#8217;m not quite sure is about the following code in vertex shader<br />
&#8220;pos= gl_ModelViewProjectionMatrix * gl_Vertex;&#8221;<br />
which I think should be pos=gl_ModelView * gl_Vertex. Because we are considering camera coordinates while multiplying with gl_ModelViewProjectionMatrix  will transform to the clip coordinates space.<br />
And after changing the code, I do see difference :)<br />
Is that right? Or U write that code 4 some specific reason?<br />
Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Wallström</title>
		<link>http://www.flashbang.se/archives/87/comment-page-1#comment-13</link>
		<dc:creator>Peter Wallström</dc:creator>
		<pubDate>Tue, 04 May 2010 15:03:29 +0000</pubDate>
		<guid isPermaLink="false">http://tgb.flashbang.se/?p=87#comment-13</guid>
		<description>&lt;strong&gt;-old comments-&lt;/strong&gt;

&lt;strong&gt;Comment by mziskandar on 2007:02:21 15:43&lt;/strong&gt;
the tutorial im waiting for... great zeo!

&lt;strong&gt;Comment by mziskandar on 2007:02:21 19:26&lt;/strong&gt;
sadly, im receiving: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT error.

im using ati9600xt.

&lt;strong&gt;Comment by mziskandar on 2007:02:21 20:36&lt;/strong&gt;
just want to share with anybody who failed to compile using vs2005.

remove:
#include

add:
#include
using namespace std;

&lt;strong&gt;Comment by eXile on 2007:08:30 10:51&lt;/strong&gt;
Oh well ...

... I just got it running in my Ati 9600 Pro (fixed some errors, like mziskandar said).

&lt;strong&gt;Comment by eXile on 2007:08:30 11:15&lt;/strong&gt;
In glsl.frag REPLACE the three lines:
gl_TexCoord[2] = gl_TexCoord[2]/gl_TexCoord[2].w;

gl_TexCoord[2]=(gl_TexCoord[2]+ 1.0) * 0.5;

With:
vec4 texCoord2 = ((gl_TexCoord[2]/gl_TexCoord[2].w) + 1.0) * 0.5;

---

In glsl.frag REPLACE the line:
vec4 shadow = texture2D(texunit2,gl_TexCoord[2].xy);

With:
vec4 shadow = texture2D(texunit2,texCoord2.xy);

---

In glsl.frag REPLACE the line:
if((shadow.z+0.005) &lt; gl_TexCoord[2].z)

With:
if((shadow.z+0.005) &lt; texCoord2.z)

---

In glsl.frag REPLACE the three lines:

float fresnel =max((norm.z-0.6)*-1.0,0);

float diffuse = max(dot(lightVec, norm),0);

With:
float fresnel =max((norm.z-0.6)*-1.0,0.0);

float diffuse = max(dot(lightVec, norm),0.0);

---

In ZeoTut03a.cpp REPLACE the line:
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL );

With:
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL );

---

And recompile :-) If you are using Visual Studio 2005, you have to replace all &quot;#include fstream.h&quot; with &quot;#include fstream&quot; + an &quot;using namespace

std;&quot;. If you never compiled an OpenGL-application before, you also need to download the glext.h from

&lt;a href=&quot;http://oss.sgi.com/projects/ogl-sample/ABI/glext.h&quot; rel=&quot;nofollow&quot;&gt;http://oss.sgi.com/projects/ogl-sample/ABI/glext.h and place it into your Visual Studio 2005 installation path into .../VC/PlatformSDK/Include/gl.

Tested twice and working with above changes on a Ati 9600 Pro.

&lt;strong&gt;Comment by vinnythepoo on 2009:05:16 18:58&lt;/strong&gt;
Thanks for your tutorials,
i have noticed that in your shadow mapping you declare the bias matrix, but you don&#039;t use, and also you don&#039;t invert anymore the camera, why ?

&lt;strong&gt;Comment by vinnythepoo on 2009:05:16 20:59&lt;/strong&gt;
Forgot another thing, looks like that the instructions

glMatrixMode(GL_TEXTURE);
glLoadMatrixf(textureMatrix);

Completely corrupt the pipeline once the function ends, i see because i have an fps counter and it is not shown

&lt;strong&gt;Comment by Overlord on 2009:05:16 23:30&lt;/strong&gt;
The bias matrix was previously used but i later put that in the shader, the downloadable code as an older version that i just didn&#039;t update so the code on this page is the correct one, i will probably do a full update once i have time, i am working on like 6 different projects right now all with a close deadline, but once it&#039;s done i think you will like it.

regarding glMatrixMode(GL_TEXTURE);, yea that might happen, just reset it with
glMatrixMode(GL_TEXTURE);
glLoadIdentity ();
I used the texture matrix because it&#039;s convenient and easy to understand, in a production environment i would probably send a uniform to the shaders, it&#039;s also something your required to do in 3.1.
&lt;strong&gt;
Comment by vinnythepoo on 2009:05:17 07:41&lt;/strong&gt;
I tried to reset the texture matrix but i get blank screen if i reset it, even after the end of the rendering function.
How can i solve this ? looks like the texture matrix is corrupted after being used

&lt;strong&gt;Comment by wallifin@hotmail.com on 2010:04:23 10:10&lt;/strong&gt;
hi vinnythepoo,
try to change this lines
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(cameraProjectionMatrix);

glMatrixMode(GL_TEXTURE);
glLoadMatrixf(textureMatrix);

glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(cameraViewMatrix);
with:
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(cameraProjectionMatrix);

glMatrixMode(GL_TEXTURE);
glPushMatrix();
glLoadMatrixf(textureMatrix);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadMatrixf(cameraViewMatrix);

and at the end of rendering add this line:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glPopMatrix();

glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glPopMatrix();

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPopMatrix();
glFlush ();

for any questions send me a mail
reguards
walter :)
exsuse me for my bad english :(</description>
		<content:encoded><![CDATA[<p><strong>-old comments-</strong></p>
<p><strong>Comment by mziskandar on 2007:02:21 15:43</strong><br />
the tutorial im waiting for&#8230; great zeo!</p>
<p><strong>Comment by mziskandar on 2007:02:21 19:26</strong><br />
sadly, im receiving: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT error.</p>
<p>im using ati9600xt.</p>
<p><strong>Comment by mziskandar on 2007:02:21 20:36</strong><br />
just want to share with anybody who failed to compile using vs2005.</p>
<p>remove:<br />
#include</p>
<p>add:<br />
#include<br />
using namespace std;</p>
<p><strong>Comment by eXile on 2007:08:30 10:51</strong><br />
Oh well &#8230;</p>
<p>&#8230; I just got it running in my Ati 9600 Pro (fixed some errors, like mziskandar said).</p>
<p><strong>Comment by eXile on 2007:08:30 11:15</strong><br />
In glsl.frag REPLACE the three lines:<br />
gl_TexCoord[2] = gl_TexCoord[2]/gl_TexCoord[2].w;</p>
<p>gl_TexCoord[2]=(gl_TexCoord[2]+ 1.0) * 0.5;</p>
<p>With:<br />
vec4 texCoord2 = ((gl_TexCoord[2]/gl_TexCoord[2].w) + 1.0) * 0.5;</p>
<p>&#8212;</p>
<p>In glsl.frag REPLACE the line:<br />
vec4 shadow = texture2D(texunit2,gl_TexCoord[2].xy);</p>
<p>With:<br />
vec4 shadow = texture2D(texunit2,texCoord2.xy);</p>
<p>&#8212;</p>
<p>In glsl.frag REPLACE the line:<br />
if((shadow.z+0.005) < gl_TexCoord[2].z)</p>
<p>With:<br />
if((shadow.z+0.005) < texCoord2.z)</p>
<p>---</p>
<p>In glsl.frag REPLACE the three lines:</p>
<p>float fresnel =max((norm.z-0.6)*-1.0,0);</p>
<p>float diffuse = max(dot(lightVec, norm),0);</p>
<p>With:<br />
float fresnel =max((norm.z-0.6)*-1.0,0.0);</p>
<p>float diffuse = max(dot(lightVec, norm),0.0);</p>
<p>---</p>
<p>In ZeoTut03a.cpp REPLACE the line:<br />
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL );</p>
<p>With:<br />
glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 2048, 2048, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL );</p>
<p>---</p>
<p>And recompile :-) If you are using Visual Studio 2005, you have to replace all "#include fstream.h" with "#include fstream" + an "using namespace</p>
<p>std;". If you never compiled an OpenGL-application before, you also need to download the glext.h from</p>
<p><a href="http://oss.sgi.com/projects/ogl-sample/ABI/glext.h" rel="nofollow"><a href="http://oss.sgi.com/projects/ogl-sample/ABI/glext.h" rel="nofollow">http://oss.sgi.com/projects/ogl-sample/ABI/glext.h</a> and place it into your Visual Studio 2005 installation path into &#8230;/VC/PlatformSDK/Include/gl.</p>
<p>Tested twice and working with above changes on a Ati 9600 Pro.</p>
<p><strong>Comment by vinnythepoo on 2009:05:16 18:58</strong><br />
Thanks for your tutorials,<br />
i have noticed that in your shadow mapping you declare the bias matrix, but you don&#8217;t use, and also you don&#8217;t invert anymore the camera, why ?</p>
<p><strong>Comment by vinnythepoo on 2009:05:16 20:59</strong><br />
Forgot another thing, looks like that the instructions</p>
<p>glMatrixMode(GL_TEXTURE);<br />
glLoadMatrixf(textureMatrix);</p>
<p>Completely corrupt the pipeline once the function ends, i see because i have an fps counter and it is not shown</p>
<p><strong>Comment by Overlord on 2009:05:16 23:30</strong><br />
The bias matrix was previously used but i later put that in the shader, the downloadable code as an older version that i just didn&#8217;t update so the code on this page is the correct one, i will probably do a full update once i have time, i am working on like 6 different projects right now all with a close deadline, but once it&#8217;s done i think you will like it.</p>
<p>regarding glMatrixMode(GL_TEXTURE);, yea that might happen, just reset it with<br />
glMatrixMode(GL_TEXTURE);<br />
glLoadIdentity ();<br />
I used the texture matrix because it&#8217;s convenient and easy to understand, in a production environment i would probably send a uniform to the shaders, it&#8217;s also something your required to do in 3.1.<br />
<strong><br />
Comment by vinnythepoo on 2009:05:17 07:41</strong><br />
I tried to reset the texture matrix but i get blank screen if i reset it, even after the end of the rendering function.<br />
How can i solve this ? looks like the texture matrix is corrupted after being used</p>
<p><strong>Comment by <a href="mailto:wallifin@hotmail.com">wallifin@hotmail.com</a> on 2010:04:23 10:10</strong><br />
hi vinnythepoo,<br />
try to change this lines<br />
glMatrixMode(GL_PROJECTION);<br />
glLoadMatrixf(cameraProjectionMatrix);</p>
<p>glMatrixMode(GL_TEXTURE);<br />
glLoadMatrixf(textureMatrix);</p>
<p>glMatrixMode(GL_MODELVIEW);<br />
glLoadMatrixf(cameraViewMatrix);<br />
with:<br />
glMatrixMode(GL_PROJECTION);<br />
glPushMatrix();<br />
glLoadMatrixf(cameraProjectionMatrix);</p>
<p>glMatrixMode(GL_TEXTURE);<br />
glPushMatrix();<br />
glLoadMatrixf(textureMatrix);</p>
<p>glMatrixMode(GL_MODELVIEW);<br />
glPushMatrix();<br />
glLoadMatrixf(cameraViewMatrix);</p>
<p>and at the end of rendering add this line:<br />
glMatrixMode(GL_PROJECTION);<br />
glLoadIdentity();<br />
glPopMatrix();</p>
<p>glMatrixMode(GL_TEXTURE);<br />
glLoadIdentity();<br />
glPopMatrix();</p>
<p>glMatrixMode(GL_MODELVIEW);<br />
glLoadIdentity();<br />
glPopMatrix();<br />
glFlush ();</p>
<p>for any questions send me a mail<br />
reguards<br />
walter :)<br />
exsuse me for my bad english :(</p>
]]></content:encoded>
	</item>
</channel>
</rss>

