Added Ambient Occlusion!

Wed 18 Mar 2015, 01:49 by bencelot



More awesome work on the lighting engine. Today I added ambient occlusion. Ambient Occlusion is a lighting technique that determines how bright a surface is by how exposed it is to the outside world (usually the sky). The way you calculate it is for each point in the map, you fire a bunch of rays out into space and see if they collide with anything. If they collide with stuff then the surface must be in a crevise or corner somewhere and therefore isn't going to receive as much ambient lighting from the scene. If they don't collide but fly all the way out into space then it's safe to assume that the sky has direct access to it and can brighten it up a bit. Basically it means corners and crevices are darkened and areas out in the open are brighter, just like we see in real life.

Anyway for Mutant Factions I have applied ambient occlusion only to the AMBIENT property of lights. I rarely used the ambient property in the maps before because they ambient lighting made everything look very flat and washed out. I much preferred to use a number of lights and rely on shadows and direct lighting to brighten the scene in a more 3D way. We can't do this anymore because the shadows they cast will be too noticable, but now we can once and for all rely on the ambient property of lights instead. Let me show with a picture:

Attachment:
ambientOcclusion.jpg


This is the exact same scene with the same lighting, the only difference is with and without ambient occlusion. The top picture is what it used to look like if you put a 100% ambient light in the map. Notice how flat and washed out it all looks? The ground is the exact same colour all over the map and it just looks like a flat 2D plane. The picture below is with the new ambient occlusion enabled. Notice how the game automatically generated these soft shadowy effects near the walls? It looks a lot more 3D and it's as if the buildings are casting soft shadows on the ground as they block it from the sky. Overall it looks a lot nicer I think kind of as if it was on a cloudy day, whereas the top picture just looks fake.

Of course you're not just going to use a 100% ambient light as ambient lights don't cast any of the new sexy shadows that I've created. But now you can create maps with a good mix of direct diffuse light and indirect ambient light. Here's a more realistic scene before and after the ambient occlusion:

Attachment:
ambientOcclusion2.jpg


Again, exact same lighting just with and without ambient occlusion. It's not a huge difference but if you look at the edges of the building you can still see the ambient shadows being cast. The ground doesn't just go right up to the wall and stop suddenly, but rather as it approaches it gets darker and darker, as if that wall was really there in 3D casting an ambient shadow onto it.

Anywhoo, there's plenty of experimentation to be done with the way the lights now work. Should get some really nice effects out of this!


5 Comments


chross says:

Wed 18 Mar 2015, 11:18


Wow, this looks great.

Now you should find a way to add animation to those tree leaves and other stuff on the map. ;)


bencelot says:

Wed 18 Mar 2015, 21:03


Heh yup animations would be great. I suppose a lot of that could be done with particles. For example I could make tiny little "leaf" particles that fall off the tree. But having some way to animate decals would be sweet too..


LucasRo7 says:

Thu 26 Mar 2015, 20:38


bencelot wrote:
Heh yup animations would be great. I suppose a lot of that could be done with particles. For example I could make tiny little "leaf" particles that fall off the tree. But having some way to animate decals would be sweet too..

you could make decals have some new properties: random size, random rotation, random movement/displacement,speed, and maybe some others like timeoffset, etc
well, its not actually random, its a few calculations like displacementX=(time+timeoffset)*Math.sin*speed

or every tick a variable gets added or subtracted by the speed and the displacement gets added by that variable*0.1


chross says:

Fri 27 Mar 2015, 12:25


For animations, you could implement a template system in the map editor, so one could reuse proven effects like rain, snow, moving leaves, flying newspapers etc.


bencelot says:

Fri 27 Mar 2015, 19:33


Yes, a template would be very very useful I think. Would speed up a lot of things. Good idea!

Blog Posts For Geneshift


Version 1.05: Exploding Guards and new Kill Combos!

(0)


Version 1.04: Geneshift Miami!

(0)


Version 1.03 Adds New Camera!

(0)


Version 1.02 Adds Three New Skills!

(0)


Geneshift has launched on Steam Early Access!

(3)


Geneshift v1.00 Released!

(0)


Play the Multiplayer Demo on Steam Today!

(1)


Geneshift hits Steam on May 23rd, 2017

(0)


Official Discord Chatroom

(0)


Geneshift v0.997 Released!

(0)


Geneshift Launch Trailer is Live!

(7)


Server Downtime

(0)


Geneshift v0.996 Released!

(1)


Steam Store Page is now Coming Soon!

(0)


Steam Integration & Achievements

(12)


Geneshift v0.995 Released!

(1)


Geneshift - new game name!!

(4)


3D Vehicle Models!

(36)


3D Player Models!

(34)


Time for Graphics!

(10)


Skill Casting Guards!

(6)


Campaign Stage 6: Inferno

(6)


Updating the particle system

(2)


Stealth speeds by Outbreak in Speedruns!

(1)


Version 0.994 released! Introducing Stealth mode!

(0)


Graphics fun

(2)


Trigger music with bombs and text zones

(1)


Making Music!

(22)


Version 0.994 test build is available!

(22)


Started work on the third campaign stage: Driving Downtown

(4)


Just fixed an 8 year old bug with MASSIVE performance gains!

(2)


