tag:blogger.com,1999:blog-199190042024-02-08T06:40:11.728+01:00Ramblings in 3D (and other stuff)3d coding and other geeky stuff!Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.comBlogger45125tag:blogger.com,1999:blog-19919004.post-67570496327967855132008-02-22T09:44:00.002+01:002008-02-22T09:58:25.613+01:00<strong>Tip of the day</strong><br /><strong></strong><br />Nope, no engine updates today. Instead I'll give you a website recommendation.<br /><br />If you're a bit weird like me, that is, you rather read graphics papers than fiction before you go to sleep, you probably already have this one in your bookmarks.<br /><br /><a href="http://kesen.huang.googlepages.com/">Ke-Sen Huang</a> keeps an index of all papers available online from every academic graphics conference worth it's name.<br /><br />I'm yet to find a good rescource that lists all papers and presentations from more commercially oriented conferences like GDC. Feel free to share your own bookmarks :)Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com5tag:blogger.com,1999:blog-19919004.post-59670153351318601932008-02-20T08:59:00.005+01:002008-02-21T15:47:28.376+01:00<strong>Soft shadows </strong><br /><p>I've added soft shadows to the engine. I use Percentage-Closer Soft Shadows (PCSS), described in <a href="http://developer.download.nvidia.com/shaderlibrary/docs/shadow_PCSS.pdf">this paper</a>. It differs from regular PCF in that a "blocker-serach" step is used to approximate a shadow penumbra size. The estimated penumbra size is then used to control the filter size. It's not real penumbra shadows but it looks quite convincing.</p>Believe it or not, but until now my engine had no support for normal mapping. Now it does. The dynamic indirect lighting is also affected by the normal maps.<br />Time for the screenshots:<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIdXzxHrA2pZiH_Myk6kWZx3nJ3Y30KCUMGODQnRFmRZLHQniwrV1_KAscR6PynnX0amozmEjEdbu9PPtTZaazPrurYb_xNQlID4qi_HolFzqbOkyawEUmhhV-L_v1pnvq2OLeQ/s1600-h/room1.PNG"><img id="BLOGGER_PHOTO_ID_5168969070480027954" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwIdXzxHrA2pZiH_Myk6kWZx3nJ3Y30KCUMGODQnRFmRZLHQniwrV1_KAscR6PynnX0amozmEjEdbu9PPtTZaazPrurYb_xNQlID4qi_HolFzqbOkyawEUmhhV-L_v1pnvq2OLeQ/s400/room1.PNG" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyRTPue8pp310wG7gxKcIq0o9oRz83PajUHtDh0T0w8F3NV7yfLofUppzt4TGTfbj0dvaFoS8IJ21X40mNs5KBZPzHX0QXb6rC_2_Km1SjDX8Zm7W2zhkikdybINPuaKzrUQ_QTA/s1600-h/room2.PNG"><img id="BLOGGER_PHOTO_ID_5168969379717673282" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyRTPue8pp310wG7gxKcIq0o9oRz83PajUHtDh0T0w8F3NV7yfLofUppzt4TGTfbj0dvaFoS8IJ21X40mNs5KBZPzHX0QXb6rC_2_Km1SjDX8Zm7W2zhkikdybINPuaKzrUQ_QTA/s400/room2.PNG" border="0" /></a> <p align="center"><span style="font-size:78%;">Note the green light that is reflected from the wall (not visible) onto the scene.</span><br /></p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Mad5Vbkp2i9-XvSHRuh2nArMmSpdrB3NWpLlDukJIQbHGjArPcIyz5bawInTe6H6i8fKwOxMID64D7MzUvA3z28BmUNVmbklW47htx_5Gysmb_0e8NJZwUhgArXkIRjQvp6SQg/s1600-h/room3.PNG"><img id="BLOGGER_PHOTO_ID_5168969590171070802" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8Mad5Vbkp2i9-XvSHRuh2nArMmSpdrB3NWpLlDukJIQbHGjArPcIyz5bawInTe6H6i8fKwOxMID64D7MzUvA3z28BmUNVmbklW47htx_5Gysmb_0e8NJZwUhgArXkIRjQvp6SQg/s400/room3.PNG" border="0" /> <p align="center"></a></p><span style="font-size:78%;">Soft shadows.<br /></span><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjceb-6cVozL9CDTzZkuUx4pQpB9jzuBr44421hEzM2NGkem6b694k9FfTXxh9U-USnUGNEND-UVbbX0QxOy5gjvxJ332QtbI5OMU_RCF63ihe27NInC3mOP8bqdPVqjwXhpjM5kQ/s1600-h/room4.PNG"><img id="BLOGGER_PHOTO_ID_5168969804919435618" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjceb-6cVozL9CDTzZkuUx4pQpB9jzuBr44421hEzM2NGkem6b694k9FfTXxh9U-USnUGNEND-UVbbX0QxOy5gjvxJ332QtbI5OMU_RCF63ihe27NInC3mOP8bqdPVqjwXhpjM5kQ/s400/room4.PNG" border="0" /> <p align="center"></a></p><span style="font-size:78%;">The scene is also lit by an enviroment map.</span>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com9tag:blogger.com,1999:blog-19919004.post-11199357026317733332008-02-08T12:47:00.000+01:002008-02-08T13:01:46.158+01:00<strong>Dynamic indirect lighting</strong><br /><br />I got the indirect lighting to work correctly. There were some stupid bugs in my SH code. In the screenshots I use a 3x3x3 grid of sampling points (see last post) and one bonce of indirect light. There is also a (very) small constant ambient term so that no surfaces are completely black. Combined with SSAO it looks quite nice.<br /><br />The scene is simple and HDR is deactivated so that the lighting effects is more apparent.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWyJex5jEZWxwWR7ND8s399FTwVHgNvyCU9haemdDEzyRh6g_laXhUiJ3GR8esVmKwTSZAos9F5_rxIf2anlQgfH-zWEOHi_W89DrL07xeL2Jrxp1gx7KoFXIjee48qM9qA-XkQ/s1600-h/indirect_red.PNG"><img id="BLOGGER_PHOTO_ID_5164576275352177650" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicWyJex5jEZWxwWR7ND8s399FTwVHgNvyCU9haemdDEzyRh6g_laXhUiJ3GR8esVmKwTSZAos9F5_rxIf2anlQgfH-zWEOHi_W89DrL07xeL2Jrxp1gx7KoFXIjee48qM9qA-XkQ/s400/indirect_red.PNG" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX9WLa-KIIZdXw7PW5pdTIo_mUrdOTGk23SZ4oXttv3J9ZoKlILAviDuZzZJoQfes3QsvEaD0UuvLUgj5l078-fwmvlz4kHxoVUIU_L75yu2EUNMSqIRlb_R4hO93Jhh6VpFnPHA/s1600-h/indirect_green.PNG"><img id="BLOGGER_PHOTO_ID_5164576442855902210" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiX9WLa-KIIZdXw7PW5pdTIo_mUrdOTGk23SZ4oXttv3J9ZoKlILAviDuZzZJoQfes3QsvEaD0UuvLUgj5l078-fwmvlz4kHxoVUIU_L75yu2EUNMSqIRlb_R4hO93Jhh6VpFnPHA/s400/indirect_green.PNG" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoHl_LC3n3hJGjHc4waySgs2QHTabnoc1M9ukjsHITAA5l3cqgH51gy8nTR3N3mQL5EqCOWGnkjpmMbKhS8mob_UkOpL1vKPHJjGL4ghkkMKT7zLHb5OsHN3rqQNfv2UayU1QnXw/s1600-h/indirect_purple.PNG"><img id="BLOGGER_PHOTO_ID_5164576588884790290" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoHl_LC3n3hJGjHc4waySgs2QHTabnoc1M9ukjsHITAA5l3cqgH51gy8nTR3N3mQL5EqCOWGnkjpmMbKhS8mob_UkOpL1vKPHJjGL4ghkkMKT7zLHb5OsHN3rqQNfv2UayU1QnXw/s400/indirect_purple.PNG" border="0" /></a>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-53074408600182028622008-02-01T14:14:00.000+01:002008-02-01T15:43:26.552+01:00I've been quite busy with the engine lately. The new stuff is:<br /><br /><strong>Dynamic reflections</strong><br />Each reflective object has it's own cube enviroment map. I support multiple bounces by spreading out the cube map updates over a number of frames. This means there can be some subtle "popping" in the reflections. Acceptable for my application.<br /><br /><strong>HDR pipeline</strong><br />I now support 64 or 128 bit HDR rendering. Pretty standard stuff where I do tone mapping based on image luminance. Of course there is also a bloom filter (as if we're not tired of that one by now;))<br /><br /><strong>Antialiasing</strong><br />One of the biggest drawbacks with deferred shading is the lack of support for multisample antialias (at least with DX9). The usual thing to do is to hack antialias by performing an edge detection filter and blurring the image only on the edges. It's a dirty hack but it works quite well.<br /><br /><strong>Dynamic indirect illumination</strong><br />This is a variant of <a href="http://graphics.cs.ucf.edu/GPUassistedGI/GPUGISubmission.pdf">this paper</a>. In short, I partition the world into a uniform grid, and at each grid point I capture the incident radiance field. This is done by rendering a cube map and then projecting it to spherical harmonics coefficients. The coefficients are stored in a number of volume textures. When rendering the frame, SH cofficients representing the incident radiance at each pixel are fetched from the volume texture and used to approximate the incident diffuse lighting at each pixel.<br /><br />Right now there are some problems with my implementation but I'll solve that soon ;)<br /><br />At last, the mandotary screenshot:<br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigKX3s0jjvBZ4qou01EPyOQLG5D3vqHl6jLURlg8Rs6jGkuIlfPvWsm8jpVZJiSJzSXwpyN4-GBwv8ndCfmaPE1pzmZ8nNSW_6U_VKe-j4DxqmvgY7HQfYOFUq8FQBBMr2yLIsbQ/s1600-h/reflections_hdr.PNG"><img id="BLOGGER_PHOTO_ID_5162000205507644386" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigKX3s0jjvBZ4qou01EPyOQLG5D3vqHl6jLURlg8Rs6jGkuIlfPvWsm8jpVZJiSJzSXwpyN4-GBwv8ndCfmaPE1pzmZ8nNSW_6U_VKe-j4DxqmvgY7HQfYOFUq8FQBBMr2yLIsbQ/s400/reflections_hdr.PNG" border="0" /></a>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-20405014693308259612008-01-10T16:21:00.000+01:002008-01-10T19:37:02.859+01:00I've finally started working on the engine after the holidays.<br /><br />I've done quite a lot of non graphic stuff. I've improved the engine code here and there and I've added picking for example.<br /><br />On the graphic side, I've added support for cube maps and thus omidirectional shadows. All lights now also supports gobos, i.e. color textures that are projected from the lights. There is also support for reflections, but I'm still working on dynamic ones.<br /><br />Scenes with a lot of lights also means a lot of shadow maps. For this reason, I've implemented a shadow map queue. When a shadow map needs an update it's added to the queue and every frame a number of entries in the queue are removed and processed. So only a small number of shadow maps are updated each frame. This of course means that there can be some noticable shadow lag when objects are moved around. For the type of application I have in mind for this engine, that is acceptable.<br /><br /><div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5fACgix-1ZkKA2MBI_YN-tMjpHB6uHzKVfbaQ4eQsncWi7xb4GGORdEdmkE19zto-Xgt2vs7KoV8Du2BbTvTREK3s4GqDy_8FRUFmWyoGqs6FZj2YrO2ifYB41wAw4DXprlbumQ/s1600-h/omni_shadows.PNG"><img id="BLOGGER_PHOTO_ID_5153868887037148402" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5fACgix-1ZkKA2MBI_YN-tMjpHB6uHzKVfbaQ4eQsncWi7xb4GGORdEdmkE19zto-Xgt2vs7KoV8Du2BbTvTREK3s4GqDy_8FRUFmWyoGqs6FZj2YrO2ifYB41wAw4DXprlbumQ/s400/omni_shadows.PNG" border="0" /></a> <span style="font-size:78%;">Omnidirectional shadow mapping</span></div><span style="font-size:78%;"></span><div align="center"><br /></div><div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2WC8F_T9oDBDPmhxrQwzorVVtzaUslsut9thMBGffZGmyJpB2nE0xZFvlrbmyklzgZtQgKb4zXIZoPAj-MJ1PfSkshV9fp5uLoUdwmitsKQ_0_D4VWZNyKB7JYSFwslhgpSti5A/s1600-h/gobos.PNG"><img id="BLOGGER_PHOTO_ID_5153868766778064098" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2WC8F_T9oDBDPmhxrQwzorVVtzaUslsut9thMBGffZGmyJpB2nE0xZFvlrbmyklzgZtQgKb4zXIZoPAj-MJ1PfSkshV9fp5uLoUdwmitsKQ_0_D4VWZNyKB7JYSFwslhgpSti5A/s400/gobos.PNG" border="0" /></a> <span style="font-size:78%;">Point- and spotlights with gobos<br /></span><br /><div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH9EjBO1dLRJtwqYR9pLHMFcdrfRnjmehxA83_nIxQbkmQZDdz3MDXiZ7Ut1vxaaDnudU-FYjxdvNky76eT9jIIiRvbfs62kdSeO-jVV2TyFEeHnzJKMXE_-kBzWEfnxvonXqCBg/s1600-h/gobos2.PNG"><img id="BLOGGER_PHOTO_ID_5153868642224012498" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH9EjBO1dLRJtwqYR9pLHMFcdrfRnjmehxA83_nIxQbkmQZDdz3MDXiZ7Ut1vxaaDnudU-FYjxdvNky76eT9jIIiRvbfs62kdSeO-jVV2TyFEeHnzJKMXE_-kBzWEfnxvonXqCBg/s400/gobos2.PNG" border="0" /></a> <span style="font-size:78%;">Lots of lights! All cast shadows and some use gobos.</span><br /><br /></div></div>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-48773667537767931642007-11-29T17:06:00.000+01:002007-11-29T17:41:04.068+01:00<strong>Light volumes and more</strong><br /><br />I've not been able to work much on the engine the last week since I've been busy with school projects.<br /><br />Some things have been done though. I've updated the deferred rendering system to work with light volumes instead of full-screen quads. This alone provides a huge speedup as long as the lights are reasonably small. This also made me think about light attenuation. Funny enough, <a href="http://www.gamedev.net/community/forums/topic.asp?topic_id=474015">this thread</a> at gamdev popped up today. As discussed in the thread, I also wanted to find a way to set a maximum radius for a light, without affecting its atenuation too much. After some playing around with Maple, I found that max(0, 1-1/maxRadius*x)/(1+k*x^2) does the job quite good (this function is suggested in the thread) . I implemented it in my lighting shaders and the result is fine. I also took the opportunity to shave of a few instructions.<br /><br />Here are some screens:<br /><br /><p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhARreYn9gBsiXJVRuIJR2Mo8jki54-jQBF1AvJZDOHolSO9n2v_zeJ2rZ39uDXrQnnSohbZDWXSmYFXJSDju__OWJGNroOqQf5J9cM4nn0yzA729svrer4AAvimqeIrER-eG7l8g/s1600-h/lights.PNG"><img id="BLOGGER_PHOTO_ID_5138300206528474242" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhARreYn9gBsiXJVRuIJR2Mo8jki54-jQBF1AvJZDOHolSO9n2v_zeJ2rZ39uDXrQnnSohbZDWXSmYFXJSDju__OWJGNroOqQf5J9cM4nn0yzA729svrer4AAvimqeIrER-eG7l8g/s400/lights.PNG" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-HIqym1Q-mHjaDq3l1IjA5VTxvxxqqSXCACZLmkd1wzhOgKFvJ_GRgfUBMSni7oIPH4dBZw83G2m79BrHYDA6wbOLfJAHs5FgsIZUdrgN0c1vjtBaCKs94u9rfFLniP2KGVGWUg/s1600-h/100_plus_lights.PNG"><img id="BLOGGER_PHOTO_ID_5138299961715338354" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-HIqym1Q-mHjaDq3l1IjA5VTxvxxqqSXCACZLmkd1wzhOgKFvJ_GRgfUBMSni7oIPH4dBZw83G2m79BrHYDA6wbOLfJAHs5FgsIZUdrgN0c1vjtBaCKs94u9rfFLniP2KGVGWUg/s400/100_plus_lights.PNG" border="0" /></a><br />In the second shot there is 100+ lights. As you can see, the point lights does not cast shadows yet. I will also need to implement a 64 bit HDR pipeline as I get oversaturation and banding artifacts. </p><p>I've also ordered a AMD HD3870. While slightly slower than the Nvidia 8800GT, it's slightly cheaper and most importantly: it's <em>available</em> ;)</p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-84702384344748978182007-11-20T12:51:00.000+01:002007-11-20T13:14:40.683+01:00<strong>Eliminating noise</strong><br /><br />The last couple of days I have tried to reduse the noise in the SSAO output. It proved to be a hard problem. My initial attempt was to simply apply a separable gaussian blur. It produced a nice, smooth image. But as I expected it resulted in ugly halos around object edges when combined with the albedo term. Next I tried to combine the gaussian with some edge detection trickery. Looked kind of cool, but unfortunally it just reduced the halos and did not eliminate them.<br /><br />Then I turned to bilateral upsampling (<a href="http://levelofdetail.wordpress.com/2007/11/01/image-based-proxy-accumulation-for-real-time-soft-global-illumination/">see Jeremy Shopf's blog</a>). Eliminated halos, but the SSAO input was way to noisy for simple bilinear filtering. My last atempt was a combination of a box blur and a variant of bilateral filtering. The result is acceptable. I'm not satisfied, but it will do for now.<br /><br />Next up is some speed optimizations and then I'm on to indirect lighting. <br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK2sVi0mObpDpvWSpj4BhVbenDv39R_RVKvCE2Eb4Am4mlv_hXh-TQSYgvsxs86vuq2Lm4Qo5rCJvJr7KHBsiCP0l63525iHU-RNG3QO6HreZPUYl9drBkM2_SeqaZA_iyQtkolg/s1600-h/ssao_direct_filtered.PNG"><img id="BLOGGER_PHOTO_ID_5134889237903947442" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK2sVi0mObpDpvWSpj4BhVbenDv39R_RVKvCE2Eb4Am4mlv_hXh-TQSYgvsxs86vuq2Lm4Qo5rCJvJr7KHBsiCP0l63525iHU-RNG3QO6HreZPUYl9drBkM2_SeqaZA_iyQtkolg/s400/ssao_direct_filtered.PNG" border="0" /></a> <div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAKDwuURaUOObWK0zZjBp-rHCb5JgC1CcdicarAU6Xpl3ku4sAb3Vnt99gnqIgLHinDr_74nq_Z2SZ8jY3C8neT-qDuMCOTd9r7AHWBvE-7hEyGKY3YZ3Oc-9ERWrNSs_dFC7hyphenhyphenw/s1600-h/ssao_filtered.PNG"><img id="BLOGGER_PHOTO_ID_5134889087580092066" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAKDwuURaUOObWK0zZjBp-rHCb5JgC1CcdicarAU6Xpl3ku4sAb3Vnt99gnqIgLHinDr_74nq_Z2SZ8jY3C8neT-qDuMCOTd9r7AHWBvE-7hEyGKY3YZ3Oc-9ERWrNSs_dFC7hyphenhyphenw/s400/ssao_filtered.PNG" border="0" /></a> <span style="font-size:78%;">SSAO + "bilateral filtering"-hack</span><br /><br /></div>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com0tag:blogger.com,1999:blog-19919004.post-15694650621940951472007-11-13T15:14:00.000+01:002007-11-13T15:51:06.768+01:00<div align="left">I've been playing around with screen-space ambient occlusion (SSAO) today, one of the AO-techniques used in Crysis. It's not trivial to get it to look good. I use the randomized normal trick described in the Crytek paper but I only sample on a hemisphere around the pixel normal to avoid self occlusion. I need to optimize the shader quite a bit, but so far this is just an evaluation of the technique and I'm quite pleased with the initial results.<br /><br />Mandatory screenshots: </div><div align="center"><span style="font-size:78%;">SSAO Only:</span></div><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMiPjOmhWsXCiO5kEvIbRwbailP4LrKaeTgubrgNz-D1vHgcgZ5qgPNjPu5hDe3h1AID_pyalUdEdWDbzUacWDFh4ftr7aXCOBkX8NgCzxXNm2cyc1hHXz9WXYHqttEJGT8C0Dw/s1600-h/ssao_raw.PNG"><img id="BLOGGER_PHOTO_ID_5132336438384499714" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMiPjOmhWsXCiO5kEvIbRwbailP4LrKaeTgubrgNz-D1vHgcgZ5qgPNjPu5hDe3h1AID_pyalUdEdWDbzUacWDFh4ftr7aXCOBkX8NgCzxXNm2cyc1hHXz9WXYHqttEJGT8C0Dw/s400/ssao_raw.PNG" border="0" /> <p align="center"></a> <span style="font-size:78%;">SSAO + direct lighting</span><br /><br /></p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKGOIjzIyIXtYDSXlH6mgKrD3PMddJR4IRN-PZ3IB78nfq0-_zaF-U9XN5muDvPlrt62KyX9aOkBpxsuJg0CSStWQ37joN653pqxCPcTPG17CUc5ClkBSCn4tQporVI970ptPGEw/s1600-h/ssao_combined4.PNG"><img id="BLOGGER_PHOTO_ID_5132336610183191570" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKGOIjzIyIXtYDSXlH6mgKrD3PMddJR4IRN-PZ3IB78nfq0-_zaF-U9XN5muDvPlrt62KyX9aOkBpxsuJg0CSStWQ37joN653pqxCPcTPG17CUc5ClkBSCn4tQporVI970ptPGEw/s400/ssao_combined4.PNG" border="0" /></a> <a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHTNfAYhYaIqLvzl5jbNFlyVufR5_nomyYAc50ODfk-r8mwk0YNIZamyuxpcGBw4Gax3GThyphenhyphenM1HgsdE_H3kXtkTTOnO8eRsRswzTcpU0LmO7NDx7dPv_FRsZyMN7F07DXNOAtAEg/s1600-h/ssao_combined2.PNG"><img id="BLOGGER_PHOTO_ID_5132336799161752610" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHTNfAYhYaIqLvzl5jbNFlyVufR5_nomyYAc50ODfk-r8mwk0YNIZamyuxpcGBw4Gax3GThyphenhyphenM1HgsdE_H3kXtkTTOnO8eRsRswzTcpU0LmO7NDx7dPv_FRsZyMN7F07DXNOAtAEg/s400/ssao_combined2.PNG" border="0" /></a>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-65202918564100572982007-11-09T16:30:00.000+01:002007-11-09T16:36:56.051+01:00Wheee! Shadows!<br /><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_eQVPX_8Ei5QohYRDQsyD8HRmB5w1useVmJc8CuRrtvT6D9Anqg8AO76ZHFfJ2LijkVWh3UTnrW66UN7BJxR4fQoSQ3IGmwzUs2l1cUoTfm1kjaGCqZSOKs8XsXDZ08Wr9VllPg/s1600-h/nebulax_shadows2.PNG"><img id="BLOGGER_PHOTO_ID_5130864428538108834" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_eQVPX_8Ei5QohYRDQsyD8HRmB5w1useVmJc8CuRrtvT6D9Anqg8AO76ZHFfJ2LijkVWh3UTnrW66UN7BJxR4fQoSQ3IGmwzUs2l1cUoTfm1kjaGCqZSOKs8XsXDZ08Wr9VllPg/s400/nebulax_shadows2.PNG" border="0" /></a></div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaVI8NLYtgQx_611rD96T9mDavxbMeGDqllzaIyTS5gfcQKParNERhowX9ZL-9bYo10NG6rkAGkcEzdelyMi0-coguAPTKXs39Lztgxv1wsL7b2ZhE5pcVifAnPcC9OH7K58VQQg/s1600-h/nebulax_shadows.PNG"><img id="BLOGGER_PHOTO_ID_5130864561682095026" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaVI8NLYtgQx_611rD96T9mDavxbMeGDqllzaIyTS5gfcQKParNERhowX9ZL-9bYo10NG6rkAGkcEzdelyMi0-coguAPTKXs39Lztgxv1wsL7b2ZhE5pcVifAnPcC9OH7K58VQQg/s400/nebulax_shadows.PNG" border="0" /></a>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com0tag:blogger.com,1999:blog-19919004.post-63041056134204641822007-10-24T21:32:00.000+02:002007-10-24T22:44:56.618+02:00<strong>First screenshots of NebulaX</strong><br /><br />I have been working on my new engine for some months now and I thought it was time to start blogging again.<br /><br />Here are some random facts about the new engine:<br /><br />* Complete rewrite of my old engine.<br />* Despite its name and contrary to my previous posts: it's 100% API-independent.<br />* Only XNA 1.1 renderer at the moment<br />* Pluggable rendering pipeline, but only deferred shading pipeline atm.<br />* DXEffect-like effect system based on XML<br />* Shader language independent, only HLSL impl. atm.<br />* "Super-shader"-style effects for generating shader permutations<br />* Post-processing framework<br />* Pluggable scene management system<br />* Pluggable mesh import pipeline, only COLLADA support atm.<br />* Optimized math library<br />* Everything is witten in C# execpt the math lib witch is written in C++/CLI.<br />* <strong>Zero</strong> GC collections during runtime!<br /><br />Sounds like marketing bull, and it is:) There's quite a few places in the code that needs to get cleaned up but this is work in progress.<br /><br />Below is some screenies showing some deferred shading tests.<br />One point light and 5 colored spot lights.<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFa25LVZ8zNndTSZ-hpxLEy2Y7cAtXuEti_z3dO6nFhQsjK1bQxqF-3I0piTRFfcaVzMtJYt9EK4vCOxVoW5AJ0hbxNxHoX-ACqaxSlRM_Qq0shnwhoTAdHpcIuoA1F4VsUjPG0A/s1600-h/deferred2.jpg"><img id="BLOGGER_PHOTO_ID_5124996399005225938" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFa25LVZ8zNndTSZ-hpxLEy2Y7cAtXuEti_z3dO6nFhQsjK1bQxqF-3I0piTRFfcaVzMtJYt9EK4vCOxVoW5AJ0hbxNxHoX-ACqaxSlRM_Qq0shnwhoTAdHpcIuoA1F4VsUjPG0A/s320/deferred2.jpg" border="0" /></a><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeVgkeJPdM0zJZldOP86g-87TOSVY-mtXk4nOs1dVXEqmIwj5X4F33xY8bdzxUcPQlhdFZrjJUqv-hXgtDMhQX7KJLcvbAvTInnXJ9SZ_dqqr1iYOt8wfGF2BwNQq1TjeVpMoXFw/s1600-h/deferred3.jpg"><img id="BLOGGER_PHOTO_ID_5124997197869143010" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeVgkeJPdM0zJZldOP86g-87TOSVY-mtXk4nOs1dVXEqmIwj5X4F33xY8bdzxUcPQlhdFZrjJUqv-hXgtDMhQX7KJLcvbAvTInnXJ9SZ_dqqr1iYOt8wfGF2BwNQq1TjeVpMoXFw/s320/deferred3.jpg" border="0" /></a>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-16043312670915499682007-03-01T19:06:00.000+01:002007-03-01T19:47:44.471+01:00<strong>Update at last</strong><br /><strong></strong><br />I realize I'm one lazy blogger. I'm not even sure I'm <span class="blsp-spelling-corrected" id="SPELLING_ERROR_0">allowed</span> to call this a blog with these infrequent updates:)<br /><br />Anyway, in my last post I mentioned that I might release some code for my GUI system. Sorry, won't happen anytime soon. The reason?<br />The usual. School eating up my time.<br /><br />I'm taking a course in <a href="http://www.cs.lth.se/DAT032/">AI</a>. And it has turned out to be one of the best courses I've taken so far.<br />The first assignment was to implement a <a href="http://en.wikipedia.org/wiki/Draughts">Checkers </a>program, and to be approved we had to enter a tournament. I teamed up with <span class="blsp-spelling-error" id="SPELLING_ERROR_1">Jesper</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_2">Ek</span> (again) and Jacob <span class="blsp-spelling-error" id="SPELLING_ERROR_3">Persson</span> and we set out with a <span class="blsp-spelling-corrected" id="SPELLING_ERROR_4">reasonable</span> goal: to win the competition.<br /><br />And that <a href="http://www.it.lth.se/courses/tai/2007/assignment1/results.stm">we did</a>.<br /><br />Our program, Black Doctor, won six games in a row but <span class="blsp-spelling-corrected" id="SPELLING_ERROR_5">unfortunately</span> lost the last one. That was enough to win the tournament, however.<br /><br />Some info about the program:<br />* Written in C++, <span class="blsp-spelling-error" id="SPELLING_ERROR_6">multi</span>-platform<br />* <span class="blsp-spelling-error" id="SPELLING_ERROR_7">Bitboard</span> representation of game board.<br />* Alpha-Beta (iterative + recursive) and <span class="blsp-spelling-error" id="SPELLING_ERROR_8">MTD</span>(f) searching<br />* Transposition table<br />* <span class="blsp-spelling-error" id="SPELLING_ERROR_9">Quiescense</span><br />* Dynamic time management<br />* Simple opening book and endgame database (3-pieces)<br />* ~1M nodes/sec on a 1.7MHz Pentium M<br /><br />No screenie this time. Console UI's just aren't that sexy...Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-64675873977297585502006-12-14T22:09:00.000+01:002006-12-14T22:31:16.117+01:00<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFHjTsYfdgGtzFAuiLQM3h0m-2x-QWornWRfrJZoyNc8w-T2NngvQBaIN6jCRNEtySdModyX5t4W5_6WcNUzr0tQCsTS706KwdXnT5Vk0RGwSTMI8jeGq3Wu5Ia-xTNhyphenhyphenjDeySow/s1600-h/xnagui.jpg"><img id="BLOGGER_PHOTO_ID_5008498104263102194" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFHjTsYfdgGtzFAuiLQM3h0m-2x-QWornWRfrJZoyNc8w-T2NngvQBaIN6jCRNEtySdModyX5t4W5_6WcNUzr0tQCsTS706KwdXnT5Vk0RGwSTMI8jeGq3Wu5Ia-xTNhyphenhyphenjDeySow/s320/xnagui.jpg" border="0" /></a><strong>Going <span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">sloooow</span>.<br /><br /></strong><div></div><div><strong></strong></div><div><strong></strong></div><div><strong></strong></div><div>Since I just have a few hours a week to spare for engine coding, not much is happening <span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)">atm</span>. I simply have too much in school.<br /><br /></div><div></div><div></div><div></div><div>That said, at least I'm doing <em>some </em>progress:)</div><div>I have a nice and flexible GUI system up and running. It works pretty much like the usual <span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)">winforms</span> stuff (or any other GUI:)) and I have the most common controls implemented.</div><div></div><div></div><div></div><div>It's fully <span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)">skinnable</span> and easy to customize and extend. Since I'm too lazy for drawing my own skin, I "<span class="blsp-spelling-corrected" id="SPELLING_ERROR_4">borrowed</span>" a texture from <a href="http://www.c-unit.com/">this</a> guy:)</div><div></div><div></div><div></div><div></div><div><br />I plan to add some more stuff (including 360-controller support) and polish the <span class="blsp-spelling-corrected" id="SPELLING_ERROR_5">code and</span> make this public with source and all. Probably some time after Christmas.</div><div></div><div></div><div></div><div></div><div><br />Hopefully they don't add GUI support to XNA too soon. Would make all this pretty pointless ;)</div>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-74765867613125806082006-11-09T19:39:00.000+01:002006-11-09T19:58:57.928+01:00I have begun coding on my new engine, entitled <span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"><span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">NebulaX</span></span>.<br />Today I threw together a simple text rendering component and started working on a complete GUI library. Most stuff is directly ported from my old engine and altered to fit the pretty cool game component and content pipeline stuff in <span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"><span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)">XNA</span></span>.<br /><br />I've <span class="blsp-spelling-corrected" id="SPELLING_ERROR_2">also</span> got myself a <span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"><span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)">XBox</span> </span>360 <span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"><span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)">gamepad</span></span> for my PC. Need that to test my input code.<br /><br />A few days ago I found a cool open source project: <a href="http://www.taoframework.com/Mono.Xna">Mono.<span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)">XNA</span></a>, witch is going to be an implementation of <span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)">XNA</span> using <a href="http://www.mono-project.com/Main_Page">Mono</a> and <a href="http://www.taoframework.com/Home">Tao</a>.<br /><br />So, all you "I-use-C++-instead-of-C#-since-I-want-platform-independence" people, stop whining and start using 21<span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)">th</span> century technology:)Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-51383869929632144452006-10-23T12:22:00.000+02:002006-10-23T13:19:05.471+02:00<strong>Long time, no see.. <span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)">erhm</span>.. update.</strong><br /><br />I haven't worked on the engine for quite some time now. I've had lots of other stuff to do.<br />This semester I've taken a course in <a href="http://www.cs.lth.se/DAT075/">mobile computer graphics</a>. A really great course that have given me a lot of useful knowledge about graphics hardware.<br /><br />In course we had to do a mobile game project using the M3G (<span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)">JSR</span>-184) Java API, and once again I teamed up with <span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)">Jesper</span> <span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)">Ek</span>. We decided to do something different and we ended up doing a <span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)">OpenGL</span> accelerated J2SE implementation of M3G. There was a competition to award the greatest game. We obviously didn't win, since we didn't make a game:) We received a Technical Achievement Award, however. The jury consisted of people from the industry, including folks from <a href="http://www.sonyericsson.com/">Sony <span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)">Ericsson</span></a>, <a href="http://www.tat.se/">TAT</a> and <a href="http://graphics.cs.lth.se/"><span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)">LUGG</span></a>.<br /><br />You can check out the project <a href="http://www.0xdeadbeef.se/m3g/">here</a>, and the other game entries <a href="http://www.cs.lth.se/DAT075/project/">here </a>(some are really cool!).<br /><br /><strong>What about my engine then?</strong><br /><br />It's discontinued. Yep. Discontinued.<br /><br />I have decided to not develop it any further and instead start on a completely new engine using Microsoft <span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)">XNA</span>!<br /><br />My old engine was 100% graphics API independent and that's <span class="blsp-spelling-corrected" id="SPELLING_ERROR_8">of course</span> a good thing. However, <span class="blsp-spelling-corrected" id="SPELLING_ERROR_9">being</span> a single developer with very little spare time, that resulted in slowing down the project considerably. By selecting only one API, I will be able to speed up the <span class="blsp-spelling-corrected" id="SPELLING_ERROR_10">development</span> and focus on the cool stuff.<br /><br /><span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)">XNA</span> is <span class="blsp-spelling-corrected" id="SPELLING_ERROR_12">of course</span> the obvious <span class="blsp-spelling-corrected" id="SPELLING_ERROR_13">choice</span>.<br />It still lacks some important <span class="blsp-spelling-corrected" id="SPELLING_ERROR_14">functionality</span>, but I'm very <span class="blsp-spelling-corrected" id="SPELLING_ERROR_15">confident</span> that that will be addressed when it's finally released. <span class="blsp-spelling-error" id="SPELLING_ERROR_16" onclick="BLOG_clickHandler(this)">Micsosoft</span> seems very serious about <span class="blsp-spelling-error" id="SPELLING_ERROR_17" onclick="BLOG_clickHandler(this)">XNA</span> and I think it has a bright future.<br /><br />And yeah, I've "upgraded" to the new <a href="http://beta.blogger.com">Blogger beta</a>, so I changed to a new blog template. Sweet.Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-1150575226670386002006-06-17T22:06:00.000+02:002006-10-23T12:04:03.605+02:00<a href="http://photos1.blogger.com/blogger/3231/1981/1600/refraction.jpg"><img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/refraction.jpg" border="0" /></a>Today I added refraction to the water. Pretty standard stuff where the reflection and refraction textures are blended together based on the fresnel term.<br /><br />I've also improved the texturing a bit. If you look at the second image in my last post, you can see that the terrain at "medium" distance from the camera is blurry. I now use yet another detail texture in this region and the result is that the terrain appears to have detail at all distances.Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com5tag:blogger.com,1999:blog-19919004.post-1150227467586312612006-06-13T21:33:00.000+02:002006-10-23T12:04:03.541+02:00<table style="FLOAT: right; MARGIN: 0pt 0pt 10px 10px; CURSOR: pointer" cellspacing="0" cellpadding="0"><tbody><tr><td><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainnormalmap1.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/terrainnormalmap1.jpg" border="0" /></a><br /></td></tr><tr><td><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainnormalmap2.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/terrainnormalmap2.jpg" border="0" /></a><br /></td></tr><br /></tbody></table><p>Well, It has been a while since I had time to work on the engine, but today I had some time left.<br />A few days ago a found a tool called <a href="http://www.bundysoft.com/L3DT/">L3DT</a>. It's a very cool and capable terrain generator and it inspired me to improve the texturing of the terrain.</p><p>Near the camera I use the same splatting technique as before but the textures are tiled at a much higher density so the ground look really highly detailed even if you look straight down. This ofcourse causes ugly repetition patterns further away. To hide this I blend in a large (1024x1024) color texture on terrain far from the camera.</p><p>I've also changed from vertex lighting to a normal map. This makes the lighting independent of the LOD and reduces popping artifacts. It also makes the distant terrain look more detailed.</p><p>I use L3DT to generate all texture data I need, since it does that a lot better than my own hack;)</p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com0tag:blogger.com,1999:blog-19919004.post-1148672885378287802006-05-26T21:38:00.000+02:002006-10-23T12:04:03.424+02:00<a href="http://photos1.blogger.com/blogger/3231/1981/1600/shadows.jpg"><img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/shadows.jpg" border="0" /></a> Well, Jesper and I have finished the final assignment in the ASR course. This time it was about shadows.<br /><br />We implemented both shadow mapping and z-fail shadow volumes. All done on the GPU. The geometry needs to be preprocessed for shadow volume extraction to work entirely on the GPU.<br /><br />The shot shows "soft" shadow mapping with 3x3 PCF.<br /><br />Nothing special, but I have to fill my blog with something when I don't have time to work on the engine:)<br /><br />Btw, my lecturers got their paper <a href="http://graphics.cs.lth.se/research/papers/hdrtexture2006/">"High Dynamic Range Texure Compression For Graphics Hardware"</a> accepted to SIGGRAPH 2006. Really sweet stuff!Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com0tag:blogger.com,1999:blog-19919004.post-1147776361881840242006-05-16T12:35:00.000+02:002006-10-23T12:04:03.363+02:00<a href="http://photos1.blogger.com/blogger/3231/1981/1600/oceanwater.0.jpg"><img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/oceanwater.0.jpg" border="0" /></a> Well, I'm back from India. It was a great vacation and it feels a bit strange to be home, but I guess it's time to get back to normal life.<br /><br />The image is a shot from an ocean water simulation I did for an assignment in the ASR course. It features two superpositioned Gerstner waves calculated in a vertex shader.<br /><br />In the pixel shader I use three scrolling normal maps to add fine detail to the water. There's also cubemap reflection and refraction with fresnel terms. Finally there's a simple HDR hack to add some shininess to the highlights.<br /><br />When I have time to work on the engine, I'll probably update the water with a similar approach.Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com2tag:blogger.com,1999:blog-19919004.post-1145679385921244422006-04-22T06:07:00.000+02:002006-10-23T12:04:03.281+02:00As some might have noticed, I haven't updated the blog for some time now. The reason is that I'm on vacation in India with my girlfriend. I'll be staying here for three weeks so there will be no coding for a while:)<br /><br />I just wanted to thank everybody who have left comments and sent me email. It's very encouraging and makes me want to keep on going!<br /><br />In a few hours we're leaving for Kerala. It's supposed to be a real paradise and I think we'll have a great time!Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com0tag:blogger.com,1999:blog-19919004.post-1144666349577216232006-04-10T12:41:00.000+02:002006-10-23T12:04:03.208+02:00<a href="http://photos1.blogger.com/blogger/3231/1981/1600/grass1.jpg"><img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/grass1.jpg" border="0" /></a>Yesterday I did a quick test of grass rendering.<br />The grass waves slowly in the wind and is rendered as thousands of camera facing billboards. The nice thing is that everything is done on the GPU. The billboards are stored in one single static vertex buffer and the transformation to face the camera and the animation is done in a vertex shader.<br />I'm also using a neat trick to "fade" the grass out over distance without the need of alpha sorting.<br /><br />It's not that good looking right now, but it's just a quick test. Putting it on real terrain with more variation of foliage and good texturing and lighting will hopefully make it look better.Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com4tag:blogger.com,1999:blog-19919004.post-1144375350042434162006-04-07T03:44:00.000+02:002006-10-23T12:04:03.129+02:00<p>I got stuck when trying to redesign my engine to better support materials that depend on multiple render passes. So I started working on a cloud system instead:) </p><p>The system if fully dynamic and the clouds move and deform. The lighting is a (rather) simple trick but looks quite nice. I got the basic idea from an article by Michael Gehling in last months GDMag. I just modified it to suit my needs. The main problem I have is that it's very hard to tweak the system to look good in all situations. Settings that look good at dawn look crap at noon and vice versa. But I think I can solve that by interpolating settings over the day-night cycle.</p><p>Another problem is that things are getting rather costly as you can see on the fps counter:) So far I've done no optimizations what so ever so I think I can squeeze quite a few more fps out of this baby.</p><p>Here's a few new screenshots:</p><p><a href="http://photos1.blogger.com/blogger/3231/1981/1600/clouds1.0.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/clouds1.0.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/clouds4.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/clouds4.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/clouds2.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/clouds2.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/clouds3.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/clouds3.jpg" border="0" /></a> </p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-1144180392865841742006-04-04T21:38:00.000+02:002006-10-23T12:04:03.071+02:00<table style="FLOAT: right; MARGIN: 0pt 0pt 10px 10px; CURSOR: pointer" cellspacing="0" cellpadding="0"><tbody><tr><td><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/water1.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/water1.jpg" border="0" /></a><br /></td></tr><tr><td><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/water2.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/water2.jpg" border="0" /></a><br /></td></tr><br /></tbody></table><p>I've added water to the engine. So far there's only reflections but refractions are coming up.</p><p>Now I need to render the scene multiple times per frame. The geometry that is going to show up in reflections is first rendered to a texture. This texure is then used in a second pass where the scene is rendered as normal but the reflection texture is projected onto the water plane. The same has to be done for refractions. The reflection pass is done with a lower LOD setting to increase speed, and the distortion of the water makes it very hard to notice the decreased LOD anyway.</p><p>I'm not totally happy with the way these multiple render passes are handled by the engine, so I think I have to redesign a bit. That's why I left out refractions for now.</p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com5tag:blogger.com,1999:blog-19919004.post-1144079986309636612006-04-03T17:44:00.000+02:002006-10-23T12:04:02.979+02:00<table style="FLOAT: right; MARGIN: 0pt 0pt 10px 10px; CURSOR: pointer" cellspacing="0" cellpadding="0"><tbody><tr><td><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/pathtracer1.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/200/pathtracer1.jpg" border="0" /></a><br /></td></tr><tr><td><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/3231/1981/1600/pathtracer2.jpg"><img style="FLOAT: right; MARGIN: 0pt 0pt 0px 0px; CURSOR: pointer" alt="" src="http://photos1.blogger.com/blogger/3231/1981/200/pathtracer2.jpg" border="0" /></a><br /></td></tr><br /></tbody></table><p>For the second assignment in the <a href="http://www.cs.lth.se/DAT135/">ASR </a>course we took a dive into the beautiful world of Global Illumination. <p>We had to write a Monte Carlo path tracer. The math is a bit involved but it all boils down to a very simple algorithm. Take a loot at <a href="http://www.cs.lth.se/DAT135/lectures/L3.pdf">this slide</a> for more information. <p>What you gain in simplicity you loose in speed. Since we approximate the rendering equation with random sampling (Monte Carlo integration) we need to sample a lot to reduce noise. The first image was redered at a resolution of 1024 x 1024 with 625 samples per pixel. It took 72 minutes to complete. The second one uses 2304 samples per pixels and took about 6 hours to render:) <p>I really like the second image. Note the caustics formed by light passing through the glass objects. Quite pretty! Kudos to Jesper for setting up that scene!</p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-1143681124199793582006-03-30T03:01:00.000+02:002006-10-23T12:04:02.915+02:00I've completed the atmospheric scattering implementation, and now the terrain is also affected by the scattering. Here's a few screenshots:<br /><br /><p><a href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainsky_2.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/terrainsky_2.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainsky_1.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/terrainsky_1.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainsky_3.0.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/terrainsky_3.0.jpg" border="0" /></a><br /><a href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainsky_4.jpg"><img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/3231/1981/400/terrainsky_4.jpg" border="0" /></a></p>Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1tag:blogger.com,1999:blog-19919004.post-1143586361050737832006-03-29T00:37:00.000+02:002006-10-23T12:04:02.848+02:00<a href="http://photos1.blogger.com/blogger/3231/1981/1600/terrainsky1.0.jpg"><img style="FLOAT: right; MARGIN: 0px 0px 10px 10px; CURSOR: hand" alt="" src="http://photos1.blogger.com/blogger/3231/1981/320/terrainsky1.0.jpg" border="0" /></a> I'm working on a fully dynamic sky system. It's far from finished but I couldn't resist uploading a teaser screenshot:)<br /><br />The system simulates atmospheric scattering, i.e. the effect of sun light scattering in different directions as it hits particles in the atmosphere.<br />This is what makes the sky blue at noon and red at dawn.<br />The method is described in <a href="http://www.ati.com/developer/dx9/ATI-LightScattering.pdf">this paper</a>.<br /><br />The sun in the picture is not a skybox or a billboard. It's a direct result of the scattering simulation!<br /><br />I'll get back with more info as soon as I get this working perfeclty.Jonas Risbrandthttp://www.blogger.com/profile/09524984329026113339noreply@blogger.com1