Saturday, 20 April 2013

Saturday At Play

More Sunshine

Apparently we are getting sun tomorrow as well as today, which is a rare thing for us Welsh-bound souls at the moment so I'm hitting the 'outdoors' every day so far. Right now I am still recovering from a BBQ, and will probably enjoy more sunshine Sunday too!

As promised, I did find time to fire up the PC to do some extra work and once my email was cleared out a had a few gems to play with. Rather that blog about my own coding, I wanted to highlight two DBP coders who will be influencing and perhaps contributing to the Reloaded effort.

Darkest Occlusion

I have just put the finishers on a new Dark Occlusion installer update which takes the current DBP coded system over to a DLL, which means more speed and more security.  I gave the demo a quick run, and boy is it fast. I was going to use the Intel Software Occluder but it's DirectX 11 and will take some untangling. The new Dark Occluder is a serious contender though, and I will be looking at it closer in the days to come:

I plan to run some tests to see how it handles object limbs, and/or large small objects which is what FPSC will throw at it when occlusion is required, but I have a feeling it will fly along very nicely in terms of performance. I gave it 10,000 objects to occlude and it sped along at over 300fps ;) Nice!  If you want to learn more, check out the current version here:

Shameless plug I know, but when your DBP projects start to get into the 'thousands of objects' territory, it's time to bring in the big guns!

Darkest Lighting

I also checked out a link from a blog comment and was impressed with what I discovered at the other end. Evolved is a name many DBP coders will recognise and respect, and he continues to dazzle with his latest Advanced Lighting demo.  Check out his site and the excellent technologies on offer here:

Right now my plan is to write my own unified shader system to combine many of the effects you would expect from Reloaded, by Evolved has produced a great module which seems to do it all. If you have to check out just one of his demos, try the 'Materials' once where you can roam about an interior brick scene. Check out the depth of field, parallax mapping, dynamic shadows and metallic surface shader. All top draw!

Signing Off