Guard Waypoints!

(59)


Version 0.992: Speedrun Leaderboards and new skill scaling!

(0)


Leaderboards are done!

(2)


New Version, new trailer, new year!!

(17)


Finished the new trailer!

(3)


Hooray! My laptop can take video!

(0)


Version 0.99 Released!! Amazing graphics and new chemicals!

(6)


Rewording all the skills

(8)


Working on team chemical vision!

(15)


FINALLY finished map making! Thank god.

(3)


Free skill resets on mutants under level 30!

(11)


Reworked Barn, Canal and Asylum

(9)


Reworked Downtown

(0)


Added the Newbie Checklist!

(7)


3D Models!! Mutant Factions has finally gone 3D baby!

(19)


Just rented an apartment in Peru!

(0)


Update on plans and Menu Music!

(9)


Massively expanded the in-game tutorial guide

(0)


Textured, Animated, Layered and 3D Fog!!

(5)


Specular Highlights!!

(6)


Added Ambient Occlusion!

(5)


Sexy Soft Shadows!1

(11)


Version 0.98: Some nice balance changes

(1)


A little bit of graphical goodness!

(0)


Brasil trip is over, back to coding!

(2)


Version 0.97: Chemical Warfare polish and skill queues!

(0)


Introducing Chemical Warfare!! Version 0.96 is here!

(0)


Chemical Warfare is finished!

(1)


Chemical Warfare: Graphics finished, coming out soon!!

(0)


Chemical Warfare: super sexy chemical graphics

(5)


Chemical Warfare: Today I finished coding all gameplay!!

(1)


Chemical Warfare: buy menu icons and descriptions

(2)


Chemical Warfare: carrying a chemical graphics

(0)


Chemical Warfare: buying chemicals

(0)


Chemical Warfare: compound graphics!

(5)


Chemical Warfare: HUD, networking and compounds

(0)


Chemical Warfare: point scoring and compound discovery

(6)


Chemical Warfare: menu, networking and compound locations

(0)


What's this blog business??

(0)


Version 0.95! New cash system!

(3)


Version 0.94!! FLAMETHROWERS!!!

(16)


Version 0.936 is out! Superweapons galore!

(7)


Please tell your friends and vote on Steam Greenlight!

(2)


Wooot Woot! Version 0.935 is here! No longer in alpha!

(10)


Check out the new main page!

(8)


Version 0.93!! Brand new ranked servers and CC system!

(3)


Rescaling of Respect Ranks

(2)


Version 0.92 is out! Sexy new maps and Outbreak changes!

(3)


4 new custom-maps servers

(3)


I'm going to be working on Mutant Factions full time again!

(10)


Mutant Factions v0.91 is out! Introducing Respect Rankings!

(4)


Outbreak has been released! Introducing Mutant Factions v0.9

(4)


Subvein has changed names to Mutant Factions!

(7)


12 Official New Servers!

(7)


Mutant Factions Madness: Official Play Sessions!

(12)


Subvein version 0.74 has been released!

(2)


Like Subvein on Facebook!

(8)


Subvein version 0.73 released!!

(13)


Let's Play Together!

(1)


Explosions now dynamically light up the map!

(5)


Subvein is on Steam Greenlight!

(54)


An amazing optimisation!

(12)


Version 0.71 has been released!

(1)


Version 0.7 is out! Translations, Unicode, and New Skills!

(5)


Today I'm going to add translations (переводы)

(34)


Version 0.698 is out! Vehicle netcode and skill changes

(2)


Version 0.697 is out! Restructured weapons, skills, missions

(6)


Version 0.696 released! Improved netcode, AI and skills!

(30)


Playing with pathfinding

(30)


Playing with netcode

(8)


Version 0.695 is here :D

(21)


Subvein v0.694 is rockin' OUT!

(6)


Subvein v0.693 is LIVE!!

(15)


Latest developments: In-game quick levelling!

(41)


Version 0.692 is out!

(9)


New version is out! Introducing v0.691

(7)


Yehaaa!! Version 0.69 is out!

(4)


Woo hoo! We now have new hosting :D

(10)


Woohoo!! Over 5000 members!

(4)


Subvein is back up and running!!

(8)


2000 members. Let's make it 20000!!

(36)


Subvein version 0.6 has been released!

(13)


New promo video!!!

(12)


Added a new Community page!

(6)


Just added camera shake :)

(3)


Updated the news page!

(3)


Start earning community credits today!

(16)


A war is coming..

(6)


Account system coming to Subvein v0.6!!

(29)


First ever demo of Subvein vehicles is up!

(5)


Version 0.551 Released :)

(4)


Subvein version 0.55 Released!

(8)


Version 0.541 is out. Thank god!

(5)


Version 0.54 is different. Experience it now!

(9)


Version 0.54 comes out in 24 hours!!

(9)


Subvein v0.53 is OUT!!

(3)


Subvein v0.53 will go up within 24 hours!!!!

(9)


Added a new SHARE button!

(2)


Added a new FAQ section to site!

(5)


Subvein version 0.52 is HERE!!!

(13)


Subvein v0.52 will be released in 7 hours!!

(13)


Development towards version 0.52:

(70)


Version 0.51 is OUT!

(6)


Welcome to Geneshift!

(167)