<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6217008513945652449</id><updated>2012-02-12T03:55:04.752+01:00</updated><category term='deferred rendering'/><category term='post-projection space'/><category term='position reconstruction'/><category term='camera-space'/><category term='depth'/><category term='Programming'/><category term='view-space'/><title type='text'>BFP's Forging Notes</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>37</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-8790324335955999619</id><published>2012-01-17T14:36:00.005+01:00</published><updated>2012-01-20T12:12:07.496+01:00</updated><title type='text'>Is software engineering compatible with making games?</title><content type='html'>&lt;div&gt;&lt;div&gt;This is one of the hundred of questions that I ask myself many times.&lt;/div&gt;&lt;div&gt;After some mumbling and experience, I came to the understanding that what's really misleading is the equality software engineering == O.O.P. == design patterns.&lt;/div&gt;&lt;div&gt;This is what it appears when reading forums and speaking with peoples around.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;That's wrong. Completely wrong.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;First of all: &lt;em&gt;software engineering is&lt;strong&gt; NOT &lt;/strong&gt;Object Oriented Programming.&lt;/em&gt;&lt;/div&gt;&lt;div&gt;Software engineering is a tool to find solutions to problems.&lt;br /&gt;Object Oriented Programming is one way of solving the problem, but it is another tool.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Second: &lt;em&gt;Object Oriented Programming is &lt;strong&gt;NOT &lt;/strong&gt;design patterns.&lt;/em&gt;&lt;/div&gt;&lt;div&gt;The real trouble here is that people is lazy and many times not focused / precise enough to describe the problem.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;A &lt;strong&gt;PATTERN &lt;/strong&gt;is a &lt;strong&gt;SOLUTION &lt;/strong&gt;to a known &lt;strong&gt;PROBLEM.&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;So, what's a problem?&lt;/div&gt;&lt;div&gt;The word problem cames from greek, and means &lt;em&gt;"What cames BEFORE a project".&lt;/em&gt;&lt;/div&gt;&lt;div&gt;The real error here is the definition of the problem.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;strong&gt;DEFINING A BAD PROBLEM WILL LEAD TO BAD SOLUTIONS.&lt;/strong&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;That can be sound silly or foggy, but really is a common error I see around (and also in myself).&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;So going back to the equality, patterns are solutions to problem.&lt;br /&gt;Our mind, that always needs to categorize and label stuff to organize data, works with associations: when we find something similar to what we already know, under a certain percentage of similarity, we assume that is equal.&lt;/div&gt;&lt;div&gt;This is normal and common: you know the experiment that if we read words with only the initial&lt;/div&gt;&lt;div&gt;and fnail wrdos we can understand them the same.&lt;/div&gt;&lt;div&gt;We already (normally) encounter that word, so we can understand which one is.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Using patterns is not the only way of using OOP: they are completely different domains.&lt;/div&gt;&lt;div&gt;Software engineering is an analysis and design mindset.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;What we're really missing is to &lt;strong&gt;DESCRIBE CORRECTLY PROBLEMS&lt;/strong&gt;.&lt;/div&gt;&lt;div&gt;Also, we have not so many patterns that are usable for the gaming industry.&lt;/div&gt;&lt;div&gt;That's for two reasons.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;1) There are not so many software engineers/architect that have enough time to study and design a so large software like a game and an engine, with the production constraints we have.&lt;/div&gt;&lt;div&gt;2) Believing in this inequality, a lot of peoples believes that software engineering is not for realtime applications.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;But that's hope.&lt;/div&gt;&lt;div&gt;Even in a strange way, some new patterns/way of programming is coming out.&lt;/div&gt;&lt;div&gt;&lt;strong&gt;Data Oriented Programming&lt;/strong&gt; they say.&lt;/div&gt;&lt;div&gt;There are no explicit patterns, written in an academic way, but there are patterns.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;In that case, what happened is &lt;em&gt;describing the problem in a correct way.&lt;/em&gt;&lt;/div&gt;&lt;div&gt;For example, in a lot of patterns there is no mention of hardware constraints or performances.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Data oriented programming thus is becoming a new way of coding: coding thinking about &lt;strong&gt;data &lt;/strong&gt;and performances.&lt;/div&gt;&lt;div&gt;But data oriented does not exclude object oriented.&lt;/div&gt;&lt;div&gt;They can co-exist!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;We must be open-minded: still we need to go one level up, thus being independent of Object or Data oriented paradigms.&lt;/div&gt;&lt;div&gt;We must focus on each problems, and why they're there.&lt;/div&gt;&lt;div&gt;Object oriented programming is born to solve the problem of creating high-maintainable code used by different persons during a long time-span.&lt;/div&gt;&lt;div&gt;Data oriented programming is born to solve the performances issues and platform bindings that&lt;/div&gt;&lt;div&gt;object oriented was leaving behind.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Each problem its own solution.&lt;/div&gt;&lt;div&gt;Need 1000 calls per frame on consoles? Data oriented, cache friendly, multithreaded and no virtuals are the keyword.&lt;/div&gt;&lt;div&gt;Need 1-10 calls per frame? Object oriented is good.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;Looking from this angle, the two paradigm CAN and MUST co-exist, because they're not strict and they're really a way of dealing a certain class of problems.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-8790324335955999619?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/8790324335955999619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=8790324335955999619' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8790324335955999619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8790324335955999619'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2012/01/is-software-engineering-compatible-with.html' title='Is software engineering compatible with making games?'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-123980208675165660</id><published>2012-01-09T18:34:00.008+01:00</published><updated>2012-01-10T22:43:17.552+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='deferred rendering'/><category scheme='http://www.blogger.com/atom/ns#' term='depth'/><category scheme='http://www.blogger.com/atom/ns#' term='position reconstruction'/><category scheme='http://www.blogger.com/atom/ns#' term='view-space'/><category scheme='http://www.blogger.com/atom/ns#' term='post-projection space'/><category scheme='http://www.blogger.com/atom/ns#' term='camera-space'/><title type='text'>Position reconstruction from depth (3)</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;Hi guys,&lt;/div&gt;&lt;div&gt;   just wanted to share the code I've used to study the position reconstruction problem.&lt;/div&gt;&lt;div&gt;This code lets you switch easly between linear depth and post-projection depth, and I'll show also a way to check if the reconstruction is correct.&lt;/div&gt;&lt;div&gt;Following is the code to convert between &lt;strong&gt;Camera/View space &lt;/strong&gt;to &lt;strong&gt;PostProjection space &lt;/strong&gt;and viceversa.&lt;/div&gt;&lt;div&gt; &lt;code&gt;&lt;br /&gt;&lt;br /&gt;// This must be done on the CPU and passed to shaders:&lt;br /&gt;float2 getProjParams()&lt;br /&gt;{&lt;br /&gt; //#define PROJ_STANDARD&lt;br /&gt; #ifdef PROJ_STANDARD&lt;br /&gt; float rangeInv = 1 / (gFar - gNear);&lt;br /&gt; float A = -(gFar + gNear) * rangeInv;&lt;br /&gt; float B = -2 * gFar * gNear * rangeInv;&lt;br /&gt; #else // We get rid of the minus by just inverting the denominator (faster):&lt;br /&gt; float rangeInv = 1 / (gNear - gFar);&lt;br /&gt; float A = (gFar + gNear) * rangeInv;&lt;br /&gt; float B = 2 * gFar * gNear * rangeInv;&lt;br /&gt; #endif&lt;br /&gt;&lt;br /&gt; return float2(A, B);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Input: 0..-far - Output: -1..1&lt;br /&gt;float postDepthFromViewDepth( float depthVS )&lt;br /&gt;{&lt;br /&gt; float2 projParams = getProjParams();&lt;br /&gt;&lt;br /&gt;   // Zn = (A * Ze + B) / -Ze&lt;br /&gt;   // Zn = -A - (B/Ze)&lt;br /&gt;   float depthPS = -projParams.x - (projParams.y / depthVS);&lt;br /&gt;&lt;br /&gt; return depthPS;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Input: -1..1 - Output: 0..-far&lt;br /&gt;float viewDepthFromPostDepth( float depthPS )&lt;br /&gt;{&lt;br /&gt;float2 projParams = getProjParams();&lt;br /&gt;&lt;br /&gt;   // Ze = -B / (Zn + A)&lt;br /&gt; float depthVS = -projParams.y / (projParams.x + depthPS);&lt;br /&gt; &lt;br /&gt; return depthVS;&lt;br /&gt;} &lt;/code&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Next I'll show some helper functions to encode/decode the depth in different spaces.&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;///////////////////////////////////////////////////&lt;br /&gt;// POST PROJECTION SPACE&lt;br /&gt;///////////////////////////////////////////////////&lt;br /&gt;&lt;br /&gt;// Returns post-projection depth&lt;br /&gt;float decodeProjDepth( float2 uv )&lt;br /&gt;{&lt;br /&gt; return tex2D( depthMap, uv ).r;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Returns viewspace depth from projection (negative for left-handed)&lt;br /&gt;float decodeViewDepthFromProjection( float2 uv )&lt;br /&gt;{&lt;br /&gt; float depthPS = decodeProjDepth( uv );&lt;br /&gt; return viewDepthFromPostDepth( depthPS );;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Returns depth in range 0..1&lt;br /&gt;float decodeLinearDepthFromProjection( float2 uv )&lt;br /&gt;{&lt;br /&gt;   float depthVS = decodeViewDepthFromProjection( uv );&lt;br /&gt;   // Left handed coords needs the minus,&lt;br /&gt;   // because the depth is negative&lt;br /&gt;   // and we are converting towards 0..1 domain&lt;br /&gt;   return -depthVS / gFar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Returns post-projection depth&lt;br /&gt;float encodePostProjectionDepth( float depthViewSpace )&lt;br /&gt;{&lt;br /&gt; return postDepthFromViewDepth( depthViewSpace );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;///////////////////////////////////////////////////&lt;br /&gt;// VIEW/CAMERA SPACE&lt;br /&gt;///////////////////////////////////////////////////&lt;br /&gt;&lt;br /&gt;// Returns stored linear depth (0..1)&lt;br /&gt;float decodeLinearDepthRaw( float2 uv )&lt;br /&gt;{ &lt;br /&gt; return tex2D( depthMap, uv ).r;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Returns viewspace depth (0..-far)&lt;br /&gt;float decodeViewDepthFromLinear( float2 uv )&lt;br /&gt;{&lt;br /&gt; return decodeLinearDepthRaw( uv ) * -gFar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Returns linear depth from left-handed viewspace depth (0..-far)&lt;br /&gt;float encodeDepthLinear( float depthViewSpace )&lt;br /&gt;{&lt;br /&gt; return -depthViewSpace / gFar;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt; With simple defines we can control and switch between using a linear depth or a post-projection (raw) depth buffer to check that our calculations are fine:&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#ifdef DEPTH_LINEAR&lt;br /&gt;#define encodeDepth encodeDepthLinear&lt;br /&gt;#define decodeViewDepth decodeViewDepthFromLinear&lt;br /&gt;#define decodeLinearDepth decodeLinearDepthRaw&lt;br /&gt;#else&lt;br /&gt;#define encodeDepth encodePostProjectionDepth&lt;br /&gt;#define decodeViewDepth decodeViewDepthFromProjection&lt;br /&gt;#define decodeLinearDepth decodeLinearDepthFromProjection&lt;br /&gt;#endif&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;div&gt; Now all the reconstruction methods, both the slow and the one that uses rays:&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;// View-space position&lt;br /&gt;float3 getPositionVS( float2 uv )&lt;br /&gt;{&lt;br /&gt;   float depthVS = decodeLinearDepth(uv);&lt;br /&gt; &lt;br /&gt; //float4 positionPS = float4((uv.x-0.5) * 2, (0.5-uv.y) * 2, 1, 1);&lt;br /&gt; float4 positionPS = float4( (uv - 0.5) * float2(2, -2), 1, 1 );&lt;br /&gt; float4 ray = mul( gProjI, positionPS );&lt;br /&gt;   ray.xyz /= ray.w;&lt;br /&gt; return ray.xyz * depthVS * gFar;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;float3 getPositionVS( float2 uv, float3 ray )&lt;br /&gt;{&lt;br /&gt; float depthLin = decodeLinearDepth(uv);&lt;br /&gt;&lt;br /&gt; return ray.xyz * depthLin;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;float3 getPositionWS( float2 uv )&lt;br /&gt;{&lt;br /&gt; float3 positionVS = getPositionVS( uv );&lt;br /&gt; float4 positionWS = mul( gViewI, float4(positionVS, 1) );&lt;br /&gt; return positionWS.xyz;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;float3 getPositionWS( float2 uv, float3 viewDirectionWS )&lt;br /&gt;{&lt;br /&gt; float depthVS = decodeViewDepth(uv);&lt;br /&gt;#if defined(METHOD1)&lt;br /&gt;   // Super-slow method ( 2 matrix-matrix mul )&lt;br /&gt;   float4 pps = mul( gProj, float4(getPositionVS( uv ), 1) );&lt;br /&gt; float4 positionWS = mul( gViewProjI, pps );&lt;br /&gt; positionWS /= positionWS.w;&lt;br /&gt; &lt;br /&gt; return positionWS.xyz;&lt;br /&gt;#elif defined(METHOD2)&lt;br /&gt; &lt;br /&gt;   // Known working slow method&lt;br /&gt; float3 positionWS = getPositionWS( uv );&lt;br /&gt;#else return positionWS .xyz;&lt;br /&gt; &lt;br /&gt;   // Super fast method&lt;br /&gt; viewDirectionWS = normalize(viewDirectionWS.xyz);&lt;br /&gt;&lt;br /&gt;   float3 zAxis = gView._31_32_33;&lt;br /&gt;   float zScale = dot( zAxis, viewDirectionWS );&lt;br /&gt;   float3 positionWS = getCameraPosition() + viewDirectionWS * depthVS / zScale;&lt;br /&gt;&lt;br /&gt; return positionWS;&lt;br /&gt;   #endif // METHOD1,2,3&lt;br /&gt;} &lt;/code&gt;&lt;br /&gt;&lt;div&gt; Last but not least, I'll show you the code to encode the depth and perform a simple calculation to understand if we've done right:&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;// This is only with an educational purpose,&lt;br /&gt;// so that we can switch towards storing&lt;br /&gt;// viewspace or postprojection depth.&lt;br /&gt;// In the GBuffer creation, the depth stored like this:&lt;br /&gt;&lt;br /&gt;depth = float4( encodeDepth(IN.positionViewSpace.z), 1, 1, 1);&lt;br /&gt;&lt;br /&gt;// A very cheap and easy way to detect if&lt;br /&gt;// we've worked correctly is to add a&lt;br /&gt;// point-light and light a bit more&lt;br /&gt;// the rendering with something like:&lt;br /&gt;&lt;br /&gt;#ifdef POSITION_RECONSTRUCTION_VIEWSPACE&lt;br /&gt; float4 lightPos = mul( gView, float4(100.0, 0.0, 0.0, 1.0) );&lt;br /&gt; float3 pixelPos = getPositionVS( uv, viewDirVS );&lt;br /&gt; #else&lt;br /&gt; float4 lightPos = float4(100.0, 0.0, 0.0, 1.0);&lt;br /&gt; float3 pixelPos = getPositionWS( uv, viewDirWS );&lt;br /&gt;   #endif&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;Note the different rays, viewDirVS and viewDirWS. They are calculated as MJP showed a lot of time and two different ways, one for meshes and the other for fullscreen quads. &lt;/div&gt;&lt;div&gt;I think that's all for now, I'll attach a screenshot of the simple test I've used to test the reconstruciton. Note that the light is the same in all the conditions, view/world space reconstruction, linear/postprojection depth storage.&lt;/div&gt;&lt;div&gt;Enjoy!!!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;img style="margin: 0px auto 10px; width: 400px; height: 248px; text-align: center; display: block; cursor: pointer;" id="BLOGGER_PHOTO_ID_5695980626121157282" border="0" alt="" src="http://3.bp.blogspot.com/-CemMPW01wd0/TwwwM2t1aqI/AAAAAAAAAJI/VwHc4zXIV6s/s400/SponzaPointlight01.jpg" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-123980208675165660?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/123980208675165660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=123980208675165660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/123980208675165660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/123980208675165660'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2012/01/position-reconstruction-from-depth-3.html' title='Position reconstruction from depth (3)'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-CemMPW01wd0/TwwwM2t1aqI/AAAAAAAAAJI/VwHc4zXIV6s/s72-c/SponzaPointlight01.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-7741762741709059500</id><published>2012-01-09T17:47:00.008+01:00</published><updated>2012-01-09T21:16:58.729+01:00</updated><title type='text'>Position reconstruction from depth (2)</title><content type='html'>Happy new year guys!&lt;br /&gt;  I want to finish my summary for position reconstruction.&lt;br /&gt;The missing part is the position, that can be in &lt;strong&gt;ViewSpace &lt;/strong&gt;(or CameraSpace) and in &lt;strong&gt;WorldSpace&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;So far we know the relationship between &lt;strong&gt;Post-Perspective &lt;/strong&gt;and &lt;strong&gt;ViewSpace &lt;/strong&gt;depth of the fragment. If not, roll back the &lt;a href="http://badfoolprototype.blogspot.com/2011/11/position-reconstruction-from-depth-1.html"&gt;previous post&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The methods are taken directly from the amazing MJP, kudos to his works!&lt;br /&gt;My target is again left-handed coordinate system like OpenGL, that needs some more attention&lt;br /&gt;(really a minus sign in the correct place make a HUGE difference!).&lt;br /&gt;&lt;br /&gt;The methods I'm using are the one that pass down a ray to the fragment shader.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;VIEWSPACE POSITION&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Ray Generation&lt;/strong&gt;&lt;br /&gt;For a fullscreen quad we take the ClipSpace position and multiply by the inverse of the projection matrix to obtain a ray in ViewSpace.&lt;br /&gt;&lt;br /&gt;float4 ray = mul( gProjectionInverse, positionCS );&lt;br /&gt;ray /= ray.w;&lt;br /&gt;OUT.viewRayVS = ray;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Position reconstruction&lt;/strong&gt;&lt;br /&gt;Here we need the LinearDepth between 0 and 1, that depends upon your choise of storage.&lt;br /&gt;The formula is:&lt;br /&gt;&lt;br /&gt;viewRayVS * linearDepth&lt;br /&gt;&lt;br /&gt;If you are reading from the depth-buffer, then you'll need to convert it to view-space and then&lt;br /&gt;divide by the far value.&lt;br /&gt;Pay attention here. If you are using a left handed coordinate system, your ViewSpace depth will be ALWAYS negative.&lt;br /&gt;So the left-handed passage will be: rawDepth -&amp;gt; viewSpaceDepth(0..far) -&amp;gt; division by -far&lt;br /&gt;Right handed: rawDepth -&amp;gt; viewSpaceDepth(0..far) -&amp;gt; division by far&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;WORLDSPACE POSITION&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Ray generation&lt;/strong&gt;&lt;br /&gt;The generation here is:&lt;br /&gt;&lt;br /&gt;ViewDirectionWS = positionWS - cameraPositionWS&lt;br /&gt;and the camera position in WorldSpace can be found as the last column of the &lt;strong&gt;inverse of the view matrix.&lt;/strong&gt;&lt;br /&gt;In HLSL if you want to access this, you can create an helper method:&lt;br /&gt;&lt;br /&gt;float3 getCameraPosition()&lt;br /&gt;{&lt;br /&gt;  return gViewInverse._14_24_34;&lt;br /&gt;}&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Position reconstruction&lt;/strong&gt;&lt;br /&gt;In this case the reconstruction is longer.&lt;br /&gt;Around the web you can find the solution like get the viewspace position and then multiply by the inverse of the view matrix.&lt;br /&gt;It is ok, but can be a lot faster.&lt;br /&gt;Matt in his blog suggest the solution (&lt;a href="http://mynameismjp.wordpress.com/2010/09/05/position-from-depth-3/"&gt;here&lt;/a&gt;) to scale the depth on the camera zAxis:&lt;br /&gt;&lt;br /&gt;float3 viewRayWS = normalise( IN.ViewRayWS );&lt;br /&gt;float3 zAxis = gView._31_32_33;&lt;br /&gt;float zScale = dot( zAxis, viewRayWS );&lt;br /&gt;float3 positionWS = cameraPositionWS + viewRayWS * depthVS / zScale;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;here we're talking about the real viewSpace depth, that can be converted from the post-projection depth by using:&lt;br /&gt;float depthVS = ProjectionB / (depthCS - ProjectionA);&lt;br /&gt;This is already the depth in view space (that is always negative for left-handed systems).&lt;br /&gt;&lt;br /&gt;When storing the linear depth between 0..1, we'll need to convert it back to viewspace.&lt;br /&gt;In case of left-handed system, we stored the linear depth like that:&lt;br /&gt;&lt;br /&gt;float depthLinear = depthViewSpace / -Far;&lt;br /&gt;&lt;br /&gt;So to have again the depth in ViewSpace, we have:&lt;br /&gt;&lt;br /&gt;float depthViewSpace = depthLinear * -Far;&lt;br /&gt;&lt;br /&gt;Hope this is useful guys.&lt;br /&gt;Credits goes to MJP for his amazing work, and this is just a way to summarize all the possible problems in reconstruction.&lt;br /&gt;The problem I found around the web is in defining the real DOMAIN of variable and spaces, and I hope that this contributes to have more clearer ideas about how to handle depth reconstruction and space changes without fear.&lt;br /&gt;&lt;br /&gt;In the next post I will simply write down all the methods in the shader I used to test all this stuff!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-7741762741709059500?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/7741762741709059500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=7741762741709059500' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/7741762741709059500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/7741762741709059500'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2012/01/position-reconstruction-from-depth-2.html' title='Position reconstruction from depth (2)'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-9122964243632353554</id><published>2011-11-28T14:38:00.011+01:00</published><updated>2012-01-10T13:02:18.596+01:00</updated><title type='text'>Position reconstruction from depth (1)</title><content type='html'>&lt;div&gt;&lt;div&gt;Hello gents,&lt;br /&gt;   this post is just a quick recap about the possible ways to reconstruct position from the depth buffer that I found around: almost all the credits goes to &lt;a href="http://mynameismjp.wordpress.com/"&gt;http://mynameismjp.wordpress.com/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Let's define (again) the problem:&lt;br /&gt;&lt;br /&gt;  &lt;strong&gt;Reconstruct pixel position from the depth buffer.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;Applying a personal way of seeing code, let's put in evidence &lt;strong&gt;Data&lt;/strong&gt; and &lt;strong&gt;Transformations&lt;/strong&gt;.&lt;br /&gt;In my experience, I came up with a simplicistic idea about coding:&lt;br /&gt;&lt;br /&gt;  &lt;strong&gt;Coding is a sequence of Data transformed into other Data.&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;I know it is very simplicistic, and low level (we're not taking in account any architecture) but this &lt;strong&gt;is &lt;/strong&gt;a low-level view of the problem.&lt;br /&gt;And more views of the same problem can shed more light on the true nature of the problem itself (as in life in general).&lt;br /&gt;&lt;br /&gt;In this problem we have two data: &lt;strong&gt;Pixel Position &lt;/strong&gt;and &lt;strong&gt;Depth buffer&lt;/strong&gt;.&lt;br /&gt;The transformation is &lt;strong&gt;reconstruction&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;To understand further, we can define the &lt;strong&gt;Domains &lt;/strong&gt;of the datas.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Pixel position&lt;/strong&gt; can be either in &lt;strong&gt;World Space &lt;/strong&gt;or in &lt;strong&gt;View Space&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Depth buffer &lt;/strong&gt;can be encoded either in linear or in post-perpsective z (raw depth buffer)&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;So either the transformations will be from &lt;strong&gt;Depth buffer &lt;/strong&gt;to &lt;strong&gt;Pixel position&lt;/strong&gt; and can be:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Linear&lt;/strong&gt; depth buffer to &lt;strong&gt;View Space &lt;/strong&gt;position&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Linear &lt;/strong&gt;depth buffer to &lt;strong&gt;World Space &lt;/strong&gt;position&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Post-Perspective &lt;/strong&gt;depth buffer to &lt;strong&gt;View Space &lt;/strong&gt;position&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Post-Perspective&lt;/strong&gt; depth buffer to &lt;strong&gt;World Space&lt;/strong&gt; position&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; To finish, we have two other transformations:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Encode to &lt;strong&gt;Linear&lt;/strong&gt; depth buffer&lt;/li&gt;&lt;li&gt;Encode to &lt;strong&gt;Post-Perspective&lt;/strong&gt; depth buffer&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;the post-perspective is hidden by the hardware, and it is what it's inside the real depth buffer.&lt;/p&gt;&lt;p&gt;The linear one maps the eye/camera/view space z to the domain 0..1.&lt;/p&gt;&lt;p&gt;To really finish this introduction to the problem, we must know a little bit about our coordinate system. Moving data from&lt;strong&gt; world &lt;/strong&gt;to &lt;strong&gt;view&lt;/strong&gt; to &lt;strong&gt;projection&lt;/strong&gt; spaces, we must define those domains.&lt;/p&gt;&lt;p&gt;We can just skip &lt;strong&gt;World space &lt;/strong&gt;and concentrate on the other.&lt;/p&gt;&lt;p&gt;If we follow OpenGL or DirectX APIs, we know that they are different in both spaces:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;OpenGL&lt;/strong&gt; uses a &lt;strong&gt;right-handed&lt;/strong&gt; system for the &lt;strong&gt;view&lt;/strong&gt; space&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DirectX &lt;/strong&gt;uses a &lt;strong&gt;left-handed&lt;/strong&gt; one&lt;/li&gt;&lt;li&gt;&lt;strong&gt;OpenGL &lt;/strong&gt;uses a cube between (-1, 1) on x,y,z as &lt;strong&gt;projection &lt;/strong&gt;cube&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DirectX &lt;/strong&gt;uses a cube between (-1,1) on x,y and (0, 1) on z&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Using a right-hand system ends up looking at &lt;strong&gt;negative z&lt;/strong&gt;. Keep this in mind.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;ENCODING AND DECODING TRANSFORMATIONS&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;   In this section we'll talk about encoding: what we want to encode?&lt;/p&gt;&lt;p&gt;The raw-depth-buffer contains a depth transformed from the &lt;strong&gt;view-space&lt;/strong&gt; depth, and they are encoded in a simple way, depending on your projection matrix.&lt;/p&gt;&lt;p&gt;Let's take only the relevant part of the matrix (the last 2x2 corner), that is:&lt;/p&gt;&lt;p&gt;( A  B    ( zView&lt;br /&gt; -1  0 )      1 )&lt;/p&gt;&lt;p&gt;and multiply it with the point in viewspace Pview(zView, 1).&lt;br /&gt;Doing the multiplication has the result:&lt;/p&gt;&lt;p&gt; Pndc = (A * zView + B, -zView )&lt;/p&gt;&lt;p&gt;to became a 3d point (1d here) we apply the division by W:&lt;/p&gt;&lt;p&gt;Pndc = ( A * zView + B / -zView, 1 ) that further simplified became&lt;/p&gt;&lt;p&gt;Pndc = ( -A - (B / zView),  1).&lt;/p&gt;&lt;p&gt;Zndc so is -A - (B /zView).&lt;/p&gt;&lt;p&gt;This is the way in which the depth is encoded in the depth buffer, and the value is between -1 and 1.&lt;br /&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you try to do some maths and put zView = n and zView = f, you'll notice that the values are not mapped correctly between -1 and 1. This is because we're using negative values, so the correct ones are zView = -n and zView = -f.&lt;/p&gt;&lt;p&gt;To find zView, just solve by zView and we'll obtain:&lt;/p&gt;&lt;p&gt;zView = -B / (zNdc + A )&lt;/p&gt;&lt;p&gt;So now we have defined the two transformations:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Projection-Space Encoding:&lt;/strong&gt;   &lt;strong&gt;-A - (B / zView )&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;Projection-Space Decoding:   -B / (zNdc + A)&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Ok then, it's finished.&lt;/p&gt;&lt;p&gt;Wait...what are thos A and B???&lt;/p&gt;&lt;p&gt;Those values depends again on the choice of your projection matrix.&lt;/p&gt;&lt;p&gt;In OpenGL they are defined as (n is near plane, f is far plane):&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A = - (f + n) / (f - n)&lt;br /&gt;&lt;/strong&gt;&lt;strong&gt;B = -2 * n * f / (f - n)&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;those values can be easly calculated and passed to the shaders (don't bother doing it inside a shader, those are perfect values to be set once in a frame with other frame-constants) to reconstruct depth.&lt;/p&gt;&lt;p&gt;Different is the linear depth encoding. We're still encoding &lt;strong&gt;view-space&lt;/strong&gt; depth, but that became easier. The values in camera/eye/view space are like world-space, but just centered around the camera. For the right-handed systems, we will encode all the negative z, because the camera is looking into the negative z semi-space.&lt;br /&gt;The z values will be in the range 0, -infinite: the projection will take care of getting rid of values that are smaller than the near plane and greater than the far.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Linear depth encoding: -zView / f&lt;br /&gt;Linear depth decoding: zLin * f&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Those values are between 0 and 1.&lt;/p&gt;&lt;p&gt;Finally...some &lt;strong&gt;CODE&lt;/strong&gt;!!!&lt;br /&gt;&lt;/p&gt;&lt;p&gt;This is &lt;strong&gt;POST-PROJECTION DEPTH:&lt;/strong&gt;&lt;/p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;pre class="Cpp" name="code"&gt;// Calculate A and B&lt;br /&gt;float rangeInv = 1 / (gFar - gNear);&lt;br /&gt;float A = -(gFar + gNear) * rangeInv;&lt;br /&gt;float B = -2 * gFar * gNear * rangeInv;&lt;br /&gt;&lt;br /&gt;// Write -1,1 post-projection z&lt;br /&gt;float encodePostProjectionDepth( float depthViewSpace )&lt;br /&gt;{&lt;br /&gt; float depthCS = -projParams.x - (projParams.y / depthViewSpace);&lt;br /&gt; return depthCS;&lt;br /&gt;}&lt;br /&gt;// Read -1,1 post-projection z&lt;br /&gt;float decodePostProjectionDepth( float2 uv )&lt;br /&gt;{&lt;br /&gt; float depthPPS = tex2D( depthMap, uv ).r;&lt;br /&gt;       return depthPPS;&lt;br /&gt;}&lt;br /&gt;// Reconstruct view-space depth (0..far)&lt;br /&gt;float decodeViewSpaceDepth( float2 uv )&lt;br /&gt;{&lt;br /&gt;       float depthPPS = decodePostProjectionDepth( uv );&lt;br /&gt; float depthVS = -B / (A + depthPPS);&lt;br /&gt;       return depthVS;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This is &lt;strong&gt;Linear depth&lt;/strong&gt;&lt;br /&gt;&lt;pre class="Cpp" name="code"&gt;// Encode 0..1 view-space depth&lt;br /&gt;float encodeLinearDepth( float depthViewSpace )&lt;br /&gt;{&lt;br /&gt; return -depthViewSpace / far;&lt;br /&gt;}&lt;br /&gt;// Decode 0..1 view-space depth&lt;br /&gt;float decodeLinearDepth( float2 uv )&lt;br /&gt;{&lt;br /&gt; float linearDepth = tex2D( depthMap, uv ).r;&lt;br /&gt; return linearDepth;&lt;br /&gt;}&lt;br /&gt;// Reconstruct view-space depth (0..far)&lt;br /&gt;float decodeViewSpaceDepth( float2 uv )&lt;br /&gt;{&lt;br /&gt; float linearDepth = decodeLinearDepth( uv );&lt;br /&gt; return linearDepth * f;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;As you can see using a linear depth is easier to encode and decode, but it's more expensive from a memory point of view (you'll need an additional render target), and you're already using a depth buffer so you already have those informations.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Next stop is a service post about reconstruction methods for position, even though they are explained a lot by Matt Pettineo on his blog!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;P.S. Fixed a typo in the postProjectionDepth encoding. Fixed a typo in the A and B calculations.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-9122964243632353554?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/9122964243632353554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=9122964243632353554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/9122964243632353554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/9122964243632353554'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2011/11/position-reconstruction-from-depth-1.html' title='Position reconstruction from depth (1)'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-870678456698064135</id><published>2011-11-23T12:59:00.003+01:00</published><updated>2011-11-26T11:45:43.190+01:00</updated><title type='text'>Rendering Architecture (2)</title><content type='html'>&lt;div&gt;Hi guys,&lt;/div&gt;&lt;div&gt;    a simple follow up about the very low-level architecture I'm using in the latest months, after having a look at DirectX 11.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;In the context of rendering, we can assume that every time we render we know exactly which type of renderer (DX9, DX11, LibGCM, X360, ... ) we are using: we don't want to switch renderer on the fly, and on consoles this is impossible to do.&lt;/div&gt;&lt;div&gt;So starting with this in mind, we know and want that in the executable we will build there will be only one renderer.&lt;/div&gt;&lt;div&gt;This can be achieved with a dll/lib in a different projects as you prefer, but the bit I want to talk about is the RenderInterface.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;First of all, what is a RenderInterface?&lt;/div&gt;&lt;div&gt;We have another context parameter: we know that during the rendering phase of our game, we need to provide three main informations to the graphics card and they are&lt;/div&gt;&lt;ol&gt;&lt;li&gt;Geometry informations&lt;/li&gt;&lt;li&gt;Shading informations&lt;/li&gt;&lt;li&gt;Render states&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;and we set those informations in various way, for example on DX/X360 we use Set*** command and Draw*** to issue the drawcall.&lt;/p&gt;&lt;p&gt;The geometry informations are relative to vertex buffer, vertex format/declaration and index buffer; the shading ones are the various shaders (depending on the API, vertex, fragment, geometry,...) and the informations to be used by the shaders (constants and textures); the render states are the all the other informations, like render targets, depth/stencil, alpha blending, so all the configurable states that are grouped in directx 10 and 11.&lt;/p&gt;&lt;p&gt;The render interface thus is splitted in two: a RenderContext, that sets all the informations to issue drawcalls only and draws, and the RenderDevice that manage the creation, destruction and mapping/unmapping of low level graphic resources.&lt;/p&gt;&lt;p&gt;This division permit to easly divide what is "deferrable" to what not, so if you want to create your own command buffer or use the DX11 one (good luck) than you already know that the RenderContext is the right guy to call.&lt;/p&gt;&lt;p&gt;Every object that can be renderable will have a render method that will take pass the RenderContext around, so that it can set the data for the draw calls.&lt;/p&gt;&lt;p&gt;The real catch is to use the curiously recursive template pattern to create the interface for both the RenderContext and the RenderDevice, and create the different implementations for each platforms: even though you need to typedef the specific template implementation, you can assume (see above) that for each target  you have only ONE type for the RenderContext implementation (RenderContext&lt;rendercontextdx9&gt;) alive and thus you can use it.&lt;/rendercontextdx9&gt;&lt;/p&gt;&lt;p&gt;The methods called in the API-dependent class can be all protected so that you enforce the interface, and inlining all the calls in the RenderContext class will map a call of your render context to a direct call of the method, thus avoiding virtuals and with "static polymorphism".&lt;/p&gt;&lt;p&gt;Even though on PC is not a cost, on consoles ( I really suggest you to try, if you can ) is a bad hit (especially on ps3) to call virtual functions a LOT of times, but let's try to figure out the numbers:&lt;/p&gt;&lt;p&gt;if you have 1000 draw-calls, probably you'll have 4 or 5 RenderContext calls (SetVertexBuffer, SetIndexBuffer, SetVertexShader,SetPixelShader,SetConstants,SetVertexFormats, DrawIndexed, ...) for each draw-call, thus having 4000-5000 virtual calls for each frame. So you end up having 4000-5000 cache misses per frame and all without any apparent reason, and the cost of cache misses on consoles...is varying, but  can be from 40 to 600 cycles for each call.&lt;/p&gt;&lt;p&gt;How many cycles are we wasting?&lt;/p&gt;&lt;p&gt;With this system, you have a common interface and no virtuals. No silver bullet, but the problem to find a solution requires a correct definition of the constraints...&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;   BFP&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-870678456698064135?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/870678456698064135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=870678456698064135' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/870678456698064135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/870678456698064135'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2011/11/rendering-architecture-2.html' title='Rendering Architecture (2)'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-1949602344746347626</id><published>2011-10-31T09:59:00.011+01:00</published><updated>2011-10-31T23:36:36.076+01:00</updated><title type='text'>Rendering architecture (1)</title><content type='html'>&lt;div&gt; &lt;/div&gt;&lt;div&gt;Hi guys!&lt;br /&gt;Too much time I don't update this blog!&lt;br /&gt;&lt;br /&gt;I wanted to share with you a way in which I describe rendering for my home-engine, used to study technologies quickly.&lt;br /&gt;I'm doing this way since 2008, so now it's starting to become very mature, but I'm sure will improve in the future!&lt;br /&gt;&lt;br /&gt;Let's start from the objective: I wanted to create something flexible and quick to iterate to study all the different rendering techniques that I'm interested into.&lt;br /&gt;Speaking about DX9+ GPUs, the context of the problem has some constraints.&lt;br /&gt;The rendering APIs are a state machine, and to draw we must provide at least those informations:&lt;br /&gt;&lt;br /&gt;1) Vertex Buffer&lt;br /&gt;2) Index Buffer&lt;br /&gt;3) Vertex Format&lt;br /&gt;4) Vertex Program&lt;br /&gt;5) Fragment Program&lt;br /&gt;6) Shader Constants&lt;br /&gt;7) Render States&lt;br /&gt;8) Render Targets&lt;br /&gt;&lt;br /&gt;We can see the Rendering as a problem on HOW to create those information to be sent to the GPU.&lt;br /&gt;The Rendering nowadays can be seen as a sequence of drawcalls applied to a render target.&lt;br /&gt;So back in time I started to define the concept of Rendering Pipeline as a sequence of drawcalls in a render target.&lt;br /&gt;Each of those sequences became a Stage of the pipeline.&lt;br /&gt;At the end of the day we have&lt;br /&gt;&lt;br /&gt;  Pipeline&lt;br /&gt;      Stage0 -&amp;gt; Stage1 -&amp;gt; Stage2&lt;br /&gt;&lt;br /&gt;This sounds a little simplified, and actually it is simple, but it's really powerful.&lt;br /&gt;An example of Stage can be as simple as a ForwardRendering that renders in the framebuffer (that can be seen as a Render Target),&lt;br /&gt;a GBuffer generation, Shadow Creation, SSAO, ...&lt;br /&gt;&lt;br /&gt;For each stage we define some RenderTargetInputs and Outputs, to link the different stages together.&lt;br /&gt;&lt;br /&gt;If I made the picture clear, each rendering became a series of rendering of stages.&lt;br /&gt;To describe the rendering I started using an XML file like that:&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;img style="margin: 0px auto 10px; width: 200px; height: 103px; text-align: center; display: block; cursor: pointer;" id="BLOGGER_PHOTO_ID_5669584457161220418" alt="" src="http://2.bp.blogspot.com/-WdiPJ9oqaC4/Tq5pBmkroUI/AAAAAAAAAIM/sr0SHZJQRIs/s200/pipelineold.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Each stage type corresponds to a class that extends the Stage class in the code.&lt;/div&gt;&lt;div&gt;At the very beginning this approach was good, because I could describe rendering in a mix of&lt;/div&gt;&lt;div&gt;xml/code that was very fast to prototype with!&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;After some months of coding I saw emerging some interesting patterns:&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;ul&gt;&lt;li&gt;Each stage has some RenderStates set before rendering&lt;/li&gt;&lt;li&gt;Each stage can draw per material or providing a shader&lt;/li&gt;&lt;li&gt;Each stage that describes a postprocess, draws a single quad and has a shader associated.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Further defining the rendering problem, I found another missing information in the rendering objects that were sent to each stage.&lt;/p&gt;&lt;p&gt;How can I define them?&lt;/p&gt;&lt;p&gt;I ended up with what I called a RenderView, that is a camera plus a list of "render instances". So now each stage renders a particular RenderView and has some renderstates defined, plus an optional shader if it is a postprocess.&lt;/p&gt;&lt;p&gt;The point is...why just not describe all those informations in the XML?&lt;/p&gt;&lt;p&gt;Enter ScriptableStage!&lt;/p&gt;&lt;p&gt;This stage has a renderview, some renderstates, and an optional shader. All defined in the XML. This provides me the flexibility to describe a lot of the rendering techniques around.&lt;/p&gt;&lt;p&gt;After some more technique explorations, I found another emerging pattern:&lt;/p&gt;&lt;p&gt;Each time I want to render, I need to provide 3 groups of informations&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Geometry&lt;/li&gt;&lt;li&gt;Shading&lt;/li&gt;&lt;li&gt;Render states&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;When you define all those informations, you can describe all the rendering you want! Even materials can be seen as a list of Shaders corresponding to stages and can be described through XMLs...&lt;/p&gt;&lt;p&gt;The application logic that sits on top must really provide mostly the geometry and link it with materials (that are shaders + render states).&lt;/p&gt;&lt;p&gt;With this simple description I found a very powerful way of describing the rendering and prototype/explore very fast.&lt;/p&gt;&lt;p&gt;Next post I'll describe also a way to achieve a simple reloading mechanism and avoid virtuals for the renderer itself to be more console friendly ;)&lt;/p&gt;&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-1949602344746347626?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/1949602344746347626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=1949602344746347626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/1949602344746347626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/1949602344746347626'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2011/10/rendering-architecture-1.html' title='Rendering architecture (1)'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-WdiPJ9oqaC4/Tq5pBmkroUI/AAAAAAAAAIM/sr0SHZJQRIs/s72-c/pipelineold.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-4288457909416278256</id><published>2010-05-08T15:22:00.003+02:00</published><updated>2010-05-08T21:39:07.815+02:00</updated><title type='text'>What about your challenge?</title><content type='html'>I know I know...I ended up with only 1 day of programming.&lt;br /&gt;But some days after, I ended doing an interview @ Codemasters.&lt;br /&gt;And the big news is...NOW I WORK AT &lt;span style="font-weight: bold; color: rgb(51, 204, 0);"&gt;CODEMASTERS&lt;/span&gt;!!!&lt;br /&gt;A big leap into the possibility to grew and study techniques, doing a work that I LOVE with a great company!&lt;br /&gt;&lt;br /&gt;But hey...and your challenge?&lt;br /&gt;My challenge is returnig back, even if I decided to restart again from scratch.&lt;br /&gt;Why that?&lt;br /&gt;In the meantime I've read some books around (mainly c++ stuff...) and ended up with some new ideas.&lt;br /&gt;Also, my will is to create a framework to explore all these papers and thesis around the web that take my attention!&lt;br /&gt;&lt;br /&gt;But all of this will not happen now, first I have to enter in the apartment and get all the stuff out of the boxes!&lt;br /&gt;&lt;br /&gt;Stay tuned for more infos!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-4288457909416278256?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/4288457909416278256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=4288457909416278256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/4288457909416278256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/4288457909416278256'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/05/what-about-your-challenge.html' title='What about your challenge?'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-3024938309305538284</id><published>2010-03-19T12:34:00.006+01:00</published><updated>2010-03-19T14:59:59.561+01:00</updated><title type='text'>Progress report: Day 1</title><content type='html'>Yesterday it was my first game-engine development day.&lt;br /&gt;As you know, I'm facing the challange of creating a small game-engine in 10 days.&lt;br /&gt;This can be considered a game to improve speed and understanding of a game engine and the decisions about the design. I found that personally, when coding at home (without time constraint) I need to study too much time before taking a decision on design. After this decision is taken, and some UML written down, I code with all in my mind (and papers) in a good way.&lt;br /&gt;To improve the decision time I choose the way of training myself (as with guitar, breakdancing, motorbikes...).&lt;br /&gt;What is the first principle of training? Practice, practice and PRACTICE.&lt;br /&gt;Reading some books of NLP and Self-Improvement, I found in Anthony Robbins a perfect description of what he call the 'decision muscle':&lt;br /&gt;&lt;br /&gt;Decision -&gt; Action -&gt; Results and Feedback.&lt;br /&gt;It is the SAME as a controller in a dynamic system (automation systems...), and applies to all the field of the life.&lt;br /&gt;And decision making is crucial also in engine design.&lt;br /&gt;To improve decision making, I found really useful four things:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Learn more&lt;/span&gt;. &lt;span style="font-weight: bold;"&gt;Learn all&lt;/span&gt;. Many times knowing different techniques improves you understanding of other problems: any techniques, and desing has a mentality behind.&lt;br /&gt;Learning the MENTALITY is powerful. Then apply to other fields. Eg: data oriented structure of arrays used in vectorized math and shaders, can be successufully applied to game objects (Pitfalls_of_Object_Oriented_Programming paper is a good example).&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Try completely different approaches&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Practice, practice, practice&lt;/span&gt;!&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Learn from mistakes&lt;/span&gt;: &lt;blockquote&gt;there are no failure, there are only results&lt;/blockquote&gt; (Robbins)&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;So finally I decided to begun another iteration of my home-engine with new knowledge from books and papers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;FIRST DAY&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Total time&lt;/span&gt;: 10 hours&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Evident results&lt;/span&gt;: running up window, multithread engine loop on.&lt;/li&gt;&lt;/ul&gt;The first day ended with some great insight of what an engine must be (for me).&lt;br /&gt;I've almost finished the &lt;span style="font-style: italic;"&gt;Platform Abstraction Layer&lt;/span&gt;, on which every other layer will rely.&lt;br /&gt;The first thing I noticed is that you must create a &lt;span style="font-weight: bold;"&gt;complete&lt;/span&gt; environment for other programmers to work with your engine. Many times, due to lack of documentation or time to study, it's better to create restrictions to code use and rails for the other programmers.&lt;br /&gt;For example, if you want the complete control of how classes are accessed, you can create some macros that fordib (declare private) copy constructor and equal operator. Or you can typedef pointer, const pointer, reference and such and use &lt;span style="font-weight: bold;"&gt;ALWAYS&lt;/span&gt; them.&lt;br /&gt;Another example can be the error detection: a bunch of macros like _CHECK( condition ), or _ASSERT( condition ), _ASSERTNOFAIL (condition ) can be EXTREMELY useful to have a consistent way of developing. With that you can redirect all these macros to write down in a global output device you messagges, and this can be in a transparent way to programmers: think of an external window that brings up when you are in debug, with all informations sent everytime a check fail (or success), something missing, asserting.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Consistency&lt;/span&gt; is the key.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Decide &lt;/span&gt;the guideline in &lt;span style="font-weight: bold;"&gt;how&lt;/span&gt; you want to handle situations, and then use all the c++ features to create this Consistency.&lt;br /&gt;&lt;br /&gt;Watching other code I've felt that when you give too much degree of freedom in the code to other using your engine, they will always do what you have not expected.&lt;br /&gt;This leads to the need of "extending" C++, or use it to place constraint and quickly change behaviour.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Constraints.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Flexibility&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;These two words commonly are the opposite, but have a variable number of choises, but with precise choises, leads to choose one of the path you thinked of.&lt;br /&gt;Take the following code snippet:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;HBOOL WorkerThread::GiveUpSomeWork(WorkerThread* pIdleThread)&lt;br /&gt;{&lt;br /&gt;    SpinMutexLock Locker;&lt;br /&gt;    _HPKM_CHECK(Locker.TryLock(&amp;amp;m_oTaskMutex));&lt;br /&gt;    _HPKM_CHECK(!m_uiTaskCount);&lt;br /&gt;&lt;br /&gt;    // Grab work&lt;br /&gt;    SpinMutexLock LockIdleThread(&amp;amp;pIdleThread-&gt;m_oTaskMutex);&lt;br /&gt;&lt;br /&gt;    // Taskpool has some new tasks, quit.&lt;br /&gt;    _HPKM_CHECK(pIdleThread-&gt;m_uiTaskCount);&lt;br /&gt;&lt;br /&gt;    // We have only 1 task, try to split it.&lt;br /&gt;    if (m_uiTaskCount == 1)   &lt;br /&gt;    {&lt;br /&gt;        TaskPtr pTask = HNULL;&lt;br /&gt;&lt;br /&gt;        if (m_apTasks[0]-&gt;Split(pIdleThread, &amp;amp;pTask))&lt;br /&gt;        {&lt;br /&gt;            pTask-&gt;m_pCompletion-&gt;MarkBusy(HTRUE);&lt;br /&gt;            pIdleThread-&gt;m_apTasks[0] = pTask;&lt;br /&gt;            pIdleThread-&gt;m_uiTaskCount = 1;&lt;br /&gt;&lt;br /&gt;            return HTRUE;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Grab half tasks (rounding up)&lt;br /&gt;    U32 uiGrabCount = (m_uiTaskCount + 1) / 2;&lt;br /&gt;&lt;br /&gt;    // Copy this thread tasks to the idle thread list.&lt;br /&gt;    TaskPtrPtr ppTask = pIdleThread-&gt;m_apTasks;&lt;br /&gt;    U32 i;&lt;br /&gt;    for (i = 0; i &lt; uiGrabCount; i++)&lt;br /&gt;    {&lt;br /&gt;        *ppTask++ = m_apTasks[i];&lt;br /&gt;        m_apTasks[i] = HNULL;&lt;br /&gt;    }&lt;br /&gt;    pIdleThread-&gt;m_uiTaskCount = uiGrabCount;&lt;br /&gt;&lt;br /&gt;    // Move remaining tasks down&lt;br /&gt;    ppTask = m_apTasks;&lt;br /&gt;    for ( ; i &lt; m_uiTaskCount; i++)&lt;br /&gt;    {&lt;br /&gt;        *ppTask++ = m_apTasks[i];&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    m_uiTaskCount -= uiGrabCount;&lt;br /&gt;&lt;br /&gt;    return HTRUE;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The macro &lt;span style="font-style: italic;"&gt;_HPKM_CHECK &lt;/span&gt;checks the condition and return HFALSE if the condition is not met.&lt;br /&gt;This in the Release version. In debug or profile version, you can substitute it with other commands that send an event to an output device, or maybe print something in the game console.&lt;br /&gt;As you saw, also TaskPtr type is a typedef. This ensure that we can test and let some classes use smart pointers, provide timings about access with/without smart pointers in a transparent way.&lt;br /&gt;&lt;br /&gt;As Engine Programmer, engine is not only a c++ (and a bunch of other languages in other subsystems...) code mess, but a &lt;span style="font-weight: bold;"&gt;TOOL&lt;/span&gt; with which everyone &lt;span style="font-weight: bold;"&gt;MUST&lt;/span&gt; express himself.&lt;br /&gt;For me, this is something that really lacks in many engines, even commercial ones.&lt;br /&gt;Placing many smalls constraint, guides and hints gives everyone the power to use the engine as its full glory.&lt;br /&gt;With macros, templates, defines (really not new stuff...) you have to give &lt;span style="font-weight: bold;"&gt;CREDITED TOOLS&lt;/span&gt; to code with.&lt;br /&gt;You have to redirect almost ALL calls inside your code in a way YOU decide.&lt;br /&gt;Almost &lt;span style="font-weight: bold;"&gt;EVERY&lt;/span&gt; method call must be under your control. Even simple memcpy, strlen, sin...they must be wrapped and even in the case of using the standard functions, you have to decide it.&lt;br /&gt;This &lt;span style="font-weight: bold;"&gt;TOTAL ABSTRACTION&lt;/span&gt; (almost) leads to better code control and later optimization.&lt;br /&gt;&lt;br /&gt;Even in coding, &lt;span style="font-weight: bold;"&gt;DECIDING ALL&lt;/span&gt; is the key! Decide that every sin call leads to a modified version, maybe with a table-lookup, or to the standard function. But you have to &lt;span style="font-weight: bold;"&gt;DECIDE&lt;/span&gt;!&lt;br /&gt;&lt;br /&gt;Outside of those condiserations, I've worked on the platform abstraction. This includes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;All types redefinition;&lt;/li&gt;&lt;li&gt;Multithread-pooltask implementation (completely abstract);&lt;/li&gt;&lt;li&gt;Timing management;&lt;/li&gt;&lt;li&gt;Engine architecture based on an abstract engine, and external-declared subsystems;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Client definition (under Windows a window that handle OS messagges);&lt;/li&gt;&lt;/ul&gt;Giving os/api-independent bricks (classes, components) leads to portable software.&lt;br /&gt;The almost-hated virtual table, a good enemy on xbox360 and ps3 intensive operations, can be achieved in very straightforwarding way.&lt;br /&gt;The final result is an almost controlled window that takes its messagges and call its task pool to use every kind of task possible divided on all the worker threads.&lt;br /&gt;I'm implementing some interesting things like parallel data processing (parallel_for...) and want to contiune this way.&lt;br /&gt;&lt;br /&gt;Of course, these are all mine thoughs and I know that there are many other way of doing the same thing better.&lt;br /&gt;&lt;br /&gt;But you know, I have 9 more days to end the engine!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Demiurge&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-3024938309305538284?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/3024938309305538284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=3024938309305538284' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3024938309305538284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3024938309305538284'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/03/progress-report-day-1.html' title='Progress report: Day 1'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-3876914845297246128</id><published>2010-03-17T23:46:00.004+01:00</published><updated>2010-03-18T00:05:32.912+01:00</updated><title type='text'>Challenge!</title><content type='html'>I've always found that when you rise a challenge to yourself, and take it seriously, this can lead to intersting results.&lt;br /&gt;I want to work on my decision-time, that I want to improve, and also speed up my coding abilities.&lt;br /&gt;So I decided to rise a challenge: write a multi-threading mini-game engine in the shortest time possible. I'm deciding to give me a time of 10 days. I know for sure that there are days in which I'll not even have my pc with me (next weekend, and next week a couple of days...) but I want to try this.&lt;br /&gt;The goal is to provide a basic framework for windows7, directx9.0c, cg capable of letting me create a small game.&lt;br /&gt;&lt;br /&gt;Will I be strong enough to win?&lt;br /&gt;Let's see!&lt;br /&gt;&lt;br /&gt;Every day I'll write down on which part I'll work.&lt;br /&gt;The challenge will begin thursday, so stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-3876914845297246128?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/3876914845297246128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=3876914845297246128' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3876914845297246128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3876914845297246128'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/03/challenge.html' title='Challenge!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-3201626769751901085</id><published>2010-02-17T20:15:00.002+01:00</published><updated>2010-02-17T20:19:47.329+01:00</updated><title type='text'>Skinning!</title><content type='html'>Finally I've made skinning!&lt;br /&gt;&lt;br /&gt;http://www.youtube.com/watch?v=SwAIHFE64v0&lt;br /&gt;&lt;br /&gt;This is a small video that shows the skinning with an FBX model! I'm satisfied for that, even if it costs me too much time due to the lack of documentation as of FBX...&lt;br /&gt;But now I understood (with many trials and errors) the way to retrieve animation data, skeleton, meshes and material informations.&lt;br /&gt;Next step it will be a big overall change of the engine in all its parts, because I've seen the current architecture is quite messy and it is not organized in a way I like.&lt;br /&gt;This iteration of the engine, as already mentioned, is intended to cover all the aspect of an engine, and not only rendering (as my previous 2 engines).&lt;br /&gt;&lt;br /&gt;Stay tuned for more informations!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-3201626769751901085?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/3201626769751901085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=3201626769751901085' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3201626769751901085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3201626769751901085'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/02/skinning.html' title='Skinning!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2196291523610201712</id><published>2010-02-12T16:31:00.000+01:00</published><updated>2010-02-12T16:32:53.385+01:00</updated><title type='text'>Rendering design thoughts</title><content type='html'>I opened a really interesting discussion @ gamedev:&lt;br /&gt;&lt;br /&gt;http://www.gamedev.net/community/forums/topic.asp?topic_id=561645&lt;br /&gt;&lt;br /&gt;I'm brainstorming and sharing my thoughts about rendering, and the mentality behind the renderer I use in my engine.&lt;br /&gt;Take a look!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2196291523610201712?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2196291523610201712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2196291523610201712' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2196291523610201712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2196291523610201712'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/02/rendering-design-thoughts.html' title='Rendering design thoughts'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-6863759874548753605</id><published>2010-02-08T17:16:00.003+01:00</published><updated>2010-02-08T17:42:55.420+01:00</updated><title type='text'>FBX, skinning and exploration</title><content type='html'>Finally I came up coding an importer that can give me the possibility to access data that include mesh, skeleton, animations and materials.&lt;br /&gt;This is a HUGE step ahead in importing asset for the engine, and this lead me to other type of battles and thoughs.&lt;br /&gt;I found FBX lacking of documentation, the only serious source code is made by a guy that created an FBX importer using DirectX10 and very kindly provided the source.&lt;br /&gt;Still, I wanted to use FBX as an INTERMEDIATE format, that is translated in my own internal format, for speed purpose: I'm also using Collada as intermediate format,&lt;br /&gt;but still I have problems in exporting in Max2010 (a beautiful CRASH).&lt;br /&gt;&lt;br /&gt;Next days I hope I'll publish some pics (or maybe a video) showing the skinning.&lt;br /&gt;The BIG improvement coming from the skinning integration is the focusing on the problem concerning the render of different kind of geometries...this is really fascinating, because&lt;br /&gt;I know for sure I'll change all my rendering code very soon. Why that? Simply because I want to *explore* other way of rendering, I've always used direct rendering but now I want to change to other solution, and found in deferred rendering (not deferred light rendering, this with light-pre-pass was done on the previous iteration of Hydra) a new way of thinking: create a command buffer, one for each thread, and then add commands from every thread.&lt;br /&gt;A final merge and the rendering, and you have deferred rendering.&lt;br /&gt;I read some posts around the web, and also the emergent presentation about this, and I found really a good way of thinking the rendering as a multithreading process.&lt;br /&gt;&lt;br /&gt;The other BIG improvement is the way of thinking "data oriented"...it is really amazing, basically it is a way of thinking based on data ACROSS objects, and not only objects...so objects became a set of properties and data, but not in a constraint way.&lt;br /&gt;It is really 'holistic' way of thinking about the code, and I want to try very different way of doing the same thing.&lt;br /&gt;Strange is the fact that coding is the process of transform informations, nothing more, nothing less. And we are experiencing a BIG process of letting all more complicated.&lt;br /&gt;Multithreading is taking to the road of seeing programming with a different level of detail, no more safety and simple flow, but a more wider use of the machine and its power.&lt;br /&gt;&lt;br /&gt;Speaking of exploration...I'm really sad about the announcement about Castlevania:Lord of Shadows. It will be another GodOfWar clone with no more exploration...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-6863759874548753605?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/6863759874548753605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=6863759874548753605' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6863759874548753605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6863759874548753605'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/02/fbx-skinning-and-exploration.html' title='FBX, skinning and exploration'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-7493012064339524640</id><published>2010-01-14T11:57:00.004+01:00</published><updated>2010-01-14T12:40:51.069+01:00</updated><title type='text'>Happy new year!</title><content type='html'>Finally...2010! Happy new year!&lt;br /&gt;I feel very excited about the new year: it begans with many news, not all good, but changes are coming!&lt;br /&gt;I'm rean completion of the base rendering system of the new engine, I'm working on multithreading and I fell in love with Data-Oriented Programming mentality!&lt;br /&gt;Next days I'll have FBX model ready to draw with every shader again, deferred/forward/light-pre-pass easy to switch and already implemented, then I'll move to finalize the multithreading base and physics base.&lt;br /&gt;I want to experiment with a multithreaded framework, to see how can I achieve good performance and stability and usability!&lt;br /&gt;&lt;br /&gt;Stay tuned...new experiments awaits!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-7493012064339524640?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/7493012064339524640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=7493012064339524640' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/7493012064339524640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/7493012064339524640'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2010/01/happy-new-year.html' title='Happy new year!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-6325741175393358814</id><published>2009-12-18T16:55:00.002+01:00</published><updated>2009-12-18T17:13:45.376+01:00</updated><title type='text'>Math library; Core Engine development;</title><content type='html'>Even if I am not coding really fast, I'm studying different topics in which I find really different 'formae mentis': this is really fascinating!&lt;br /&gt;&lt;br /&gt;Actually I written a non-template version of my math library, with some basic support for SSE/VMX code: premature optimization is the root of all evil.&lt;br /&gt;So I'm moving forward to implement other core part of Hydra: camera, input and debug output!&lt;br /&gt;Actually the camera is almost done, with all the code (like plane extraction, frustum vertex in world/view-space) working, the input is almost done and I'm writing the implementation of a directx9-based renderer, that will be used right now only for debug graphics to test that everything with maths works!&lt;br /&gt;&lt;br /&gt;Also, I bumped in the Function Pointers World...really fascinating, with simple code that can make you skip some branch to choose what to do on different situations and have some performance gains...&lt;br /&gt;I'll try to use them in the core part of the engine, to avoid virtual keyword and to skip some branches; this engine is not a commercial-one, so I am free to experiment everything keep my attention!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-6325741175393358814?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/6325741175393358814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=6325741175393358814' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6325741175393358814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6325741175393358814'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/12/math-library-core-engine-development.html' title='Math library; Core Engine development;'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-8215210132805320798</id><published>2009-12-11T15:42:00.002+01:00</published><updated>2009-12-11T15:51:31.954+01:00</updated><title type='text'>Small snippets</title><content type='html'>There are small snippets that can be used very well...&lt;br /&gt;One is a simple software interrupt:&lt;br /&gt;&lt;br /&gt;__asm int 3;&lt;br /&gt;&lt;br /&gt;The second is more evolved, but if used correctly can wield to know everything about your code:&lt;br /&gt;&lt;br /&gt;#define Stringize( L ) #L&lt;br /&gt;#define MakeString( M, L ) M(L)&lt;br /&gt;#define $Line MakeString( Stringize, __LINE__ )&lt;br /&gt;#define Reminder __FILE__ "(" $Line ") : Reminder: "&lt;br /&gt;&lt;br /&gt;so if you use the #pragma comment (Reminder ": TODO/HACK/FIXME") under MSVC compilers you will see the message in the output window, and with a double-click on it, you'll be teleported on where the code is written, so you can keep track of all the stuff you have to change...during compilation time!&lt;br /&gt;&lt;br /&gt;Really useful, small and smart ;)&lt;br /&gt;&lt;br /&gt;P.S. A really simple profiler is born, now I'm writing my math library from scratch, so to see some eye-candy you have to wait some days!&lt;br /&gt;Next steps include:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Basic math library (with future support for SSE)&lt;/li&gt;&lt;li&gt;Input handling (mouse, keyboard)&lt;/li&gt;&lt;li&gt;Camera and Frustum classes&lt;/li&gt;&lt;li&gt;Debug draw (lines, spheres, cubes)&lt;/li&gt;&lt;li&gt;System coherence tests (project/unproject, world/view/screen space tests)&lt;/li&gt;&lt;/ul&gt;In the meantime I'm designing the structure of the engine with all its new systems/parts, and after those steps I'll began coding all of that!&lt;br /&gt;&lt;br /&gt;Stay tuned ;)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-8215210132805320798?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/8215210132805320798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=8215210132805320798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8215210132805320798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8215210132805320798'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/12/small-snippets.html' title='Small snippets'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-5902061658416564762</id><published>2009-12-08T16:10:00.002+01:00</published><updated>2009-12-08T17:17:09.637+01:00</updated><title type='text'>Math-o-centric view</title><content type='html'>One of the thousands of changes I'm doing in the new Hydra is the math system: my math always based on a template math library without any SSE-kind optimization.&lt;br /&gt;I went into a journey that highlighted the lack of centrality of math code and the lack of SSE.&lt;br /&gt;Is it really necessary to use SSE?&lt;br /&gt;The real advantage of SSE is the use of instructions that works on 128-bit registers, and that can contains, for example, a 4d vector.&lt;br /&gt;The BIG advantage of SSE is to use the mentality used when writing shaders to reorganize data in&lt;br /&gt;Structures Of Array and gain a near 4x speedup!&lt;br /&gt;After some study, I've decided so far to eliminate the template aspect of the math library: floating points is the standard de-facto. The real twist is the centrality of math: to use SSE, it is better to create a place in which all math is done; this ensure the possibility to apply different kind of math calculations (better for multiplatform development) without changing code outside the math system.&lt;br /&gt;I think THIS will be the real power of the new design: all math inside the proper system!&lt;br /&gt;After that big change, SSE optimization is a matter of time.&lt;br /&gt;For example, Frustum Culling: imagine a method that performs a Frustum-AABB intersection&lt;br /&gt;&lt;br /&gt;  int Camera::intersectAABB(const AxisAlignedBox3f* const aabb)&lt;br /&gt;&lt;br /&gt;even if it can be cool to let the camera calculate the intersection (by information expert, it can be either the Camera or the AABB), it is smarter to move this method in the math system, like that:&lt;br /&gt;&lt;br /&gt; int Math::FrustumAABBIntersection(const AxisAlignedBox3&amp;amp; aabb, const Frustum&amp;amp; frustum)&lt;br /&gt;&lt;br /&gt;this assure that if you want to implement different math (SSE/VMX/SPU-like) you can do it using the preprocessor.&lt;br /&gt;&lt;br /&gt;I'll try this different approach, and profile the changes from template-based-sparse to float-centric math, and also to float-centric-sse-math.&lt;br /&gt;I am really CURIOUS about the results!&lt;br /&gt;&lt;br /&gt;Stay tuned, next time I'll post some timing and talk about the Core of the Engine!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-5902061658416564762?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/5902061658416564762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=5902061658416564762' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5902061658416564762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5902061658416564762'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/12/math-o-centric-view.html' title='Math-o-centric view'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-5557662552598113502</id><published>2009-11-24T12:44:00.003+01:00</published><updated>2009-11-24T14:10:38.222+01:00</updated><title type='text'>Starting from scratch...again?</title><content type='html'>One of the most intriguing aspect of the game development is the tendency to hide the knowledge.&lt;br /&gt;This is one of the most stupid thing that we human can do: hide our knowledge.&lt;br /&gt;Why that?&lt;br /&gt;Lack of self-confidence, company ripoff of staffs, and many others...I think it would be very useful to study some System Engineering and Systems in general.&lt;br /&gt;Maybe a lecture like 'The web of life' could be REALLY USEFUL.&lt;br /&gt;Sharing of knowledge let other people to improve what you are working on: think of the open source.&lt;br /&gt;One day...the gaming industry will be more open, and maybe not every company will start its own engine because it has no money to buy one! :P&lt;br /&gt;&lt;br /&gt;Sorry for the rant...but I like sharing ALL, because I find that everybody can learn you something, even a 'negative person': it teach you what NOT TO DO!&lt;br /&gt;&lt;br /&gt;Apart from that...I've started rewritting the engine, to go multithreading and to apply all the knowledge I'm building now. Nothing more than an engine to understand the base of all the game development and to experiment new things...&lt;br /&gt;The third iteration of Hydra (codenamed 'Turgid') will be available also on SourceForge.&lt;br /&gt;I'm pretty excited about it, because I can concentrate on different aspects every time!&lt;br /&gt;The first iteration was about...EVERYTHING! Two years ago, I've know nothing about game engine programming. So I studied all from scratch, trying to create a base renderer.&lt;br /&gt;The second was about shaders: I wanted to develop and to investigate the beautiful world of shaders! It ended in a Light-PrePass renderer with shadow maps, screen space ambient occlusion, lightshafts, hdr...many interesting things!&lt;br /&gt;What about the third? I want to enter the multithreading world, I'm really fascinated about it. Also, I want to extend the engine to became a more robust and complete framework, including also a small editor, some physics, AI and sound! And...continue studying special effects, shaders, DirectX11...&lt;br /&gt;The last thought about the third iteration is about the multi-platform development: the actual design had taken in account the possibility to use OpenGL and to run under Linux and MacOS; about this...time will tell!&lt;br /&gt;I want to update this blog more frequently and take many screenshot of the work in progress...&lt;br /&gt;&lt;br /&gt;Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-5557662552598113502?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/5557662552598113502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=5557662552598113502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5557662552598113502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5557662552598113502'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/11/starting-from-scratchagain.html' title='Starting from scratch...again?'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-688550158571279233</id><published>2009-11-13T10:08:00.002+01:00</published><updated>2009-11-13T10:27:03.999+01:00</updated><title type='text'>Moving forward: Portals, DX10, Multithreading!</title><content type='html'>REALLY busy time, luckly!&lt;br /&gt;We are working hard and beautifully in my company...we are experimenting and learning new things, so it is a great time!&lt;br /&gt;In my spare time, apart from learning playing flamenco and jazz, going gym, reading many books (Robbins, Dills, Dyer...) , I'm studying some interesting things: Portals, Dx10 and Multithreading!&lt;br /&gt;Currently I'm implementing a simple Portal System, and designing a completely rewritten game engine that takes in account the multithreading as the base brick of all the structure...this is really fascinating, because nowadays most applications are single threaded and the multithreading is added AFTER the creation of the project.&lt;br /&gt;I've installed Windows 7 on my laptop, and I have to admit that it seems a good operative system: vista-eye-candy, nearxp performance. That unlocked the doors to Directx10, with all the goodies that cames from...the Directx11 also can be used, but on a Geforce8600m gt there is no room for that!&lt;br /&gt;So basically...time to study. Hope to post some screenshots of the portal system soon!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-688550158571279233?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/688550158571279233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=688550158571279233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/688550158571279233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/688550158571279233'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/11/moving-forward-portals-dx10.html' title='Moving forward: Portals, DX10, Multithreading!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-4767648201377132735</id><published>2009-09-22T03:37:00.003+02:00</published><updated>2009-09-22T03:54:54.993+02:00</updated><title type='text'>SSAO!</title><content type='html'>After some fights...here comes the SSAO!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrgqWGEGPDI/AAAAAAAAAEA/zW6OMx_Jatk/s1600-h/HydraSSAO.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrgqWGEGPDI/AAAAAAAAAEA/zW6OMx_Jatk/s320/HydraSSAO.JPG" alt="" id="BLOGGER_PHOTO_ID_5384099913594715186" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;This is the beauty of the 'waterfall effect' of the deferred/lightprepass/z-based rendering: one you have coherence between different spaces (world, view, projection, texture...) and you switch between them rather easily, you can begin working on many interesting effects :)&lt;br /&gt;This is a real basic implementation, based on various post on gamedev (thanks guys!!!)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-4767648201377132735?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/4767648201377132735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=4767648201377132735' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/4767648201377132735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/4767648201377132735'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/09/ssao.html' title='SSAO!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrgqWGEGPDI/AAAAAAAAAEA/zW6OMx_Jatk/s72-c/HydraSSAO.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-6220812617149537971</id><published>2009-09-21T03:51:00.003+02:00</published><updated>2009-09-21T04:00:17.851+02:00</updated><title type='text'>Finally a new connection!</title><content type='html'>Long time no see guys!&lt;br /&gt;This is the first day I have an internet connection in my new house. After 3 months actually!&lt;br /&gt;I was really busy at work, but I continued programming.&lt;br /&gt;My new challange is the Deferred Rendering...a real cute rendering architecture!&lt;br /&gt;After many reads (mainly gamedev) I moved to my first implementation: I found really useful to do all the calculations in view space, the view space pixel position reconstruction became really simple.&lt;br /&gt;Also, the G-Buffer is actually composed of only 2 render target, rendered with a MRT: normal and linear depth. The result is a Light-Pre-Pass-Like renderer...I'll show a little result:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrbczozOVBI/AAAAAAAAAD4/rXMyiwpVtak/s1600-h/HydraDeferredNormalMap01.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrbczozOVBI/AAAAAAAAAD4/rXMyiwpVtak/s320/HydraDeferredNormalMap01.JPG" alt="" id="BLOGGER_PHOTO_ID_5383733184251712530" border="0" /&gt;&lt;/a&gt;10 pointlights on the screen with the known rockwall normal map.&lt;br /&gt;I'm also working on the ScreenSpaceAmbientOcclusion so I can move to create a little demo.&lt;br /&gt;Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-6220812617149537971?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/6220812617149537971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=6220812617149537971' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6220812617149537971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6220812617149537971'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/09/finally-new-connection.html' title='Finally a new connection!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_1JT0EAsdo4Q/SrbczozOVBI/AAAAAAAAAD4/rXMyiwpVtak/s72-c/HydraDeferredNormalMap01.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2453998834950523983</id><published>2009-07-27T09:58:00.002+02:00</published><updated>2009-07-27T10:35:27.189+02:00</updated><title type='text'>Actual State; Near future; Future;</title><content type='html'>Some changes have happened in the last month.&lt;br /&gt;I changed city, company, life.&lt;br /&gt;I moved 700km away from my home, in a more prolific environment and with cool guys.&lt;br /&gt;This is the main reason of the slowdown of the blog!&lt;br /&gt;&lt;br /&gt;I'm actually coding hard, because I want to study some topics in which I'm weak, and then I want to merge all of them in the new Hydra!&lt;br /&gt;During these days I'm creating some really small demos that covers different aspects of game programming:&lt;br /&gt;&lt;br /&gt;- GUI and Font handling;&lt;br /&gt;- Animation;&lt;br /&gt;- Collada import;&lt;br /&gt;- New graphic pipeline;&lt;br /&gt;- Lightmapping;&lt;br /&gt;&lt;br /&gt;These different topics are really interesting, and I'm quite happy of the results.&lt;br /&gt;GUI and Font handling it is something simple, but can give you satisfaction and OUTPUT.&lt;br /&gt;Animation is a really tricky topic, I've done a small exporter in maxscript and all sounds good,&lt;br /&gt;but then I've read this article (&lt;a href="http://www.gamasutra.com/view/feature/4085/sponsored_feature_the_.php"&gt;link&lt;/a&gt;) and found that an importing pipeline is a good choice, even if more difficult for some aspects! Then I began using Collada...really good and FREE.&lt;br /&gt;&lt;br /&gt;New graphic pipeline. I wanted something more shader-oriented than before, so I switched to Cg...really COOL! The rendering is organized in pipelines...each one has its own stages. Every stages can specify one or more render target and all the textures produced are specified in a common pool of texture of the pipeline. The next step will be involving a node-based editor for the creation of the rendering phase...I found it very easy and powerful, something that can istantaneously change the appearence of the game to see different pipelines and render, to study the feel of the game and tune it up!&lt;br /&gt;With that in mind I begun my lightmapper. Through I started only some days ago, now it output a simple lightmap with a really simple phong shading: actually I'm spending time in creating a good unwrap and to create the radiosity normal mapping brick that I need to complete this step!&lt;br /&gt;&lt;br /&gt;Until september I've no connection at home...so updates will be randomic! :(&lt;br /&gt;&lt;br /&gt;But...stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2453998834950523983?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2453998834950523983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2453998834950523983' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2453998834950523983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2453998834950523983'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/07/actual-state-near-future-future.html' title='Actual State; Near future; Future;'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2517926310223321816</id><published>2009-06-17T23:46:00.003+02:00</published><updated>2009-12-08T15:38:47.012+01:00</updated><title type='text'>Secret of Mana</title><content type='html'>Yes...I want to know the Secret of Mana.&lt;br /&gt;Long time ago...there was two special games. One was The Legend of Zelda: A Link to the Past, and another one was Secret of Mana (I don't want to mention Chrono Trigger...I'll do it in another post).&lt;br /&gt;What's about SoM? I really enjoyed it, playing with my best friend and sometimes with my sister...all in realtime? What?&lt;br /&gt;Great story, great ambientation...and great gameplay. The weapons you found and the spell you learn grow with the usage. The fights are in realtime, the AI can control the other in the party or you can play together.&lt;br /&gt;One of my greatest dream is to create a game like that for some console one day...with the beautiful music and all the magic that Secret of Mana has.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SjltV7anf2I/AAAAAAAAADw/lzdU2JvVNeg/s1600-h/som_scan_p21.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 250px;" src="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SjltV7anf2I/AAAAAAAAADw/lzdU2JvVNeg/s320/som_scan_p21.jpg" alt="" id="BLOGGER_PHOTO_ID_5348426255973187426" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SjltVvNLUdI/AAAAAAAAADo/Z-s_Z-FiZVs/s1600-h/som_scan_p20.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 169px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SjltVvNLUdI/AAAAAAAAADo/Z-s_Z-FiZVs/s320/som_scan_p20.jpg" alt="" id="BLOGGER_PHOTO_ID_5348426252695589330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SjltVrdUQPI/AAAAAAAAADg/VN5VQnU1hio/s1600-h/som_scan_p17.jpg_595.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 237px;" src="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SjltVrdUQPI/AAAAAAAAADg/VN5VQnU1hio/s320/som_scan_p17.jpg_595.jpg" alt="" id="BLOGGER_PHOTO_ID_5348426251689541874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;But now the mana is weak...and later games fail in public reception.&lt;br /&gt;One day, I'll forge a new Mana and all will be good for the Universe...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2517926310223321816?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2517926310223321816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2517926310223321816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2517926310223321816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2517926310223321816'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/06/secret-of-mana.html' title='Secret of Mana'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1JT0EAsdo4Q/SjltV7anf2I/AAAAAAAAADw/lzdU2JvVNeg/s72-c/som_scan_p21.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2540469356908575883</id><published>2009-06-04T01:41:00.002+02:00</published><updated>2009-06-04T01:58:21.449+02:00</updated><title type='text'>Updates, ideas, thoughts</title><content type='html'>Finally I'm finishing the animation demo I've scheduled. After some research I found a good way to handle animations with blending and transitions. The results are good, the code is simple and I've both CPU and GPU skinning implementations.&lt;br /&gt;Next will be the 2D demo...sure I want to develop something simple yet powerful!&lt;br /&gt;&lt;br /&gt;On the other way I'm researching on both toolset development and multithreading. The latter is a difficult and big subject to study, but also so fascinating! I've not found many resources around, I think not so many people use multithreading in a correct way...&lt;br /&gt;On the toolset research, I'm creating an architecture that is both GUI and Engine indipendent.&lt;br /&gt;Why so? Is it possible? Yes yes...it is possible. I wanted to create something that can grow with me: I've always believed the power of toolset, but I know also that much time is needed to create something robust and useful. This little/big idea let me create my own editor and develop it during time...I'm really excited about this software design!&lt;br /&gt;&lt;br /&gt;Last but not least...the last guardian (sorry for the repetitions :P). Amazing. Wonderful. I want to make games with such magic...the real state of the art. If you haven't seen it...&lt;a href="http://www.gametrailers.com/game/the-last-guardian/11425"&gt;click here&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;Stay tuned!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2540469356908575883?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2540469356908575883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2540469356908575883' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2540469356908575883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2540469356908575883'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/06/updates-ideas-thoughts.html' title='Updates, ideas, thoughts'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-8762976947984606491</id><published>2009-05-05T13:32:00.003+02:00</published><updated>2009-05-05T13:58:55.022+02:00</updated><title type='text'>Plans</title><content type='html'>The best way to create something is to actually &lt;span style="font-weight: bold;"&gt;DO&lt;/span&gt; it.&lt;br /&gt;Because of this, I began planning some smalls tech-demos for my always-in-development engine Hydra: these demos will give me knowledge about different topics, and incrementally give Hydra more features.&lt;br /&gt;The first, small demo I've done was about culling and the new shader oriented pipeline...I've posted some screens not too much time ago (see &lt;a href="http://badfoolprototype.blogspot.com/2009/02/octree-and-hydraio.html"&gt;this&lt;/a&gt; and &lt;a href="http://badfoolprototype.blogspot.com/2009/02/culling-and-scene.html"&gt;this&lt;/a&gt;) and that debug lines are a &lt;span style="font-style: italic;"&gt;giant step towards engine's features development&lt;/span&gt;. This is something known to many, but the separation between code and data, and the need of data to be displayed, can be overwhelmed by using debug methods (draw 3d lines, 2d lines, circles, spheres, boxes, cylinders).&lt;br /&gt;&lt;br /&gt;Also the use of custom exporter (my case is maxscript) lead to another problem: how to export data in a cross-platform manner and in an efficient way. The solution is simple: &lt;a href="https://collada.org/mediawiki/index.php/Main_Page"&gt;Collada&lt;/a&gt;. It is the perfect intermediate format that can be translated in platform-dependent code, and that exports almost everything graphical thus physics objects. The use of Collada was suggested by the problem of exporting animation (SRT, biped, skinning) data from 3d studio max...what if I found a model created in Maya? And the old release of 3d studio? Using custom-made scripts it is great, maxscript is very simple yet powerful (creating a custom exporter need a small amount of time, personal experience), but when I was developing the script I had to create something adapted to Hydra...abstracting, introducing a new layer was the answer.&lt;br /&gt;&lt;br /&gt;The second demo, as you can imagine, is about animations exported using Collada. I'm thinking of doing first CPU accelerated skinning, I've got a bunch of GPU-accelerated shaders that performs skinning, even if I'm not so confident about the real power of GPU...it becamed too much used, and cores are multiplying!&lt;br /&gt;&lt;br /&gt;Third demo will see a simple 2d framework with menus, font management and console.&lt;br /&gt;&lt;br /&gt;The fourth and the fifth will be the harder part...radiosity lightmapping and scene management. Lightmapping will be only an algorithmic problem, scene management will be a design problem.&lt;br /&gt;The question about how to describe scene, and let different subsystems (graphic, AI, sound) interacts is way too bit complicated to be explained in this post. Also, there are many design flaws in every different implementation...just &lt;span style="font-weight: bold;"&gt;K&lt;/span&gt;eep &lt;span style="font-weight: bold;"&gt;I&lt;/span&gt;t &lt;span style="font-weight: bold;"&gt;S&lt;/span&gt;imple and &lt;span style="font-weight: bold;"&gt;S&lt;/span&gt;tupid.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-8762976947984606491?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/8762976947984606491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=8762976947984606491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8762976947984606491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8762976947984606491'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/05/plans.html' title='Plans'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-727149976231522286</id><published>2009-05-04T07:08:00.002+02:00</published><updated>2009-05-05T12:12:43.607+02:00</updated><title type='text'>Hatching love</title><content type='html'>Some years ago I began cultivating a passion for drawing (now possible only in my sparetime) that evolved in some 3d modeling...one of my favourite technique was "hatching", in which volumes are "described" by simultaneous lines that intersect creating grey-scaled images and giving the idea of volume. Even now I'm not a great modeler/drawer, but I find this fantastic shader to be linked to my vision about drawings (see comics like Berserk or Hokuto no Ken to see it in action).&lt;br /&gt;So based on my first and only semi-serious 3d model, Zoddo from Berserk, I finally came up with this fantastic shader, even if the model has serious normals problem (that affects lightning :(  ):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/Sf54lqvteAI/AAAAAAAAADY/gyONQoU_M8U/s1600-h/HydraHatch01.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 292px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/Sf54lqvteAI/AAAAAAAAADY/gyONQoU_M8U/s320/HydraHatch01.JPG" alt="" id="BLOGGER_PHOTO_ID_5331831597378140162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;I wander what can be the feeling with a 3d world shaded in this way...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-727149976231522286?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/727149976231522286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=727149976231522286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/727149976231522286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/727149976231522286'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/05/hatching-love.html' title='Hatching love'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1JT0EAsdo4Q/Sf54lqvteAI/AAAAAAAAADY/gyONQoU_M8U/s72-c/HydraHatch01.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-3988172725018477761</id><published>2009-04-28T00:53:00.003+02:00</published><updated>2009-04-28T01:08:40.728+02:00</updated><title type='text'>Parallel access: SSAO, Light Pre Pass</title><content type='html'>During these days I'm changing many things to Hydra: mainly there is a graphic revamp...then I'll be ready to make some AI/gameplay experiments!&lt;br /&gt;I'm developing the lightmapping/radiosity part...this is far from being complete; the new graphic pipeline is almost ready, even if there are some issues here and there...&lt;br /&gt;But tonight I wanted to develop some useful shaders with Fx Composer...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;SSAO&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SfY4T-y7diI/AAAAAAAAADQ/TLh-AgLyFNo/s1600-h/HydraFirstSSAO.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 201px;" src="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SfY4T-y7diI/AAAAAAAAADQ/TLh-AgLyFNo/s320/HydraFirstSSAO.JPG" alt="" id="BLOGGER_PHOTO_ID_5329509124964840994" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;Light Pre-Pass&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SfY4Tj_Q6yI/AAAAAAAAADI/Uy6Rxm8XHiY/s1600-h/LightPrePassProblem01.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 254px;" src="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SfY4Tj_Q6yI/AAAAAAAAADI/Uy6Rxm8XHiY/s320/LightPrePassProblem01.JPG" alt="" id="BLOGGER_PHOTO_ID_5329509117768821538" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;The power of Hydra is that it has 1to1 Fx Composer/InEngine shader graphics: I'm using CgFx library to parse and create the shaders, I found really easy to use but yet powerful. So creating shaders for Hydra is just a matter of time: open FxComposer, create the project, compile...then simply copy the file onto the shader directory, create a material with it...DONE!&lt;br /&gt;&lt;br /&gt;There were two great techniques I was impressed by: Screen Space Ambient Occlusion and Light Pre-Pass renderer.&lt;br /&gt;&lt;br /&gt;The first was developed by Crytek in 2007, adding a great realism to the scenes because of the use of the ambient term in the lightning equation (always set to a constant-flat value). This calculation is done entirely in realtime, and even if it is something not much performant on many machines, there are plenty of them that can handle this beautiful effect...&lt;br /&gt;&lt;br /&gt;The second technique is a renderer design created by &lt;a href="http://diaryofagraphicsprogrammer.blogspot.com/"&gt;Wolfgang Engel &lt;/a&gt;: it is a mid point between forward and deferred rendering...really really impressive! It lets you separate light from geometry affected by it, simply rendering the normals and depth to a buffer, then render all the lights needed, then use the forward rendering paradigm using the light buffer for lightning calculation. Even if I have some problems with it, and I've modeled only the diffuse term of the lightning equation, I'm really satisfied tonight.&lt;br /&gt;&lt;br /&gt;Take care...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-3988172725018477761?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/3988172725018477761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=3988172725018477761' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3988172725018477761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3988172725018477761'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/04/parallel-access-ssao-light-pre-pass.html' title='Parallel access: SSAO, Light Pre Pass'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_1JT0EAsdo4Q/SfY4T-y7diI/AAAAAAAAADQ/TLh-AgLyFNo/s72-c/HydraFirstSSAO.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-6838162497962831249</id><published>2009-04-04T19:45:00.002+02:00</published><updated>2009-04-04T19:56:03.773+02:00</updated><title type='text'>Radiosity lightmapping and new Renderer design</title><content type='html'>Hello everybody,&lt;br /&gt;   is a long time since my last post. I was busy at work and in some ideas for my engine, that are still in a primordial stage.&lt;br /&gt;&lt;br /&gt;After being fascinated by the &lt;a href="http://www2.ati.com/developer/gdc/D3DTutorial10_Half-Life2_Shading.pdf"&gt;Radiosity Normal Mapping Technique&lt;/a&gt; by Valve, I've decided to try the way of a lightmapper. I know it's something difficult, but being something I've never do, I want to give it a try!&lt;br /&gt;&lt;br /&gt;The result is a good bunch of links about radiosity and lightmapping in this thread I've opened (here I am JorenJoestar) on Gamedev:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=528414"&gt;http://www.gamedev.net/community/forums/topic.asp?topic_id=528414&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also &lt;a href="http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter39.html"&gt;here&lt;/a&gt; there are some more informations for radiosity on GPU.&lt;br /&gt;&lt;br /&gt;In the meantime I'm designing a new Renderer that it's really &lt;a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=530233"&gt;flexible&lt;/a&gt;. There are still some shadows on the design, so I've came up opening a post on gamedev to receive some critics and some ideas. I've decided to give it a "submission date" after which I'll begin the coding: it's annoying to be stucked with all the things I have to do!&lt;br /&gt;&lt;br /&gt;More on that soon...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-6838162497962831249?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/6838162497962831249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=6838162497962831249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6838162497962831249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/6838162497962831249'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/04/radiosity-lightmapping-and-new-renderer.html' title='Radiosity lightmapping and new Renderer design'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2624460807182200384</id><published>2009-02-15T15:34:00.006+01:00</published><updated>2009-02-15T18:42:08.905+01:00</updated><title type='text'>Culling and scene</title><content type='html'>Speaking of culling, I've finished frustum culling and rendering using an octree as spatial structure. I've began also working on occlusion culling, and found a very intersting paper:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.cgg.cvut.cz/members/bittner/"&gt;Coherent Hierarchical Culling Revisited&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can download the paper from there. It seems a very good techniques that uses Hardware Occlusion Queries with many render-state friendly optimizations, and seems also a real improvement to the basic technique.&lt;br /&gt;But before moving to occlusion culling, I'm studying the design of the scene management, so when I've done with it I can create a real scene to test the CHC++ and also some simpler techniques of occlusion culling (using occlusion planes/frustum entierely on CPU). I found very interesting the use of occlusion queries, but if the scene you are about to render uses heavly the GPU it can impact the performances too much.&lt;br /&gt;With the advent of the multicore cpus the old-fashioned-cpu culling can be of great impact on the performances.&lt;br /&gt;In the meantime, I'll attach two simple shots of some random-placed meshes (the same as the previous post) this time entirely culled and rendered:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZgobwkCULI/AAAAAAAAAC4/HNnaYon16Wk/s1600-h/Hydra10-Octree02.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZgobwkCULI/AAAAAAAAAC4/HNnaYon16Wk/s320/Hydra10-Octree02.JPG" alt="" id="BLOGGER_PHOTO_ID_5303033018586386610" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZgocYWhLaI/AAAAAAAAADA/PjdoPGHYhx4/s1600-h/Hydra10-Octree03.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZgocYWhLaI/AAAAAAAAADA/PjdoPGHYhx4/s320/Hydra10-Octree03.JPG" alt="" id="BLOGGER_PHOTO_ID_5303033029267107234" border="0" /&gt;&lt;/a&gt;The first is the scene seen from the camera, the second shows the frustum and the object rendered.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2624460807182200384?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2624460807182200384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2624460807182200384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2624460807182200384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2624460807182200384'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/02/culling-and-scene.html' title='Culling and scene'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZgobwkCULI/AAAAAAAAAC4/HNnaYon16Wk/s72-c/Hydra10-Octree02.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-5385185569881748249</id><published>2009-02-13T02:30:00.002+01:00</published><updated>2009-02-13T02:55:35.103+01:00</updated><title type='text'>Octree and HydraIO!</title><content type='html'>Hello again...now that I finally closed the section about the previous engine, it's time to talk about the new one!&lt;br /&gt;The name HydraIO, that means "Hydra2" read as binary code, and is the natural successor of the first one.&lt;br /&gt;This version will be more complete and will have more features than Hydra, but it's still under heavy development. The architecture is totally new, the level of abstraction of the resources is different but let me implement all the resources also with consoles in mind, finally the shaders are totally data driven and uses Cg effects as standard. The old assembly used on the first Hydra is dead!&lt;br /&gt;Actually the engine let me load models from 3d studio max, apply a cgfx effect totally data-driven, and now I'm working on culling.&lt;br /&gt;This is the first shot of HydraIO:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZTO1J4mtjI/AAAAAAAAACw/TxTZ3SRgIhA/s1600-h/Hydra10-Octree01.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZTO1J4mtjI/AAAAAAAAACw/TxTZ3SRgIhA/s320/Hydra10-Octree01.JPG" alt="" id="BLOGGER_PHOTO_ID_5302090073903642162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;a really simple Octree in a random based set of static meshes, next I'll attact a debug shader that let's me know if an object has been culled or not. In the meantime, I want you to know a simple trick about the criteria to be matched to end dividing the octree. In many papers I've read, there's always mentioned the criteria based on the number of polygons: if you are under a threshold, there's no way to not split the octree.&lt;br /&gt;Another simple critera is to let you decide the aabb minimum size, so if you are slicing too much the octree doesn't divide: this was a real salvation for avoid infinite cycles!&lt;br /&gt;Staticmeshes are meshes that have their points transformed in worldspace directly, thus all their shader will have only the multiplication: view * projection, and that are fitted in the octree.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-5385185569881748249?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/5385185569881748249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=5385185569881748249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5385185569881748249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/5385185569881748249'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/02/octree-and-hydraio.html' title='Octree and HydraIO!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZTO1J4mtjI/AAAAAAAAACw/TxTZ3SRgIhA/s72-c/Hydra10-Octree01.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-2801807685981328909</id><published>2009-02-09T22:25:00.004+01:00</published><updated>2009-02-09T22:57:39.173+01:00</updated><title type='text'>Hydra History #3: the twist in the tale</title><content type='html'>Then it comes the light.&lt;br /&gt;But first, the tangent and bitangent problem...it causes some really annoying (but funny) parallax effects!&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChhOu7cuI/AAAAAAAAACo/l49M7nF_D4A/s1600-h/HydraReliefProblem.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChhOu7cuI/AAAAAAAAACo/l49M7nF_D4A/s320/HydraReliefProblem.JPG" alt="" id="BLOGGER_PHOTO_ID_5300914353677759202" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After solving this issue, I began fighting with another great effect: the shadows! After a while, and maaaany problems, I've figure out that the road to the demo lead me to a simple shadow map, with the light cast by the player...&lt;br /&gt;This is the scene without the relief, but with the improved water.&lt;br /&gt;Oh yeah, the water!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChCPFJWnI/AAAAAAAAACI/5vAnRdSuNIU/s1600-h/HydraWaterShadow01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChCPFJWnI/AAAAAAAAACI/5vAnRdSuNIU/s320/HydraWaterShadow01.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913821195000434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The other great effect to improve...after some trial, I've ended with a water like that:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChg7Sq4zI/AAAAAAAAACY/ALvgzgZ64q8/s1600-h/HydraWater02.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 188px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChg7Sq4zI/AAAAAAAAACY/ALvgzgZ64q8/s320/HydraWater02.JPG" alt="" id="BLOGGER_PHOTO_ID_5300914348458959666" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I've used a simple environment map to enhance the visual appeal. The noise is terrible by the way, but tweaking it in assembly was a real PAIN!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChg2koBiI/AAAAAAAAACg/8T9bMsSeIhc/s1600-h/HydraRenderToTexture01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChg2koBiI/AAAAAAAAACg/8T9bMsSeIhc/s320/HydraRenderToTexture01.JPG" alt="" id="BLOGGER_PHOTO_ID_5300914347192092194" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This shots shows the technique for reflection and refraction, taken from &lt;a href="http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter19.html"&gt;GPU Gems2 Ch19&lt;/a&gt;.&lt;br /&gt;Using also the copy of the framebuffer in directx, you can skip the second render of the scene that contains the refraction mask in the alpha channel!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The final set of effects was near completion, but with some problems. Still, this is not a demo that satisfied myself.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChCO_7g3I/AAAAAAAAACA/RwWYq9G5ms8/s1600-h/HydraWaterRelief02.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChCO_7g3I/AAAAAAAAACA/RwWYq9G5ms8/s320/HydraWaterRelief02.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913821173121906" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChB2U2KUI/AAAAAAAAAB4/ifeCJPC8uQ0/s1600-h/HydraWaterRelief01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChB2U2KUI/AAAAAAAAAB4/ifeCJPC8uQ0/s320/HydraWaterRelief01.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913814549965122" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SZChgbpXaUI/AAAAAAAAACQ/IlPSSEBzBfg/s1600-h/HydraWaterShadow02.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SZChgbpXaUI/AAAAAAAAACQ/IlPSSEBzBfg/s320/HydraWaterShadow02.JPG" alt="" id="BLOGGER_PHOTO_ID_5300914339964217666" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZCgU1DLSvI/AAAAAAAAABg/-o2B7of2fe4/s1600-h/HydraWater04.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SZCgU1DLSvI/AAAAAAAAABg/-o2B7of2fe4/s320/HydraWater04.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913041113303794" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So I ended up writing an importer from quake3 arena bsp maps...&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChBj3fdgI/AAAAAAAAABo/aO0aZRGL_JI/s1600-h/HydraBSP02.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SZChBj3fdgI/AAAAAAAAABo/aO0aZRGL_JI/s320/HydraBSP02.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913809595004418" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And added some basic physics with Nvidia PhysX.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SZChBuYq0XI/AAAAAAAAABw/_y3Wl8E_D2U/s1600-h/HydraPhysX01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://3.bp.blogspot.com/_1JT0EAsdo4Q/SZChBuYq0XI/AAAAAAAAABw/_y3Wl8E_D2U/s320/HydraPhysX01.JPG" alt="" id="BLOGGER_PHOTO_ID_5300913812418515314" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On august I ended it and in september I began working in the game industry...but still there are many things I want to know and that I'm studying.&lt;br /&gt;This was my first engine from scratch, now I've began a second one (called Hydra IO ) that is different in architecture and more powerful.&lt;br /&gt;Soon I'll post some shots of it, but right now I'm working on the core...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-2801807685981328909?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/2801807685981328909/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=2801807685981328909' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2801807685981328909'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/2801807685981328909'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/02/hydra-history-3-twist-in-tale.html' title='Hydra History #3: the twist in the tale'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_1JT0EAsdo4Q/SZChhOu7cuI/AAAAAAAAACo/l49M7nF_D4A/s72-c/HydraReliefProblem.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-144695619244657349</id><published>2009-01-20T22:22:00.019+01:00</published><updated>2009-01-21T00:35:47.755+01:00</updated><title type='text'>Hydra History #2 and an interesting article</title><content type='html'>On the path to the new engine, I faced the challange of the resource manager design and this turned in an interesting discussion on gamedev. This is the link:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.gamedev.net/community/forums/topic.asp?whichpage=1&amp;amp;pagesize=25&amp;amp;topic_id=520278"&gt;Engine design and resources&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Talking about Hydra, the first release was a great success for me. It was a graphic engine wrote from scratch (int main...) and during its lifetime it teached me much things.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SXZTgWdKpUI/AAAAAAAAAAo/Z123bTmkv0c/s1600-h/HydraEngineSecondShot.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 256px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SXZTgWdKpUI/AAAAAAAAAAo/Z123bTmkv0c/s320/HydraEngineSecondShot.JPG" alt="" id="BLOGGER_PHOTO_ID_5293510227269428546" border="0" /&gt;&lt;/a&gt;This the second shot of my engine. At the time it was only in wireframe, and I was developing an importer from the 3ds format, due to my previous work with 3d studio max.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After that, I've began coding shaders but using asm shaders...this was actually a pain. The renderer has both Direct3D and OpenGL support, so I had to create both shaders two times.&lt;br /&gt;To solve this problem, I've began coding in Cg and then converting to asm every time. This process was really slow and the shaders I've implemented were not optimized and much time was spent to fine-tune them (code, export in asm, modify gpu registry bindings...).&lt;br /&gt;To support some sort of scene hierarchies, I've implemented Bounding Volume Hierarchy:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SXZV2kk5zVI/AAAAAAAAAAw/qf1d9mQFftM/s1600-h/HydraGLBVH01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://4.bp.blogspot.com/_1JT0EAsdo4Q/SXZV2kk5zVI/AAAAAAAAAAw/qf1d9mQFftM/s320/HydraGLBVH01.JPG" alt="" id="BLOGGER_PHOTO_ID_5293512808040353106" border="0" /&gt;&lt;/a&gt;Those two models were under the same node, so the resulting volume must contain both the volume of the models.&lt;br /&gt;This screenshot used OpenGL renderer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Having a simple scene hierarchy system, here comes the time to develop something more interesting.&lt;br /&gt;I have always love water, both in the reality and in 3d rendering (even using max), so the natural choise was to study how to achieve the water.&lt;br /&gt;I've seen what's missing in my renderer, so I create functions for both OpenGL and DirectX to support culling planes and render to texture. I created a tube under max and added some noise to create a cave, exported and then I've tried to create the water.&lt;br /&gt;This was my first attempt:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZXp6iZ8JI/AAAAAAAAAA4/J1mTiQkebkY/s1600-h/HydraFirstWater.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZXp6iZ8JI/AAAAAAAAAA4/J1mTiQkebkY/s320/HydraFirstWater.JPG" alt="" id="BLOGGER_PHOTO_ID_5293514789620412562" border="0" /&gt;&lt;/a&gt;This image seems like coming from ten years ago, but it was a success at the time. The reflection was done via render to texture and culling plane, and the result for debug purpose can be seen on the lower left.&lt;br /&gt;The refraction was poor, and there were no noise and no light.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After this preliminary water, it comes the time to face another subject I love: shadows. This was the REAL pain. I've passed nights and many posts on gamedev to achieve a simple shadowmap, due to the texture format, due to the poor pipeline: cg-&gt;asm-&gt;hydra. It takes long time to see the shadow map working, I don't know even how much!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZZzhEuGmI/AAAAAAAAABA/q5B-5MRs5LM/s1600-h/HydraDXNoShadow01.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZZzhEuGmI/AAAAAAAAABA/q5B-5MRs5LM/s320/HydraDXNoShadow01.JPG" alt="" id="BLOGGER_PHOTO_ID_5293517153606965858" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZaEE7YuTI/AAAAAAAAABI/WHFG00lGYc0/s1600-h/HydraDxFirstShadow.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZaEE7YuTI/AAAAAAAAABI/WHFG00lGYc0/s320/HydraDxFirstShadow.JPG" alt="" id="BLOGGER_PHOTO_ID_5293517438109399346" border="0" /&gt;&lt;/a&gt;Finally the long waited shadow map! Ugly but hey man...I've learnt many other things!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;And then I wanted to give another touch...using normal maps.&lt;br /&gt;I've noticed a family of graphic effect that derive from normal maps like parallax occlusion mapping, relief mapping, cone step mapping and stuff like that.&lt;br /&gt;So I've began studying them, creating shader for normal, simple parallax and relief with fake soft shadows using FxComposer. It ended up with the overused rockwall:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZdd2iRPrI/AAAAAAAAABQ/ZIi8URn4LjI/s1600-h/HydraReliefMapShadow.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 200px;" src="http://1.bp.blogspot.com/_1JT0EAsdo4Q/SXZdd2iRPrI/AAAAAAAAABQ/ZIi8URn4LjI/s320/HydraReliefMapShadow.JPG" alt="" id="BLOGGER_PHOTO_ID_5293521179457437362" border="0" /&gt;&lt;/a&gt;Another problem here was the lack of informations like Tangent and Bitangents.&lt;br /&gt;So I create a function to fill the vertex buffer with those informations...using the math explained in this article: &lt;a href="http://www.terathon.com/code/tangent.html"&gt;Tangent Space Calculation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The end of the story will be in part #3...stay tuned!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Demiurge&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-144695619244657349?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/144695619244657349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=144695619244657349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/144695619244657349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/144695619244657349'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/01/hydra-history-2-and-interesting-article.html' title='Hydra History #2 and an interesting article'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_1JT0EAsdo4Q/SXZTgWdKpUI/AAAAAAAAAAo/Z123bTmkv0c/s72-c/HydraEngineSecondShot.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-8114969455354042042</id><published>2009-01-08T13:32:00.002+01:00</published><updated>2009-01-08T13:38:59.986+01:00</updated><title type='text'>Hydra history #1</title><content type='html'>A years ago, I've began coding a graphic engine called Hydra. It was very important for me, because it learned me much things about different fields, like graphics, engines, directx/opengl, cg, hlsl, windows and linux.&lt;br /&gt;After some months of nighttime development, I've created a demo and a video about it:&lt;br /&gt;&lt;br /&gt;http://it.youtube.com/watch?v=Bx_WeMigxRA&amp;amp;feature=related&lt;br /&gt;&lt;br /&gt;Even if it's not an impressive demo, it is based totally on the renderer made by me. Started from scratch. And this leaded me to continue to study and research about graphic and engines.&lt;br /&gt;&lt;br /&gt;And leaded me to finally be a game programmer!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-8114969455354042042?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/8114969455354042042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=8114969455354042042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8114969455354042042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8114969455354042042'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2009/01/hydra-history-1.html' title='Hydra history #1'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-8950567847688280341</id><published>2008-10-28T22:49:00.002+01:00</published><updated>2008-10-28T23:02:20.222+01:00</updated><title type='text'>Long time...</title><content type='html'>It is a long time since my last post.&lt;br /&gt;Many things have changed, and many were improved!&lt;br /&gt;First of all...I've done it! I'm working in the game industry! In september I've began working @ Gd-Mind, a small game company located here in Rome. The peoples are great, Tiziano Lena (Lead Prog) and Gabriele Barlocci (Senior Prog) are quite great masters...and day after day they teach me many new things.&lt;br /&gt;The Hydra Engine finished with a small demo, but during the entire process it teached me many stuff about engines and now I'm thinking of starting a new engine from scratch, the old architecture is quite too complex. The engine included NVidia PhysX for physics and lua for scripting, because of the will to expand to a game engine and not a mere graphic engine. But this lead me to think about a new and more simple architecture, and choose to support only a graphic API.&lt;br /&gt;Stay tuned for more info about the next steps...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-8950567847688280341?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/8950567847688280341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=8950567847688280341' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8950567847688280341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/8950567847688280341'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2008/10/long-time.html' title='Long time...'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-1219791121715826244</id><published>2008-03-26T12:49:00.003+01:00</published><updated>2008-03-26T12:57:35.635+01:00</updated><title type='text'>The power of design...</title><content type='html'>The step is done. Friday I've done the design of the new architecture, that will allow a multi-platform/multi-render development of my engine, all based on libraries. So I wrote down all the subsystems, the new engine tree, and the code came up from my fingers during friday night.&lt;br /&gt;The result is an SDK, useful to create demos and applications focusing on the apps and not on the renderer or the OS.&lt;br /&gt;I feel very satisfied about it, it is modular and let me concentrate on the next steps: developing an OpenGL renderer and a OpenGL/Linux application, to let the engine be developed with my two main OS.&lt;br /&gt;I'm working also on an embedded version of the engine in WxWidgets, so I can create some useful tools to build shaders, scenes, and stuff like that.&lt;br /&gt;&lt;br /&gt;Casper: today he will become Software Engineer. With the max possible rank. Congratulations!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;P.S. I'm Demiurge. The second is Casper...and the next?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-1219791121715826244?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/1219791121715826244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=1219791121715826244' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/1219791121715826244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/1219791121715826244'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2008/03/power-of-design.html' title='The power of design...'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-713878840142751967</id><published>2008-03-19T11:00:00.002+01:00</published><updated>2008-03-19T11:10:34.668+01:00</updated><title type='text'>First milestone!</title><content type='html'>The time has come to close the first milestone of my little engine.&lt;br /&gt;Some basic features, but still important (like a full math library, geometry and texture importer from 3Ds files,&lt;br /&gt;render to texture and basic shader, basic camera and scene managment).&lt;br /&gt;And now a new need.&lt;br /&gt;The need to move to multiplatform/multirenderer architecture, the need to see it in every way possible.&lt;br /&gt;I'm still confused about the solution to this problem, cause the windows development was fast and easy with visual studio 2005 and DirectX9, but more satisfaction is yet to come.&lt;br /&gt;&lt;br /&gt;It's time to design - how to build over different platforms.&lt;br /&gt;It's time to design - how to let my brother work on our dream.&lt;br /&gt;&lt;br /&gt;Welcome Caspar!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-713878840142751967?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/713878840142751967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=713878840142751967' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/713878840142751967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/713878840142751967'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2008/03/first-milestone.html' title='First milestone!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-20562695964343271</id><published>2008-02-01T12:06:00.000+01:00</published><updated>2008-02-01T14:37:39.359+01:00</updated><title type='text'>Render to texture</title><content type='html'>Finally the times come.&lt;br /&gt;The times to develop one of the most useful feature of an engine: render to texture!&lt;br /&gt;&lt;br /&gt;Here is the link to my simple scene...rendered 2 times: one to create the texture and another to&lt;br /&gt;create the real scene!&lt;br /&gt;http://i110.imagethrust.com/images/&lt;br /&gt;   2YVi/view-image/hydrarendertotexture.html&lt;br /&gt;&lt;br /&gt;I like it...it begins to take shape...&lt;br /&gt;&lt;br /&gt;BREAKING NEWS!&lt;br /&gt;&lt;br /&gt;It's time to grow up...I'm pleased to announce that Casper, my best friend and brother, joined me in this adventure.&lt;br /&gt;Say Hi to Casper!&lt;br /&gt;&lt;br /&gt;  Bad Fool Prototype&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-20562695964343271?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://badfoolprototype.blogspot.com/feeds/20562695964343271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6217008513945652449&amp;postID=20562695964343271' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/20562695964343271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/20562695964343271'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2008/02/render-to-texture.html' title='Render to texture'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6217008513945652449.post-3664988166613430551</id><published>2008-01-24T17:20:00.000+01:00</published><updated>2008-01-24T18:13:37.083+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><title type='text'>Gentlemen, start you engines!</title><content type='html'>&lt;span style="font-family: courier new;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: courier new;"&gt;Be prepared...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;This is only a trial...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;To share some notion,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;to learn new stuff.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;To put answers and&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;find new questions.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;A solid backup of&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: courier new;"&gt;ideas and solutions.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6217008513945652449-3664988166613430551?l=badfoolprototype.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3664988166613430551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6217008513945652449/posts/default/3664988166613430551'/><link rel='alternate' type='text/html' href='http://badfoolprototype.blogspot.com/2008/01/gentlemen-start-you-engines.html' title='Gentlemen, start you engines!'/><author><name>Demiurge</name><uri>http://www.blogger.com/profile/15556359564312702646</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://4.bp.blogspot.com/_1JT0EAsdo4Q/S2gg7Q-cQoI/AAAAAAAAAFM/Uz34fCn6xug/S220/demiurge.jpg'/></author></entry></feed>
