{"id":2809,"date":"2014-04-27T21:47:46","date_gmt":"2014-04-27T20:47:46","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=2809"},"modified":"2014-04-27T21:47:46","modified_gmt":"2014-04-27T20:47:46","slug":"goodbye-specular-lighting-stuff","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2014\/04\/27\/goodbye-specular-lighting-stuff\/","title":{"rendered":"Goodbye specular lighting stuff"},"content":{"rendered":"<p>For a while Gratuitous Space Battles 2 had a separate &#8216;lighting&#8217; layer for ships that was used to pull off a few effects. This meant a ship hull might come with a color layer, a normal map, a specular layer, an illumination layer and a hulk layer. And those ship graphics are 4x the size of before, so they are 32bit color 1024square dds files. Those get pretty big, and with at least 40-50 new ships, suddenly the game is getting awkward to throw builds about with on my crappy rural broadband&#8230;<\/p>\n<p>Luckily, after a bit of chin-stroking and going to-and-fro with the ship artist, we now don&#8217;t need that specular layer at all. It was fairly redundant, it was effectively being used as a separate &#8216;foreground lighting&#8217; layer. It turns out I don&#8217;t really need that, I can just re-use the color layer. It&#8217;s a bit of a complex engine because it does a normal-mapped 3d thing, but also has lights that can be controlled separately to the foreground (ambient) lighting and also the normal-mapped directional lighting. This allows me to have all kinds of cool effects such as &#8216;dark&#8217; battles where you can only see lasers and lights from ships, and also to have bright nebulas with everything glowing.<\/p>\n<p>Of course, the minute I changed the code, everything else stopped working. First shadows stopped rendering entirely, then they worked, but I lost control of illumination brightness for ship lights. A whole lot of head scratching and debugging later and I am back where I started, but now the specular layer is irrelevant. That simplifies and speeds up the toolchain too, which is a very welcome bonus.<\/p>\n<p>I&#8217;m only a few fighter-hulls away from being able to put together some battles with all-new in-game graphics and taking some screenshots for real, although the planets are still placeholder, and the explosions and particle effects all need re-doing. Still, progress is progress.<\/p>\n<p>Unrelated, I&#8217;m off to see the nice people at Valve tomorrow for a UK meeting with developers.. Should be interesting<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For a while Gratuitous Space Battles 2 had a separate &#8216;lighting&#8217; layer for ships that was used to pull off a few effects. This meant a ship hull might come with a color layer, a normal map, a specular layer, an illumination layer and a hulk layer. And those ship graphics are 4x the size<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; Goodbye specular lighting stuff<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2014\/04\/27\/goodbye-specular-lighting-stuff\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[119,4],"tags":[],"class_list":["post-2809","post","type-post","status-publish","format-standard","hentry","category-gsb2","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=2809"}],"version-history":[{"count":1,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2809\/revisions"}],"predecessor-version":[{"id":2810,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/2809\/revisions\/2810"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=2809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=2809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=2809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}