I am very careful when it comes to other coders copyright and approvals, so I won't be able to just copy their code and stick it into Reloaded.  Once I have a play, and if it's a good fit, I will tentatively approach the authors to see if I can 'compliment' Reloaded with their excellent technologies.  I am sold on the visuals of the Advanced Lighting and the speed of the Occluder, but like most things in coder land, many planets have to line up before things start to work.


  1. There's only one problem with using Evolved's shaders, and that is that they're very slow. I don't know what it is that makes them slow, they just are. The latest version is a tiny bit faster than some of the earlier versions but it's not enough.

    The Motion Blur demo runs at 50fps on my computer, and that's only a teapot with a directional light. Both the Palm Tree and Materials demos run at a measly 30fps.

    I use a mid-range Acer Aspire laptop. I can run most recent games on low to mid settings, and they all run better than those shader demos and have some pretty awesome lighting effects. Even though Advanced Lighting is free for commercial use, I recommend you write your own, faster lighting system. It'd be easier to integrate too because you will know how it works inside.

    I'm totally with you on using Dark Occlusion, though. Why re-invent the wheel? :)

  2. I did some tests, and there's something very strange going on with Advanced Lighting. I opened the Materials demo in DBPro and started turning off effects to see if any of them were particularly slow to render, but as I turned them off it didn't get any faster. So I assumed the shadow rendering was the slow part. I turned the shadow count per light down to 1 and in some areas that made it run slightly faster, but not much. So I tried turning the shadow map size up to 1024 and the demo ran at 1-2 fps. So I turned it down to 32 and in some areas it ran at a full 60 fps but in others it ran at the same pathetic 30 fps that I get with everything turned on. It's very, very strange.

    I have always loved the idea of having a simple, unified lighting system for DBPro and Advanced Lighting always tried its best but never quite succeeds. I'd avoid it if I were you, or perhaps ask Evolved if he knows what the bottlenecks are.

    I strongly suggest that you should be testing FPSC-R on older machines (with only 1 or 2 cpu cores and 512mb of vram) AS YOU GO, so if you add something that doesn't run well on those machines (such as Dark Occlusion, which may not run well on a machine with only 1 core), you don't find out AFTER you've fully integrated it.

    On a mostly unrelated note, something occurred to me. You should delve into the internal workings of DBPro and see if there's any chance of getting a geometry batching system working. That would be INCREDIBLY AWESOME if it could become part of the official build of DBPro and it would seriously increase rendering speeds of FPSC-R. It's the way modern graphics cards prefer to receive data (in big chunks).

    There are several methods of doing batching, and each method has its drawbacks (hardware batching is my favourite because it's EXTREMELY fast, although not supported on all cards), but any batching is generally faster than no batching at all.

    Of course it depends somewhat on how you handle culling, because if you have one object far to the left and one far to the right and both are in the same batch, then even if the camera is looking between them the bounding box would say they're visible.

    Something to think about, anyway.

    1. Well, I don't think that the aim should be Laptops, as Reloaded should make a step upwards on the graphics side.

      If you try to aim for laptop systems, you are always limited to what is possible.

      One should rather try to give different graphic options, so you can scale on more systems.

      And I'm pretty sure, Evolved knows what to tweak, to get more performance on slower system. ^^

  3. Yes AdvancedLighting might be a bit slow on some older machines.
    On my system it runs perfectly with about 60-80 frames.

    The problem is, that the system needs to calculate a lot of light parts based on a non occluded map, which makes it slow.

    What is needed is some more work into it by Evolved, who knows his code (at least I think so) and maybe some money and even some more DBP Commands to make the process faster.

    I don't think that it's impossible and it would be no good idea, to completly write an own shader system, if the base AL system is what is needed.

    See it like that, if you could get Evolved to heavily increase the performance with some newer DBP tweaks, why invent the wheel again?

    Also the system comes with every shader you can think about and it completly does its job.

    I tried to implement AL into FPSC some months/years ago with a Mod called "LRMod".
    The problem was, that the FPSC object handling did not give me what I needed and in the end I failed because I couldn't get access to all objects the way I wanted.
    But with Reloaded this is another thing.

    The only thing you should be aware of Lee, is that the new version has at least 1 bug which needs to be fixed, which may leave a rendered shadow while the object has already left its position. But this is something Evolved should be aware of (as I pointed that out to him) and will hopefully fix someday :D

  4. @DarkGoblin:

    The aim should not be specifically older computers or laptops. I agree with that. All I'm saying is that, whatever you do with the engine, it must run playably on older machines and laptops. There are ways of achieving this, they just require more work. If you go the easy way and use AL, you get nice graphics will terrible performance. If you put some more effort into it, you can get equally nice graphics with much better performance.

    All I'm saying is that FPSC-R can be made to run really well on all machines but still look great. I hate it when people start saying, "Why support older machines? No gamer is going to have an old computer" when the reality is that MOST gamers have old machines. It's just laziness when you don't put in the effort to support old/laptop computers. Plus, laptops these days have cards (well, chips) that support every feature that desktops cards support, they're just a bit slower than their desktop cousins, so if we can make FPSC-R run well we ARE supporting laptops.


    What kind of system do you have that can run AL at 60-80 fps?

    "The problem is, that the system needs to calculate a lot of light parts based on a non occluded map, which makes it slow."

    But what on earth would make it run slowly with all FS shaders turned off and one shadow per light at 32 size?? The light occlusion/auto-update code must be terribly slow if that's what's causing it.

    "See it like that, if you could get Evolved to heavily increase the performance with some newer DBP tweaks, why invent the wheel again?"

    Well, duh ;) The performance was the only thing I don't like about Evolved's shaders. If they could be made to run MUCH faster, I would be 100% behind using AL; the shaders LOOK brilliant, they just don't perform well.

    I'll do some more experiments with AL and perhaps climb deep inside the internals of the system to see what's slowing it down the most.