It is currently Mon Jun 01, 2020 12:03 pm


Get the latest news here.
  • Author
  • Message
User avatar


Site Admin

  • Posts: 40
  • Joined: Wed Mar 05, 2014 7:52 am


PostSun Aug 17, 2014 11:11 am

So, its been quite some time since my last update, I'm still working with dbp and the advanced lighting has had some updates but not much else has been worked on.

Old forum became corrupted, but can be viewed here

Advanced lighting

So the advance lighting system is still work in progress, and I've added some stuff over the last year so I'm going to list what I've added and whats left to be done.

Whats been implemented

Terrain - probably the most notable thing I've added. The terrain is completely new and different to my old LOD terrain that used segments. I'm now using a grid that is placed to the camera then displaced using vertex texture look up. There were a lot of problems with seems between LOD stages using this method, it took some time to fix but I've come up with some random method to resolve this issue. Texturing was the next step and I managed to get 4 texture layers via texture splatting working pretty quickly. This unfortunately, with only 4 layers due to texture stage limit made the terrain look very boring and plain. So I set out to find a better way of texturing using an atlas map. The idea is to use a index texture to specify what texture on the atlas map gets applied, Then use a noise map to get rid of the tiling artifacts. But this left sharp transition between textures that resulted in some pretty horrific anti aliasing issues. I did some more messing around with the atlas map idea and decided to try atlas texture splatting. There is some issues with this such as performance as it requires to sample each texture in the atlas map. I made some tweaks in a attempt to improve performance like spiting the atlas in to two textures using eight layers instead of nine layers. I'm pretty happy with what I have at the moment but performance is still an issue, but unsure what I can do about it.

Ocean/Water - So water is in, but at a massive cost to performance. I had to add two more renders to the system for refraction and reflection. I did have some big problems when trying to use my screen space distortion technique as it made the refracting part of which were supposed to be 3d waves look very flat. So I ended up having to add in an additional render that splits the lighting and alpha objects into separate renders. so now there is an additional full screen render added (total 6 now with everything enabled) that gets project back on the water surface for refraction. reflection is another geometry render so there is also a big cost here, geometry is now rendered 3 times (minus shadow maps renders). The water mesh is using the same mesh that the terrain is using, so we get pretty nicely detail waves that have LOD and frustum culling.

3d clouds - This surprisingly was quite simple to add, there is a rendering cost here but its not as bad as I originally thought. They are essentially a series of sphere set to the camera to create a volume. I'm using a 2d texture look up with 4 layers stored in the 4 color channels (originally was using 3d textures with 8 layers, but performance was terrible), with UV/layer set to the vertex XYZ positions to create the actual 3d volume that you see. There are some issues with shimmering particularly when staffing the camera left and right but this is a result of the technique and cannot fix it.

Vertex lighting on alpha surfaces - As alpha surface cannot be added to the lighting system, so I've implement some basic vertex lighting/system to all alpha shaders to help transparent surfaces blend in more.

Lens flare - The post processing lens flare had some issues with additive surfaces, so I decided to remove the post effect and add the old way with sprites.

Some improvements

Particles - The particle system had some issues with load times, I spent quite some time trying to resolve this issue. In the end decided to separate the shader up in to separate techniques. This reduces the shader code, improving the load/compile times. I have also set a limit to how many shaders can be loaded, It took some 60sec to load the old particles sample, with the changes I've made it now take under 10sec.

Motion blur - motion blur has had some improvements also. I can now have up to 50 different ridged objects/limbs on a single effect, where as before I had to have a unique effect per object.

Time of day -time of day no longer needs to use a file, just set the sun angel and every thing updates automatically.

Post processing - post processing has also had some optimization, most of the complex effects such as DOF and motion blur are now done at a much lower resolution.

Other - There are now 4 splits to the directional light, this comes at an obvious cost in rendering but gives much grater range where 3 spits were not enough. Shadowed point light has also had a performance boost by reducing the pixel shader instruction count quite drastically. World position now use a 64bit texture with depth in alpha, the depth reconstruction method I was originally using had some major inaccuracy issues at longer ranges, so I had to drop it.

