Finally an update! I was busy with university stuff, so my project was on hold. However now that it is all done, I have more time to spend on it.

Video is at the bottom of this post if you do not want to read all the stuff :| .

Deferred Shading

I have implemented basic deferred shading, which seems to work well, but it still requires some extra work for specular settings (at the moment it is same for everything). I have implemented directional, spot and point/omni lights which look pretty good, but still need some adjustments for light emitting objects (when a small object encapsulates the light source, it is not lit since it is facing away from the light). Currently only directional light (sun at the moment) has shadow, which still requires additional work to make sure it properly covers visible area to maximize shadow coverage, which would allow to use smaller resolution shadow map or have higher quality shadows or improve distance from which shadows can be see. I have a plan how to do shadows for spot/omni lights as well, which should not be too hard since even though environment can be completely changed, it is easy to take only the blocks in range of the light, which should make rendering shadow maps quite fast.

Screen Space Ambient Occlusion (SSAO)

After implementing Deferred Shading, I have completely removed all baked lights (which I had 4 channels of) since now I can have any amount of any colour lights, that also removed the baked AO. However with new shading it makes easier to implement SSAO which has one big advantage, it works on any shape geometry, which means rebuilding terrain meshes is faster, also they take less memory since light data is no longer required (blocks themselves also take less memory now). It still requires some adjustments since at the moment it is too strong on light objects and too weak on dark ones.

Post processing

I have also added a simple bloom effect, which looks nice on sky however it does not bleed enough light to look the way I want it to look, but over all I am happy with it.


Water… Still requires a lot of work since transparent objects are not supported in Deferred Shading, lights and shadows do not show up (since water is rendered after the lights pass, in a forward rendering part of the pipeline). However I think with the use of g-buffer it should be possible to create an easy refraction effect (maybe even reflection) to make the water look better, that of course goes for ‘static’ water at the moment.

I have been working on the liquid simulation a tiny bit once in a while, but now there is something that I can actually show. Water is simulated using Cellular Automata approach, which has its own advantages and disadvantages: it is fast to calculate, works with any type, since it requires only block itself and its neighbours also it reaches a stable state which is important since having water simulated all the time would probably kill the frame rate, however that comes with a disadvantage, since liquids are integer based for less memory usage, it is not possible to evenly split odd amounts of water to even amounts of blocks. Simulation needs to take that into consideration, which means there is a safeguard that does not allow liquid to flow if the water difference is only 1 unit, that results in a “Stair” problem when water is |5|4|3| when it could spread evenly to |4|4|4|. I managed to reduced the steepness of the stairs, but completely removing would require a lot more complexity (for example evaluating higher area around each block, using path finding to find possible outflow points). At some point I will try path finding based approach on a slightly higher area (well if it works for Dwarf Fortress it should work for me, right? — famous last words).

Next Steps

I am pretty happy with the graphical side at the moment, except the fact that Deferred Shading, SSAO, Post Processing highly reduces the frame rate and DirectX’s present() method blocks the loop for 8-12ms each frame, which I could spend simulating water, loading blocks, and doing other stuff (and the non blocking wait flag is not supported until DX11 and Win8 :( ). That means next I will be looking into threads… which I was avoiding since have bugs in a single thread is annoying enough and concurrent bugs are just some much more painful.

Also since graphics are now taking vast majority of the frame rate, priority queue for updating segments/blocks near the player is required. Or maybe even queue system overhaul and upgrade to thread support might be even better idea.

Oh yea I still need to implement better support for skylight and per column data (which requires a quadtree in addition to the octree), even though I am not using it for lighting the scene, it most likely will be required for game play mechanics.


Leave a Reply

Your email address will not be published. Required fields are marked *