Tuesday 15 October 2013

Tuesday Alight

Dynamic Lights Are In

Yesterday was the creation, placement, editing, deletion and control of the AI characters via waypoints. Today was the addition, placement, deletion and shader integration of the dynamic lights.  A particularly popular request for many moons, and thanks to a little infinilight update work and a lot of agonizing, they are now working in the editor and engine.



Before you launch an attack, I 'deliberately' went OTT on the color levels here to illustrate the use of multiple dynamic lights and their reaction against the terrain and entity normal maps. You probably won't see this type of extreme lighting again until we do a SciFi pack, where such two-color styles can really make your levels pop!

Something To Discuss

The system has the natural barrier of only really having a limited number of what I call 'hardware' lights. That is, only three lights actually exist inside the shaders, but the engine can make use of them to create the impression of many more lights in the scene.  The downside is that the user has to place them and space them so the light transition as you move about does not look too jarring. I know you want infinite lights in the engine, but trying writing a shader that can accept 10 or 20 lights, for each pixel rendered by that shader, and you will come to know what performance hit really means.  I have started with three fixed lights as that is enough to demonstrate the infinilight system and a good starting point for discussion. I also don't want to go ape just before performance tuning so a sensible number had to be selected, and three allows two lights to always be in force, and a third light allows the transitional play of the third and forth closest light to the camera.

One really cool byproduct of 'real-time everything' is that when you place the light down in the editor, it actually lights everything as it would in the real game, and the effect of the normal maps against the dynamic lights is something to behold!  I think you will like!

Other Visual Touches

Our artist Mark came through for you guys again and went ahead and improved the bloom shader to include SSAA (screen space anti-aliasing), and I can testify that zooming into a screen grab the pixels are indeed anti-aliased. It seems like dark magic to me, but it works so I ain't knocking it!



As the first shot was a little dark, so I provide another. I must confess to having a little too much fun creating these poses.  Hopefully you can see the anti-alias at work if you zoom in enough.  Not sure if Google blogger is squashing these shots or not, but the original size is 1360x768 or thereabouts.  You will find anti-alias around the edges of things and attempts to remove what are called 'jaggies' from the scene as a whole.

Signing Off

I am also pretty sure that these 'backup glasses' I am being forced to wear at the moment are giving me premature blurry eyes as after about 8 hours of keyboarding, everything gets fussy.  I am also the proud owner of one headache per evening which seems to coincide with these damn specs. I am also the proud owner of a moved appointment so my new eye test only happens on the 24th.  How crazy would it be if I finished off the beta half blind. At least I would have the perfect excuse in almost every quarter ;)