What still needs to be done

Code overview - I need to go over my entire advance lighting system code including shaders to look where I can make improvements in performance to both shaders and the dbp side of things.

Simple clouds - I need some simple cloud rendering for older hardware where volume clouds may cause performance issues, I can also use this for the reflection render so we can have clouds reflecting on the ocean/water.

Improved specular -I've been thinking of ditching the emissive channel and using it for specular pow control that can be controlled by a texture, just like specular intensity.

Skinned motion blur - This is going to be tricky, bone animation objects have a special bone matrix palette controlled by dx. The only way I'm going to get previous bone matrix palette is to some how save the matrix in to a 16f/32f bit texture, then use vertex texture fetch to reconstruct the bone matrix on the next frame.

Possible Features

Static local reflections - So I'm going to look at possibly using my own reflection method by projecting 6 images to make a cube map from a single large atlas texture. The idea is to setup a series of static reflection nodes in to your environment, Depending on where the vertex is determines what node the surface uses for reflections. This is probably going to be a lot of work to add but this technique with reflection capture nodes has been used in games in for some time now, even half life 2 (with cube/environment maps) has capture nodes.

Contact hardening shadows - So this is something I was working on last year for quite some time. The idea was to use two shadow maps, one crisp with a slight blur the other down filtered with lots of blur then attenuate between two. The result looked surprisingly realistic. I did have a lot of problems with this though. I used log() to get the original depth range (1-0) but due to the post blur apply to the shadow maps, a soft shadow cast wold leek on to hard shadow casters resulting in horrendous light bleeding. I did try a brute force approach with 9x9 summed area vsm but this required to fetch 18 texture samples, 9 for the summed area and a further 9 for shadowing. However I may be able to use a 2x2 approach so 8 sample total which would be more realistic from a performance standpoint.

Directional light shadows on alpha - I want directional light shadows to cast on alpha surfaces including particles, should not be to hard to do and will most likely use only the last two splits for performance reasons.

Transparent shadow casting - Also want alpha surfaces to have the ability cast transparent shadows for the directional light, I will look at having point and spot light cast transparent shadows also but will be much more challenging to do.

map scape v3 (current map scape version is two, the fist map scape was made in dbc)

So this is now my main focus, yes I'm planing on using the advanced lightning sys which is going to make things very difficult. The editor is pretty much going to be the same as map scape, but recreated from scratch. I have implemented the 4 view ports with camera controls so far, you can also scale the view ports like in valve hammer which is something map scape v2 cannot do. there is a lot of work here to do so I have no idea how long this is going to take to create and finish.

Screen shot showing what I've done so far.

I now have some functions that can create geometry objects, which are boxes, wedges, cylinders and cones. Due to the use of the advanced lightning, objects can no longer have faces as limbs. In mapscepev2 when a box is made it has 6 limbs to represent each face. So when a box is made now its a single object, only to be separated in to limbs when a separate texture is applied to a face. I'm also using vertex indexing this time where map scape v2 dose not have as all primitive object were made from memblocks (at the time map scape v2 was made, no vertex data commands were in).

I would like to add proper CSG operations also, I already have my own CSG slice function that can cut the geometry objects in half. This slice function can be reused to do other operations such as carve and hollow out objects.

Objects, entities and terrain will also be in the new map scape, but more info on this will have to come at a later date once I've got geometry objects fully in and working.


  • Posts: 4
  • Joined: Sat Jul 12, 2014 3:32 am

Re: 17/8/2014

PostWed Sep 03, 2014 8:21 pm

This is great news! I'm glad your still working on MapScape. Keep up the good work!
User avatar


  • Posts: 10
  • Joined: Tue Mar 25, 2014 2:04 pm

Re: 17/8/2014

PostThu Sep 18, 2014 9:57 am



  • Posts: 4
  • Joined: Sat Nov 01, 2014 7:53 pm

Re: 17/8/2014

PostSun Nov 02, 2014 1:21 am

Cool! what are you using to create Mapscape V3? C++ or DarkBasic?

Return to Announcements