{"id":36,"date":"2007-10-29T18:51:23","date_gmt":"2007-10-29T17:51:23","guid":{"rendered":"http:\/\/blog.jbriguet.com\/?p=36"},"modified":"2010-03-27T15:38:48","modified_gmt":"2010-03-27T14:38:48","slug":"post-process-engine-modification","status":"publish","type":"post","link":"https:\/\/blog.jbriguet.com\/?p=36","title":{"rendered":"Post Process Engine Modification"},"content":{"rendered":"<p>Ok, a few days ago, i played with the <a href=\"http:\/\/www.ziggyware.com\/forum\/viewthread.php?forum_id=12&amp;thread_id=12609\">post process engine Mahdi Khodadadi made<\/a>.<br \/>\nIt wasn&#8217;t totally fitting my needs, so I &#8220;think&#8221; i improved it a little bit. (Now, adding an effect is as simple as dropping it in the right folder, and making an advanced one is as simple as derivating the PostProcessEffect)<\/p>\n<p>Today effects are : Color Tone, Combine, Gaussian Blur, Radial Blur, Smart Blur, Simple Blur, Tone Mapping, Bright Extract, Color Inverse, Edge Detection, Embossing, Sharpen, Night Time, Under Water, and differents Greyscale effects.<\/p>\n<p>Here is what&#8217;s new :<br \/>\n*-Simples Effects can be loaded automatically, they just need to be in the right path.<br \/>\n*-For more sophisticated effects, just create the right .cs file, according to the ones i already made.<br \/>\n*-For advanced effects, simply define parameters as properties, and override what&#8217;s needed.<br \/>\n*-Effects are currently manager through a simple queue\/dictionnary list, this will probably change in the future.<br \/>\n*-Viewports are recreated automatically when device lost\/reset, RenderTargets too.<br \/>\n*-When drawing, only draw in the current viewport (should work for my splitted screen multiplayer game, although, i haven&#8217;t tested it yet) (Different effects for each players)<br \/>\n*-I changed the namespaces to reflect my current game architecture, and to best fit into my UML designer<br \/>\n*-Added some more effects from <a href=\"http:\/\/www.virtualrealm.com.au\/forums\/26.aspx\">Glenn Wilson (Mykres)<\/a><br \/>\n*-Using a delegate for the drawing (almost all effects are using a delegate from the PostProcessManager, but a few overrides their begin\/draw\/end functions)<br \/>\n*-Can update needed variables for each effect, just overload the Update methods, default one will set any hlsl parameter whose name contains &#8216;timer&#8217; to the current total second value.<\/p>\n<p>Here the creation of the post process manager :<\/p>\n<pre class=\"brush:csharp\">PostProcessManager ppm = new PostProcessManager(this, this.graphics.GraphicsDevice, this.content);\r\nthis.Components.Add(ppm);\r\n<\/pre>\n<p>And here the code you need to put in update (the effect queue is flushed every frame)<\/p>\n<pre class=\"brush:csharp\">ppm.AppliedEffects.Enqueue(ppm.EffectDictionary.Keys[currentEffectIndex]);\r\n<\/pre>\n<p>You can <a href=\"https:\/\/blog.jbriguet.com\/wp-content\/uploads\/2007\/10\/ppe.zip\"><strong>DOWNLOAD<\/strong> the library right here<\/a> (Use space to change the current effect), change it as you want, but please give credits to Mahdi, Mykres and me.<br \/>\n(I left the .svn folder intentionally in the zip files, so you can update to the last version, I don&#8217;t promise the Queue and Dictionnary will last a long time.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ok, a few days ago, i played with the post process engine Mahdi Khodadadi made. It wasn&#8217;t totally fitting my needs, so I &#8220;think&#8221; i improved it a little bit. (Now, adding an effect is as simple as dropping it in the right folder, and making an advanced one is as simple as derivating the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-3"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p6Eo2-A","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36"}],"version-history":[{"count":6,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=\/wp\/v2\/posts\/36\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jbriguet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}