36 comments:

  1. Looks fantastic :D

    I still feel a bit weird about the FOV but again i still think its just me, plus i think its adjustable for the user? Its always going to be that one thing about FPSC that i feel always leaves screenshots as being identifiable as an FPSC screenshot.

    Overall I'm loving the progress so far :)

    ReplyDelete
  2. All Good.

    Let there be Light(s).

    :-)

    ReplyDelete
  3. The field of view or other is out of course adding to the distorted look on the screen shots where the sides of the buildings in particular can be seen to close in at the top.

    Its not a perspective thing as such other than if perspective is related to camera FOV then its as can be seen in any 3D software that has a wide range of Lens FOV controls when extremes beyond the human norm are used then scenes greatly become distorted to the human viewer as the brain does not accept that whats being seen is accurate to our visual understanding and perception of reality. Things look like a distorted mirror at a fun fair and whether something was indeed say mathematically correct does not matter. The point being that as a human looking at something even if its an optical illusion - scene or object distortion to the human eye is still a scene with distortion for that how we see it.

    Clearly in reality distortions can exist to us say looking up at a very tall building skyscraper from close proximity to its base the it can appear to hang over us and not be vertical. The point here is that we don't have a skyscraper and the level of distortion is not comparable with the aforementioned case and far from it. Here the distortion is much greater.

    I am no mathematician but there is an issue if one accepts that such distortion is one of course.

    :-)

    ReplyDelete
  4. Question: Will we be able to cordon off the water table / adjust the height so if we do not need water a particular place, it could possibly reduce memory usage?

    ReplyDelete
  5. Now that looks nice,Might answer a few peoples questions also.Thanks everybody for the hard work.

    ReplyDelete
  6. First - HOORAY!! Dynamic lights!! There is no way ANYONE was going to launch an attack on you for those coloured lights; I'm sure we all just assumed you did it for show and that it's fully adjustable.

    Second - Do you know what I mean when I say you are rendering at 1024x768? Because I'm 99% sure you still are. And no, Blogger is not squashing the shots and neither is it stretching them. They are indeed 1360x768. But the original backbuffer is 1024x768, which means FPSC is displaying a 1024x768 image at 1360x768; everything is distorted sideways.

    In x9, to fix this you had to create a custom game launcher that would set the resolution by modifying "setup.ini" or by forcing the user to open and modify a text file themselves ("setup.ini"). Not good. A normal game would have an in-game menu that allows the user to change the resolution (of the backbuffer) to a suitable size, ie that of their screen.

    Does that help? I'm sure Mark is horrified that you're rendering his beautiful art all squashed.

    ReplyDelete
  7. Lee, have you considered using this service; http://www.glassesdirect.co.uk/ Seems crazy you working on Reloaded with an old pair of specs! If you know your perscriiption then just order a cheap pair for now.

    Make sure you take on Clonex's feedback and also the info I sent you about FOV settings.

    BTW, well done on dynamic lights. Teenagers everywhere can now turn them on and leave them on!

    Rick

    ReplyDelete
  8. I don't know my perscription :( I just have the glasses I got about 18 months ago, and apparently they do not accept 'lenses' as a way to get new frames (convenient). It's not too bad, and 8 hours per day is plenty to be jogging along with.

    The first line of the new engine is SET DISPLAY MODE DesktopWidth(),DesktopHeight(),32,0,etc which creates a back-buffer at full resolution. Please send me evidence of this 1024x768 issue, thanks.

    I am going to add FOV to the slider settings so they can be adjusted in real-time so you can see the effect on your game. Slider menus are planned after trigger zone objects as the matter keeps coming up and having slider control of the various 'points of debate' will free me from needing to hack them any more.

    ReplyDelete
    Replies
    1. Yeah, that's the right command (and obviously you should know). Are you absolutely sure that it's not being set back to a lower res? Actually, I know how you can test it:

      Stick a round thing in the scene, something that you know is a perfect circle (the top of a barrel maybe?) and then look at it face-on and take a screenshot. I would recommend you post the screenshot on here so we can judge whether it's round or not because you might not be able to see it. You know, can't see the forest for the trees and all that.

      I hate to insist I'm right when I might not be, but I won't be happy until I see proof that it's the correct res.

      Delete
    2. Hope I haven't created more work for you Lee by bringing up the FOV topic. Its just something I noticed over time using in FPSC , not even sure anyone else notices it to be honest. So it could just be me being a bit too critical :p

      Really do like the idea of slider controls in FPSC this will make the product even easier to use for new users who don't want to go too deep into FPI coding to make such subtle changes.

      Delete
  9. Back in 2004 a 75 degree FOV was pretty standard for FPS's. Then a few years later games started to go tighter FOV, like 50 or 55. Apparently to give the game a more "in your face" look and make the action more claustrophobic and intense - like an embedded reporter shooting war footage. A lot of people, including me, don't like this more restrictive FOV, or it gives them headaches. I'll trade a bit of fisheye distortion for a wider view.

    ReplyDelete
  10. One question: Can you use the vegetation packs with the new terrain system?

    ReplyDelete
  11. Okay, colour me impressed. The two new screenshots look much better than before. Especially the last. Because I am a perfectionist, I'll say there is still something holding the shot back, but my is the quality far better. Maybe it's just the assets and of course, the anti-aliasing (which is awesome to finally have!).

    So you fixed dynamic lights, I hate to pester again about this, but this is a key feature I really wanted out of reloaded. Spotlights, and therein flashlights, any news/plans on those now you've touched/touching the lighting field?

    ReplyDelete
  12. It's the right time to ask ;) If anyone cares to scrounge up some HLSL shader 3.0 code that does the calculation for a coned spot light, I can slide it in for the player and see what it looks like...

    ReplyDelete
    Replies
    1. This is from Torque3D MIT
      and as its mit licensed its fully legal
      so i hope this helps a bit

      https://github.com/GarageGames/Torque3D/blob/master/Templates/Full/game/shaders/common/lighting/advanced/spotLightP.hlsl

      Delete
  13. Lee

    Its another master stroke to include SSAA to Reloaded and thanks to Bond1 for doing this. The screenshots really do look fantastic now and since watching the Expo video it appears David was finally thrown into the ring and faired a little better !!!

    Also love the dynamic lighting and the fact FPSC is now a real time engine is going to make the clear distinction that was necessary to make it a completely different product from FPSC classic. That and everything else thats going into it of course.

    I'm actually going to enjoy just spending time in the editor now without caring too much if a game comes out the other end but being very relaxed in the knowledge I now have a tool that can actually make a AAA game if I'm so inclined.

    Reloaded will be the FPS engine equivalent of playing GTA5. You are very happy with the product you purchased even if you never get around to completing any missions!

    With 2 weeks to go for the 1st BETA I find myself wondering how to tell my boss I suddenly need a bunch of time off work.

    ReplyDelete
    Replies
    1. Oh make that Daniel!, apparently David got his head ripped off !!

      Delete
  14. what about attached to entity's lightin like a flashlight on enemies or moving vehicles etc would be awesome but not to get too excited. Also is sky getting a look in or is that later :)

    ReplyDelete
    Replies
    1. @science man

      I don't think it will be performance reasonable to have dynamic lights also casting dynamic shadows unless Lee adds an option to have the directional 'sun' light not casting dynamic shadows so the players flashlight can do this. I believe a similar compromise was made in Half Life 2 early on where you were limited on how many lights can project shadows.

      Delete
    2. Usually it's a case of how many lights can project shadows indeed. I think it's far from infeasible, far, far far from that. Just look at the Silent Hill series.

      The shadows don't even need to be that high quality (of course player adjustment helps in that field.)

      I once suggest Lee look at stencil shadows, which is what the early Silent Hill games made use of to get those dynamics on flashlights on PS2 hardware so I have complete faith he can do this.

      Delete
  15. http://www.youtube.com/watch?v=xuZ-pA5xuHs

    Hopefully FPSCR could look a little something like, and have most of the features of, that.

    ReplyDelete
    Replies
    1. You've just reminded me of a point I really hope Lee can have implemented. 360 degree camera rotation in the editor. Please don't limit us to the top down view again!

      Delete
    2. Its interesting you say that. After looking at the Expo video I think the top down view actually works remarkably well. Its high enough to do effective terrain modelling and you can zoom into to ground level for detailed placement of entities etc.

      Due to having completely real time lighting and shadows now you can actually get a really good sense of placement just from looking at the shadows and the entities automatically follow the terrain height so I don't think a 360 camera is actually a must have and might be moving a little too far away from FPSC's heritage for users to adopt.

      The only reason I think we can make a case for this is if the room blob segments cannot be edited easily for interior areas with the top down camera.

      Delete
    3. I think it can be implemented alongside the top down editor. Only needs a hotkey to activate, then a key can be pressed to snap back to top view.

      Delete
    4. I'm fairly sure Lee said he was planning to implement something where you could walk around your level and change things on the fly - I don't think it'd be a huge leap to just make the player fly while doing it.

      Delete
  16. Great work Lee!! impressive pictures! (the first one have the self shadowing off again? LOL) great the hawk flying around it's some sort of NPC attempt? or it attack you?? :D

    however: "You probably won't see this type of extreme lighting again until we do a SciFi pack"

    "... until we do a SciFi pack"

    SCI-FI pack?? that's a really great news for my eyes!

    ReplyDelete
  17. I'm just curious if the new dynamic lights will at least render dynamic shadows to the geometry.

    Let the surface only be affected by 2-3 lights is okay for me (as long as the other light information is passed as simple light information, so they don't get lost).
    But what is really needed is that such lights, which dynamically affect the normal maps etc. will also render shadows into the scene. Otherwise we will again have the problem of light bleeding through walls etc.

    Would love to hear something about that. (I can understand that we cannot expect multiple dynamic shadow sources like in Unreal 4 / CryEngine etc. Thats a completly different thing.)

    ReplyDelete
  18. The dynamic lights do not cash dynamic shadows. Only the directional light casts a shadow. If you have an idea how I can cast dynamic shadows, and limit dynamic lights to only certain surfaces without incurring a terrible performance hit, please let me know. I have a few ideas how to 'avoid' having to ray cast for surfaces, one of them being dynamic lights only affect regions of objects (i.e. a light in a building would not affect the terrain, only the building and it's contents, a light outside would affect the terrain but not the inside of the building. This would be part of the new room blob system which will allow some performance benefit doing it this way. Other ideas welcome. To cast THREE dynamic shadows from three dynamic point lights would require me adding 18 new camera renders to each framer rendered. Do you still want this?

    ReplyDelete
    Replies
    1. Would that prevent, for example, you having a light outside a building (maybe headlights on a car or the light from a lamp post) that shine in through the windows and doors of a building and cast shadows on the interior?

      If so, I think there needs to be another way...

      In terms of adding render cameras, you've exceeded my technical ability.

      Delete
  19. You could do the 'car headlight' effect with one extra render, but it would be a special case item to preserve overall game engine performance. I'd like nothing better to max out every possible effect in the engine, but performance is going to be the deciding factor here.

    ReplyDelete
    Replies
    1. Okay well so long as it can be turned on and off depending on whether the player can see the effect or not (and maybe switched to a different effect elsewhere in the level), and so long as the sun/moon still cast shadows on interiors, it would probably work.

      I suspect time will tell - if you find people are trying to create levels with lots of light interactions between interior and exterior (light shining out of a window onto the terrain is another one) and are encountering problems, it's a sign some performance might have to be sacrificed in order to accomodate.

      Anyway I defer to your better judgment.

      Delete
  20. You have it exactly. We implement a sensible first approach, then build on that based on what we need, without hurting performance. The only way I know to do a universal dynamic point shadow system is pretty intense when it comes to rendering extra views.

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. Good approach Lee. If its performance reasonable to allow any more lights to cast dynamic shadows e.g. 1 directional for the sun and 1 spot light for the player flashlight that would be very cool. I certainly don't expect it will be possible to have dynamic shadows cast from lots of lights as that doesn't happen even in most AAA games.

    It has left me wondering how shadows will be handled for indoor areas though.

    ReplyDelete
  23. Anticipation! Everything is falling into place and looking Good! Great work Lee and the TGC Gang!

    ReplyDelete
  24. Just for info and avoid misunderstanding, Reloaded WILL allow you to create lights and color them whatever color you wish, and have as many as you want in the level. The SkyFi Pack mention was only in reference to the fact that metallic and futuristic assets really benefit from having a green light, red light and blue light contributing illumination from different sides. The same light trick does not look too convincing in a desert themed scene ;)

    ReplyDelete