<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Fateh&#039;s Blog</title>
	<atom:link href="http://mymtd.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mymtd.wordpress.com</link>
	<description>GameDevelopement , Programming</description>
	<lastBuildDate>Fri, 16 Apr 2010 17:39:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mymtd.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Fateh&#039;s Blog</title>
		<link>http://mymtd.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mymtd.wordpress.com/osd.xml" title="Fateh&#039;s Blog" />
	<atom:link rel='hub' href='http://mymtd.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Started an OpenSource project &#8220;GFXMFF&#8221;</title>
		<link>http://mymtd.wordpress.com/2010/04/16/started-an-opensource-project-gfxmff/</link>
		<comments>http://mymtd.wordpress.com/2010/04/16/started-an-opensource-project-gfxmff/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 17:39:45 +0000</pubDate>
		<dc:creator>mtdfateh</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[File Format]]></category>
		<category><![CDATA[GFXMaker]]></category>
		<category><![CDATA[GFXMFF]]></category>
		<category><![CDATA[OpenSource]]></category>

		<guid isPermaLink="false">http://mymtd.wordpress.com/2010/04/16/started-an-opensource-project-gfxmff/</guid>
		<description><![CDATA[Today i decided to start an OpenSource Project “GFXMFF” wich stands for “GFXMaker File Format”, its a Game oriented file format exported by 3dsMax (Currently),it contains informations about a 3d scene : Materials,Meshs,Cameras,Lights,Animations( Key Framed,Sampled ),Skins / Bones. here’s the Git repository URL : git://codaset.com/fatehmtd/gfxmff.git &#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=87&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today i decided to start an OpenSource Project “GFXMFF” wich stands for “GFXMaker File Format”, its a Game oriented file format exported by 3dsMax (Currently),it contains informations about a 3d scene : Materials,Meshs,Cameras,Lights,Animations( Key Framed,Sampled ),Skins / Bones. here’s the Git repository URL : <a title="git://codaset.com/fatehmtd/gfxmff.git" href="//codaset.com/fatehmtd/gfxmff.git">git://codaset.com/fatehmtd/gfxmff.git</a></p>
<p>&#160;</p>
<p align="center"><a href="http://mymtd.files.wordpress.com/2010/04/gfxmff.png"><img style="display:inline;border-width:0;" title="GFXMFF" border="0" alt="GFXMFF" src="http://mymtd.files.wordpress.com/2010/04/gfxmff_thumb.png?w=667&#038;h=418" width="667" height="418" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mymtd.wordpress.com/87/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mymtd.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mymtd.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=87&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mymtd.wordpress.com/2010/04/16/started-an-opensource-project-gfxmff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/895fb81893e65787b9f715591deb6a1b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FATEHMTD</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2010/04/gfxmff_thumb.png" medium="image">
			<media:title type="html">GFXMFF</media:title>
		</media:content>
	</item>
		<item>
		<title>Parallax Occlusion Mapping in GFXMaker engine</title>
		<link>http://mymtd.wordpress.com/2010/02/27/parallax-occlusion-mapping-in-gfxmaker-engine/</link>
		<comments>http://mymtd.wordpress.com/2010/02/27/parallax-occlusion-mapping-in-gfxmaker-engine/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 03:25:00 +0000</pubDate>
		<dc:creator>mtdfateh</dc:creator>
				<category><![CDATA[My Works]]></category>
		<category><![CDATA[Parallax Occlusion Mapping ; POM ; GFXMaker]]></category>

		<guid isPermaLink="false">http://mymtd.wordpress.com/2010/02/27/parallax-occlusion-mapping-in-gfxmaker-engine/</guid>
		<description><![CDATA[I&#8217;ve been working on this effect for sometime now , here’s a video that demonstrates POM in GFXMaker &#160; here’s the HLSL code for this technique: &#160; &#160; //////////////////////////////////////////// struct MATERIAL {&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160; float4 Diffuse; &#160;&#160;&#160;&#160;&#160;&#160; float4 Ambient; &#160;&#160;&#160;&#160;&#160;&#160; float4 Specular; &#160;&#160;&#160;&#160;&#160;&#160; float4 Emissive; &#160;&#160;&#160;&#160;&#160;&#160; float&#160; Shininess; }; //////////////////////////////////////////// struct LIGHT { &#160;&#160;&#160; unsigned int&#160;&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=81&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on this effect for sometime now , here’s a video that demonstrates POM in GFXMaker</p>
<div style="display:inline;float:none;margin:0;padding:0;" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:3c382a1d-c02d-4c3c-bece-ded300bc371c" class="wlWriterEditableSmartContent">
<div><span style="text-align:center; display: block;"><a href="http://mymtd.wordpress.com/2010/02/27/parallax-occlusion-mapping-in-gfxmaker-engine/"><img src="http://img.youtube.com/vi/bji_oYtrsWI/2.jpg" alt="" /></a></span></div>
</div>
<p>&#160;</p>
<p>here’s the HLSL code for this technique:</p>
<p>&#160;</p>
<p>&#160;</p>
<p>////////////////////////////////////////////    <br />struct MATERIAL     <br />{&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 Diffuse;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 Ambient;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 Specular;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 Emissive;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float&#160; Shininess;     <br />};     <br />////////////////////////////////////////////     <br />struct LIGHT     <br />{     <br />&#160;&#160;&#160; unsigned int&#160;&#160;&#160; Type;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Type of light source */     <br />&#160;&#160;&#160; float4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Diffuse;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Diffuse color of light */     <br />&#160;&#160;&#160; float4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Specular;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Specular color of light */     <br />&#160;&#160;&#160; float4&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Ambient;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Ambient color of light */     <br />&#160;&#160;&#160; float3&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Position;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Position in world space */     <br />&#160;&#160;&#160; float3&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Direction;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Direction in world space */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Range;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Cutoff range */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Falloff;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Falloff */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Attenuation0;&#160;&#160;&#160;&#160; /* Constant attenuation */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Attenuation1;&#160;&#160;&#160;&#160; /* Linear attenuation */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Attenuation2;&#160;&#160;&#160;&#160; /* Quadratic attenuation */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Theta;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Inner angle of spotlight cone */     <br />&#160;&#160;&#160; float&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Phi;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Outer angle of spotlight cone */     <br />};     <br />//////////////////////////////////////////////////////////////////////////////////////// </p>
<p>MATERIAL Material;&#160; // The Current Material </p>
<p>bool&#160;&#160;&#160;&#160; HasColorMap ,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HasNormalMap,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HasSpecularMap,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HasHeightMap; </p>
<p>texture&#160; ColorMap,&#160; // Diffuse Map    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; NormalMap, // Normal Map , used for PerPixel Lighting     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SpecularMap,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; GlossMap,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; HeightMap; </p>
<p>sampler ColorMap_Sampler = sampler_state    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Texture = ColorMap;&#160;&#160;&#160; <br />}; </p>
<p>sampler SpecularMap_Sampler = sampler_state    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Texture = SpecularMap;     <br />}; </p>
<p>sampler NormalMap_Sampler = sampler_state    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Texture = NormalMap;     <br />}; </p>
<p>sampler GlossMap_Sampler = sampler_state    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Texture = GlossMap;     <br />}; </p>
<p>sampler HeightMap_Sampler = sampler_state    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Texture = HeightMap;     <br />}; </p>
<p>///////////////////////////////////////////////    <br />unsigned int&#160; MaxLights = 16,numLights = 0; </p>
<p>LIGHT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Lights[16];</p>
<p>&#160;</p>
<p>////////////////////////////////////////////////////////////////////////////////////////    <br />///////&#160; Shared Vars     <br />//////////////////////////////////////////////////////////////////////////////////////// </p>
<p>float4x4 matView ,    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; matProjection ,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; matWorld ,     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; matWorldInverseTranspose; </p>
<p>float3&#160;&#160; ViewerPosition,ViewerDirection; </p>
<p>float3&#160;&#160; MeshPivot = float3(0,0,0);&#160; // The current mesh&#8217;s Pivot/Origin</p>
<p>&#160;</p>
<p>&#160;</p>
<p>////////////////////////////////////////////////////////////////////////////////////////////////////////////////    <br />// Parallax Occlusion Mapping Rendering     <br />//////////////////////////////////////////////////////////////////////////////////////////////////////////////// </p>
<p>struct VS_POMR_OUT    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 Position&#160;&#160; : POSITION;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160; float2 UV&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; : TEXCOORD0;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 ViewDirTS&#160;&#160; : TEXCOORD1;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 LightDir&#160;&#160; : TEXCOORD2;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 NormalWS&#160;&#160; : TEXCOORD3;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 ViewDirWS&#160;&#160; : TEXCOORD4;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float2 ParallaxOffset : TEXCOORD5;     <br />}; </p>
<p>float&#160; HeightMapScale = 0.03f;    <br />int&#160;&#160;&#160; LODThreshold&#160;&#160; = 3;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // The mip level id for transitioning between the full computation     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // for parallax occlusion mapping and the bump mapping computation     <br />float ShadowSoftening = 0.12; </p>
<p>int&#160;&#160; MinimumSamples = 10 , MaximumSamples = 40; </p>
<p>VS_POMR_OUT Parallax_Ocllusion_Mapping_Rendering_VS_Main(VS_INPUT input)    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; VS_POMR_OUT output = (VS_POMR_OUT)0 ;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.Position = mul(input.Position,mul(mul(matWorld,matView),matProjection)); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3 NormalWS&#160;&#160; = (mul(input.Normal&#160; ,(float3x3)matWorld));    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3 TangentWS&#160; = (mul(input.Tangent ,(float3x3)matWorld));     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3 BinormalWS = (mul(input.Binormal,(float3x3)matWorld));     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.NormalWS&#160;&#160; = NormalWS; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; NormalWS&#160;&#160; = normalize(NormalWS);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; TangentWS&#160; = normalize(TangentWS);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; BinormalWS = normalize(BinormalWS); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3x3 TangentSpaceMatrix = (float3x3(TangentWS,BinormalWS,NormalWS)); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3 dir;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; switch(Lights[0].Type)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; case 3:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dir = Lights[0].Direction;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; default:     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; dir =&#160; Lights[0].Position &#8211; mul(input.Position,matWorld);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float3 eyedir = ViewerPosition &#8211; mul(input.Position,matWorld); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.UV&#160;&#160;&#160;&#160;&#160;&#160;&#160; = input.UV;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.LightDir&#160; = mul(TangentSpaceMatrix,dir); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.ViewDirWS = eyedir;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.ViewDirTS = mul(TangentSpaceMatrix,output.ViewDirWS); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 ParallaxDirection = normalize(output.ViewDirTS.xy);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float&#160; len&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; = length(output.ViewDirTS);     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float&#160; ParallaxLen&#160;&#160;&#160; = sqrt(len*len-output.ViewDirTS.z*output.ViewDirTS.z)/output.ViewDirTS.z; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.ParallaxOffset = ParallaxDirection * ParallaxLen;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; output.ParallaxOffset *= HeightMapScale; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return output;    <br />} </p>
<p>float4 ComputeIllumination(float3 LightDirTS,float2 TexCoord,float3 ViewDirTS)    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 Normal&#160;&#160; = normalize(tex2D(NormalMap_Sampler,TexCoord).xyz*2-1);     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 LightDir = normalize(LightDirTS ); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; float3 Reflection&#160;&#160;&#160; = normalize(-reflect(LightDir,Normal));    <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 totalSpecular = pow(max(0.0,saturate(dot(Reflection,ViewDirTS))),Material.Shininess) * Material.Specular * Lights[0].Specular;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 totalAmbient&#160; = Material.Ambient;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float4 totalDiffuse&#160; = Material.Diffuse * saturate(dot(LightDir,Normal)); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160; float4 final = saturate((totalAmbient + totalDiffuse)*tex2D(ColorMap_Sampler,TexCoord) + totalSpecular);&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160; return final;     <br />} </p>
<p>float4 Parallax_Ocllusion_Mapping_Rendering_PS_Main(VS_POMR_OUT input) : COLOR    <br />{     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 ViewDirWS = normalize(input.ViewDirWS);&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 NormalWS&#160; = normalize(input.NormalWS);     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 ViewDirTS = normalize(input.ViewDirTS);     <br />&#160;&#160;&#160;&#160;&#160;&#160; float2 Offset&#160;&#160;&#160; = input.ParallaxOffset;     <br />&#160;&#160;&#160;&#160;&#160;&#160; float3 NormalTS&#160;&#160; = normalize(tex2D(NormalMap_Sampler,input.UV).xyz*2-1);     <br />&#160;&#160;&#160;&#160;&#160;&#160; float OcclusionShadow = 1; </p>
<p>&#160;&#160;&#160;&#160;&#160; float2 fTexCoordsPerSize = input.UV * float2(256,256); </p>
<p>&#160;&#160;&#160;&#160;&#160; float2 dxSize, dySize;    <br />&#160;&#160;&#160;&#160;&#160; float2 dx, dy; </p>
<p>&#160;&#160;&#160;&#160;&#160; float4( dxSize, dx ) = ddx( float4( fTexCoordsPerSize, input.UV ) );    <br />&#160;&#160;&#160;&#160;&#160; float4( dySize, dy ) = ddy( float4( fTexCoordsPerSize, input.UV ) );     <br />&#160;&#160;&#160;&#160;&#160; float&#160; fMipLevel;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; float&#160; fMipLevelInt;     <br />&#160;&#160;&#160;&#160;&#160; float&#160; fMipLevelFrac; </p>
<p>&#160;&#160;&#160;&#160;&#160; float&#160; fMinTexCoordDelta;    <br />&#160;&#160;&#160;&#160;&#160; float2 dTexCoords; </p>
<p>&#160;&#160;&#160;&#160;&#160; dTexCoords = dxSize * dxSize + dySize * dySize; </p>
<p>&#160;&#160;&#160;&#160;&#160; fMinTexCoordDelta = max( dTexCoords.x, dTexCoords.y ); </p>
<p>&#160;&#160;&#160;&#160;&#160; fMipLevel = max( 0.5 * log2( fMinTexCoordDelta ), 0 );    <br />&#160;&#160;&#160;&#160;&#160; float2 texSample = input.UV;     <br />&#160;&#160;&#160;&#160;&#160; if(fMipLevel&lt;=(float)LODThreshold)     <br />&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int&#160;&#160;&#160; Samples&#160; = (int)lerp(MaximumSamples,MinimumSamples,saturate(dot(NormalWS,ViewDirWS)));     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float&#160; StepSize = 1.0/(float)Samples; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 OffsetStep&#160;&#160;&#160; = Offset * StepSize;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 CurrentOffset = input.UV;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float&#160; CurrentHeight = 0.0, LastHeight = 1.0;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float&#160; CurrentBound&#160; = 1.0, ParallaxAmount = 0.0; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 pt1 = 0, pt2 = 0; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; int&#160;&#160;&#160; CurrentSampleID = 0; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 texOffset2 = 0; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; while(CurrentSampleID&lt;Samples)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CurrentOffset -= OffsetStep;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CurrentBound&#160; -= StepSize;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CurrentHeight = tex2Dgrad(NormalMap_Sampler,CurrentOffset,dx,dy).a; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(CurrentHeight &gt; CurrentBound)    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pt1 = float2( CurrentBound, CurrentHeight );     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pt2 = float2( CurrentBound + StepSize, LastHeight ); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; texOffset2 = CurrentOffset &#8211; OffsetStep;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CurrentSampleID = Samples + 1;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CurrentSampleID ++;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; LastHeight = CurrentHeight;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float fDelta2 = pt2.x &#8211; pt2.y;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float fDelta1 = pt1.x &#8211; pt1.y; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float fDenominator = fDelta2 &#8211; fDelta1; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if ( fDenominator == 0.0f )    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ParallaxAmount = 0.0f;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ParallaxAmount = (pt1.x * fDelta2 &#8211; pt2.x * fDelta1 ) / fDenominator;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 ParallaxOffset = Offset * (1.0 &#8211; ParallaxAmount);    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 TextureSample = input.UV &#8211; ParallaxOffset;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; texSample = TextureSample;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(fMipLevel&gt;(float)(LODThreshold-1))     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; fMipLevelFrac = modf( fMipLevel, fMipLevelInt );     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; texSample = lerp( TextureSample,input.UV,fMipLevelFrac );     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float2 vLightRayTS = input.LightDir.xy * HeightMapScale; </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh0 =&#160; tex2Dgrad( NormalMap_Sampler, TextureSample, dx, dy ).a;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float shA = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.88, dx, dy ).a &#8211; sh0 &#8211; 0.88 ) *&#160; 1 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh9 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.77, dx, dy ).a &#8211; sh0 &#8211; 0.77 ) *&#160; 2 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh8 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.66, dx, dy ).a &#8211; sh0 &#8211; 0.66 ) *&#160; 4 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh7 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.55, dx, dy ).a &#8211; sh0 &#8211; 0.55 ) *&#160; 6 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh6 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.44, dx, dy ).a &#8211; sh0 &#8211; 0.44 ) *&#160; 8 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh5 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.33, dx, dy ).a &#8211; sh0 &#8211; 0.33 ) * 10 * ShadowSoftening;     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; float sh4 = (tex2Dgrad( NormalMap_Sampler, TextureSample + vLightRayTS * 0.22, dx, dy ).a &#8211; sh0 &#8211; 0.22 ) * 12 * ShadowSoftening;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; OcclusionShadow = 1 &#8211; max( max( max( max( max( max( shA, sh9 ), sh8 ), sh7 ), sh6 ), sh5 ), sh4 ); </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; OcclusionShadow = OcclusionShadow * 0.6 + 0.4;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160; } </p>
<p>&#160;&#160;&#160;&#160;&#160; float4 final = ComputeIllumination(input.LightDir,texSample,ViewDirTS)*OcclusionShadow;    <br />&#160;&#160;&#160;&#160;&#160; return final;     <br />} </p>
<p>technique ParallaxOcclusionMappingRendering    <br />{     <br />&#160;&#160;&#160;&#160; pass Pass0     <br />&#160;&#160;&#160;&#160; {     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; VertexShader = compile vs_3_0 Parallax_Ocllusion_Mapping_Rendering_VS_Main();     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; PixelShader&#160; = compile ps_3_0 Parallax_Ocllusion_Mapping_Rendering_PS_Main();     <br />&#160;&#160;&#160;&#160; }     <br />}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mymtd.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mymtd.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mymtd.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=81&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mymtd.wordpress.com/2010/02/27/parallax-occlusion-mapping-in-gfxmaker-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/895fb81893e65787b9f715591deb6a1b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FATEHMTD</media:title>
		</media:content>
	</item>
		<item>
		<title>My Previous Works</title>
		<link>http://mymtd.wordpress.com/2009/10/29/my-previous-works/</link>
		<comments>http://mymtd.wordpress.com/2009/10/29/my-previous-works/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 10:53:51 +0000</pubDate>
		<dc:creator>mtdfateh</dc:creator>
				<category><![CDATA[Previous Work]]></category>

		<guid isPermaLink="false">http://mymtd.wordpress.com/2009/10/29/my-previous-works/</guid>
		<description><![CDATA[here are some screenshots of some of my previous works using GFXMaker &#160;<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=46&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>here are some screenshots of some of my previous works using <strong>GFXMaker </strong></p>
<p><strong></strong></p>
<table border="0" cellspacing="0" cellpadding="0" width="400">
<tbody>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/tree_shadows.jpg"><img style="display:inline;border-width:0;" title="Tree_Shadows" border="0" alt="Tree_Shadows" src="http://mymtd.files.wordpress.com/2009/10/tree_shadows_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/space_journey2.jpg"><img style="display:inline;border-width:0;" title="space_journey2" border="0" alt="space_journey2" src="http://mymtd.files.wordpress.com/2009/10/space_journey2_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/space_journey3.jpg"><img style="display:inline;border-width:0;" title="space_journey3" border="0" alt="space_journey3" src="http://mymtd.files.wordpress.com/2009/10/space_journey3_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/snowshot.jpg"><img style="display:inline;border-width:0;" title="SNOWSHOT" border="0" alt="SNOWSHOT" src="http://mymtd.files.wordpress.com/2009/10/snowshot_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/snowshot0.jpg"><img style="display:inline;border-width:0;" title="SNOWSHOT0" border="0" alt="SNOWSHOT0" src="http://mymtd.files.wordpress.com/2009/10/snowshot0_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/sea.jpg"><img style="display:inline;border-width:0;" title="sea" border="0" alt="sea" src="http://mymtd.files.wordpress.com/2009/10/sea_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/seashot.jpg"><img style="display:inline;border-width:0;" title="SeaSHOT" border="0" alt="SeaSHOT" src="http://mymtd.files.wordpress.com/2009/10/seashot_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/fpsshot0.jpg"><img style="display:inline;border-width:0;" title="FPSSHOT0" border="0" alt="FPSSHOT0" src="http://mymtd.files.wordpress.com/2009/10/fpsshot0_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/fpsshot1.jpg"><img style="display:inline;border-width:0;" title="FPSSHOT1" border="0" alt="FPSSHOT1" src="http://mymtd.files.wordpress.com/2009/10/fpsshot1_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/fpsshot2.jpg"><img style="display:inline;border-width:0;" title="FPSSHOT2" border="0" alt="FPSSHOT2" src="http://mymtd.files.wordpress.com/2009/10/fpsshot2_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/fpsshot3.jpg"><img style="display:inline;border-width:0;" title="FPSSHOT3" border="0" alt="FPSSHOT3" src="http://mymtd.files.wordpress.com/2009/10/fpsshot3_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/fpsshot4.jpg"><img style="display:inline;border-width:0;" title="FPSSHOT4" border="0" alt="FPSSHOT4" src="http://mymtd.files.wordpress.com/2009/10/fpsshot4_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/clockshot.jpg"><img style="display:inline;border-width:0;" title="CLOCKSHOT" border="0" alt="CLOCKSHOT" src="http://mymtd.files.wordpress.com/2009/10/clockshot_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/clockshot1.jpg"><img style="display:inline;border-width:0;" title="CLOCKSHOT1" border="0" alt="CLOCKSHOT1" src="http://mymtd.files.wordpress.com/2009/10/clockshot1_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
</tr>
<tr>
<td valign="top" width="200">
<p align="justify"><a href="http://mymtd.files.wordpress.com/2009/10/clockshot2.jpg"><img style="display:inline;border-width:0;" title="CLOCKSHOT2" border="0" alt="CLOCKSHOT2" src="http://mymtd.files.wordpress.com/2009/10/clockshot2_thumb.jpg?w=244&#038;h=184" width="244" height="184" /></a></p>
</td>
<td valign="top" width="200">&#160;</td>
</tr>
</tbody>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mymtd.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mymtd.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mymtd.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=46&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mymtd.wordpress.com/2009/10/29/my-previous-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/895fb81893e65787b9f715591deb6a1b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FATEHMTD</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/tree_shadows_thumb.jpg" medium="image">
			<media:title type="html">Tree_Shadows</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/space_journey2_thumb.jpg" medium="image">
			<media:title type="html">space_journey2</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/space_journey3_thumb.jpg" medium="image">
			<media:title type="html">space_journey3</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/snowshot_thumb.jpg" medium="image">
			<media:title type="html">SNOWSHOT</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/snowshot0_thumb.jpg" medium="image">
			<media:title type="html">SNOWSHOT0</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/sea_thumb.jpg" medium="image">
			<media:title type="html">sea</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/seashot_thumb.jpg" medium="image">
			<media:title type="html">SeaSHOT</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/fpsshot0_thumb.jpg" medium="image">
			<media:title type="html">FPSSHOT0</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/fpsshot1_thumb.jpg" medium="image">
			<media:title type="html">FPSSHOT1</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/fpsshot2_thumb.jpg" medium="image">
			<media:title type="html">FPSSHOT2</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/fpsshot3_thumb.jpg" medium="image">
			<media:title type="html">FPSSHOT3</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/fpsshot4_thumb.jpg" medium="image">
			<media:title type="html">FPSSHOT4</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/clockshot_thumb.jpg" medium="image">
			<media:title type="html">CLOCKSHOT</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/clockshot1_thumb.jpg" medium="image">
			<media:title type="html">CLOCKSHOT1</media:title>
		</media:content>

		<media:content url="http://mymtd.files.wordpress.com/2009/10/clockshot2_thumb.jpg" medium="image">
			<media:title type="html">CLOCKSHOT2</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing a custom version of &#8220;printf&#8221; for C/C++</title>
		<link>http://mymtd.wordpress.com/2009/09/21/writing-a-custom-version-of-printf-for-cc/</link>
		<comments>http://mymtd.wordpress.com/2009/09/21/writing-a-custom-version-of-printf-for-cc/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:12:03 +0000</pubDate>
		<dc:creator>mtdfateh</dc:creator>
				<category><![CDATA[Programming / Tips & Tricks]]></category>
		<category><![CDATA[custom printf;C/C++;]]></category>

		<guid isPermaLink="false">http://mymtd.wordpress.com/2009/09/21/writing-a-custom-version-of-printf-for-cc/</guid>
		<description><![CDATA[you might ask &#8220;why would i write my own printf ???&#8221;,the answer is : custom error reporting, custom logs &#8230;, in my case i wrote for my Game Engine so i wont bother myself using sprintf &#38; then printing the result. lets get it started ! the secret behind &#8220;printf&#8221; is &#8220;vprintf&#8221; it works like [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=5&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">you might ask &#8220;why would i write my own printf ???&#8221;,the answer is : custom error reporting, custom logs &#8230;, in my case i wrote for my Game Engine so i wont bother myself using sprintf &amp; then printing the result.</p>
<p>lets get it started !</p>
<p>the secret behind &#8220;printf&#8221; is &#8220;vprintf&#8221; it works like &#8220;printf&#8221; but instead of requiring a &#8220;format&#8221; string &amp; some arguments , it requires a destination buffer( just like &#8220;sprintf&#8221; )  + a &#8220;format&#8221; string + an argument list wich is a &#8220;va_list&#8221; type ( typedef char * va_list) its just a char pointer.</p>
<p>here&#8217;s a piece of code:</p>
<p><span style="color:#008000;">#include &lt;stdargs.h&gt;<br />
#include &lt;stdio.h&gt;</span></p>
<p><span style="color:#008000;">// prototype function</span><br />
<span style="color:#3366ff;">void </span><span style="color:#ff0000;">InGamePrint</span>(<span style="color:#3366ff;">const char </span>* textToPrint); <span style="color:#008000;">// this could be your in game print function</span></p>
<p><span style="color:#3366ff;">void</span> <span style="color:#ff0000;">custum_print</span>(<span style="color:#3366ff;">const char</span>* Format,&#8230;)<br />
{<br />
<span style="color:#008000;">// the &#8220;&#8230;&#8221; indicates that this function accepts a variable number of arguments</span><br />
<span style="color:#3366ff;">char </span>Buffer[512]; // you can define your own buffer&#8217;s size<br />
<span style="color:#ff0000;">va_start</span>(args,Format);<br />
<span style="color:#ff0000;">vsprintf</span>(Buffer,Format,args);<br />
<span style="color:#ff0000;">va_end</span>(args);<br />
<span style="color:#008000;">// now everything is written on &#8220;Buffer&#8221; , so it is ready for use with &#8220;InGamePrint&#8221;</span></p>
<p><span style="color:#ff0000;">InGamePrint</span>(Buffer);  <span style="color:#008000;">// finaly print the text</span><br />
}</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mymtd.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mymtd.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mymtd.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mymtd.wordpress.com&amp;blog=6944229&amp;post=5&amp;subd=mymtd&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mymtd.wordpress.com/2009/09/21/writing-a-custom-version-of-printf-for-cc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/895fb81893e65787b9f715591deb6a1b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">FATEHMTD</media:title>
		</media:content>
	</item>
	</channel>
</rss>
