{"id":2183,"date":"2024-04-13T09:32:14","date_gmt":"2024-04-13T08:32:14","guid":{"rendered":"https:\/\/www.katsbits.com\/site\/?p=2183"},"modified":"2024-04-13T10:11:44","modified_gmt":"2024-04-13T09:11:44","slug":"dynamic-lighting-principles","status":"publish","type":"post","link":"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/","title":{"rendered":"Dynamic Lighting Principles (idTech4)"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#How_Lights_Work_Brightness\" >How Lights Work, Brightness<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Lights_Colour_Values\" >Lights &amp; Colour Values<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Lights_Are_Now_Light_Volumes\" >Lights Are Now Light Volumes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Working_With_Dynamic_Light_Volumes\" >Working With Dynamic Light Volumes?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Ambient_Light\" >Ambient Light<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Ambient_Plus_Local_Highlights\" >Ambient, Plus Local Highlights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Local_Light_Plus_Local_Highlight\" >Local Light, Plus Local Highlight<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#Ambient_Plus_Local_Light_Plus_Local_Highlights\" >Ambient, Plus Local Light, Plus Local Highlights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.katsbits.com\/site\/dynamic-lighting-principles\/#General_Tips\" >General Tips<\/a><\/li><\/ul><\/nav><\/div>\n<p>Doom 3 (idtech4) and dynamic lighting principles introduces the basic knowledge involved in using the new dynamic lighting system idtech 4 brings to play for the level designer to toy with when building their custom levels or mods based on the technology.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_Lights_Work_Brightness\"><\/span>How Lights Work, Brightness<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Lights in Doom 3 work in a slightly different way from a Doom3Radiant editing point of view. In previous id games lights were brightened, their &#8216;wattage&#8217; if you will, by adding a numerical value to the entity; the higher the number the brighter the light or watts power. Quite an easy method to get to grips with. In game this meant an area covered was relative to that &#8216;wattage&#8217; value; covering larger areas meant using higher light values. Doom 3 still uses that same principle but it&#8217;s implementation is different; the &#8216;brightness&#8217; of a light is given by the volume or the amount of space that volume lights up or illuminates,  which if you think about it, is what the various watt values do; they light up more and more area \/ space depending on their relative power (40 &#8216;watt&#8217; for a desk lamp, 60 for a room, 100 for a larger room and so on..).<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Lights_Colour_Values\"><\/span>Lights &amp; Colour Values<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>On top of this is the colour value. In Quake 3, editing the colour (hex) values only effected the colour of light entity itself; the colour or tone of the light emitted from the entity onto surrounding geometry. In Doom 3 however, the colour value not only changes the entities colour but also effects the &#8216;wattage&#8217; brightness value; maximum wattage being white, minimum (nothing) being black. It acts as a fine tuning value in many respects, where the vertical slider in the entity editor panel can be used to alter how much colour and light (relative to the colour chosen) is being emitting.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Lights_Are_Now_Light_Volumes\"><\/span>Lights Are Now Light Volumes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>So, &#8216;light volumes&#8217; are what we&#8217;re dealing with inside Doom 3 Radiant. What does this mean? It means gone are the days of editing light key\/value pairs in the entity properties editor (light\/500), of changing the &#8216;wattage&#8217;, and enter the future of volumes, <i>a given amount of space effected by a light<\/i>.<\/p>\n<p>Imagine a cardboard box with a point of light at it&#8217;s centre, the (boundaries) sides of the box set the limiting distance and overall volume of space that particular light can influence; anything contained in that box will receive light from the entity at the centre, the closer the brighter. This means that in Doom 3 Radiant we&#8217;re effectively placing light entity &#8216;containers&#8217;, anything inside of which is effected by a given light &#8216;volume&#8217; (the space &#8216;inside&#8217; the container), so uniformly lighting an area means careful and considered placement of these &#8216;containers&#8217; so the volumes interact efficiently rather than the &#8216;spamming&#8217; (overuse) method that could be done with lights in previous (light map based) games. Basically we&#8217;ve now got more control over how lights work,  how they are placed and what they have an influence over.<\/p>\n<p>Now this new method does introduce an interesting facet to mapping that is important to bear in mind as you work; overlapping light volumes. Essentially, what you physically see in game is now directly linked to the lights as the Doom 3 engine renders the contents of each volume. This means that where an overlap occurs the engine basically renders the area multiple times, once for each light. Obviously this then mean the more areas of overlap you have the more renders that are going on and the more CPU and GPU power\/time that&#8217;s being used up. Working with Doom 3 lighting means paying particular attention to this because, although in theory you could light a map in the same way that was done with Quake 3 powered games, the power needed to actually play through something like that is beyond what the average gamer has available at the moment.<\/p>\n<blockquote>\n<p><b>Design note<\/b>:  It has to be said here that the number of lights you can have in a map or given area right now is not limited by the engine itself but by the current speed and performance level of the hardware in our computers; obviously the more lights you have the more CPU and GPU power you need to render what&#8217;s onscreen at any given moment.<\/p>\n<\/blockquote>\n<h3><span class=\"ez-toc-section\" id=\"Working_With_Dynamic_Light_Volumes\"><\/span>Working With Dynamic Light Volumes?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Well, it doesn&#8217;t change too much really from the processes used to build maps based on the Quake 3 engine, so long as you keep in mind the light volumes principle. Placing lights relative to light emitting objects is still the same, the &#8216;architectural objectives&#8217; of building and item placement itself, but now you have to watch the volume overlaps. Outlined below are some of the common processes used to light maps using the new volumes that Doom 3 has, and as outlined above, the more lights (and generally the brighter the area in question) the more power is needed to render the scene.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Ambient_Light\"><\/span>Ambient Light<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>At least one light source used to create the overall light level value. &#8216;Ambient&#8217; in this instance means &#8216;background light&#8217; rather than the &#8216;ambient light shader&#8217; that can be applied to a light entity (from the light properties inspector [keyboard &#8216;J&#8217;]).<\/p>\n<div class=\"content_images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/doom_3_lighting\/dynamic-lights-example-layout_sml.png\" width=\"640\" height=\"360\" alt=\"click to see larger version\" border=\"0\" \/><\/p>\n<p>Ambient Light only<\/p>\n<\/p><\/div>\n<p>The default light settings generally give low but consistent light (brightness) levels to a room. Highest in game FPS. Also take note that the light volume itself slightly overlaps the boarders of the room so as to get a consistent level of light present on as many surfaces as possible &#8211; the walls for instance. There is a side effect to this that needs to be kept in mind &#8211; <i>light volume &#8216;<b>leaks<\/b>&#8216;<\/i>. This basically means that if a light volume (the bounding box) &#8216;leaks&#8217; (can be seen) into other areas of the map (an adjoining room for instance) the surfaces that it touches will receive a light surface &#8216;hitcount&#8217;. Remember the box analogy above? Well if you were to place the box into a given room and it&#8217;s sides could be seen in another totally separate room then Doom 3 renders that light volume as part of the two rooms creating another surface &#8216;hitcount&#8217; per surface, per room &#8211; in a manner of speaking, it&#8217;s generating &#8216;waste&#8217; (unnecessary) rendering. You want to avoid this type of scenario as much as possible.<\/p>\n<p>The upshot of this means designing maps with greater distances between each area, using thicker walls and structures so you can terminate volumes well within these blocks and boundaries, or reducing the detailing on areas that have many volume overlaps so the Doom 3 engine doesn&#8217;t have to work quite so hard at rendering everything it sees.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Ambient_Plus_Local_Highlights\"><\/span>Ambient, Plus Local Highlights<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&#8216;ambient&#8217; background light accentuated with the use of local &#8216;highlight&#8217; volumes. These create localised &#8216;hotspots&#8217; indicating the proximity of the light source to objects around and \/ or near it. As above this generally gives low but consistent light (brightness) levels to a room with local areas of brightness. High in game FPS.<\/p>\n<div class=\"content_images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/doom_3_lighting\/dynamic-lights-ambient-plus-local_sml.png\" width=\"640\" height=\"360\" alt=\"click to see larger version\" border=\"0\" \/><\/p>\n<p>Ambient + local highlights<\/p>\n<\/p><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Local_Light_Plus_Local_Highlight\"><\/span>Local Light, Plus Local Highlight<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&#8216;ambient&#8217; light is replaced by larger localised light volumes. In theory this allows slightly brighter lighting that&#8217;s relative to the light sources of an area. Light volumes need to be (or ideally should be) overlapped to &#8216;blend&#8217; or &#8216;blur&#8217; the edges often visible if light volume placement is left &#8216;as is&#8217; and simply butted up to each other (edge to edge placement). Medium in game FPS.<\/p>\n<div class=\"content_images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/doom_3_lighting\/dynamic-lights-local-area_sml.png\" width=\"640\" height=\"360\" alt=\"click to see larger version\" border=\"0\" \/><\/p>\n<p>Local area lights + local highlights<\/p>\n<\/p><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Ambient_Plus_Local_Light_Plus_Local_Highlights\"><\/span>Ambient, Plus Local Light, Plus Local Highlights<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>ambient light &#8216;plus&#8217;. Ambient lighting is &#8216;doubled up&#8217; by the use of &#8216;localised&#8217; ambient lighting (yellow) and &#8216;global&#8217; ambient (blue).  This method tends to create a lighting system with the greatest &#8216;wattage&#8217; (brightness) potential but at the harder FPS hit &#8211; the more lights you add the brighter the area, but the more surfaces that get hit  and the harder that effects the FPS. Lowest in game FPS.<\/p>\n<div class=\"content_images\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.katsbits.com\/images\/tutorials\/doom_3_lighting\/dynamic-lights-ambient-local-area_sml.png\" width=\"640\" height=\"360\" alt=\"click to see larger version\" border=\"0\" \/><\/p>\n<p>Ambient + local area lights + local highlights<\/p>\n<\/div>\n<h3><span class=\"ez-toc-section\" id=\"General_Tips\"><\/span>General Tips<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Because of the way light volumes effect surfaces it generally mean that brushwork now has to be cut into smaller sections to avoid long or large surfaces as much as possible. The reason? Brushes left in their original and rather lengthy or large state are more often than not being &#8216;hit&#8217; by several light volumes which increase the overall surface hit count on that particular brush. The more of these you have in a given area the more the game engine has to work in terms of &#8216;over rendering&#8217; the scene because of the light interaction. Cutting brushes into smaller &#8216;chunk&#8217; makes the light volumes more manageable to render for the game.<\/p>\n<p>Related to the point above is the need to &#8216;alternate&#8217; textures or features. The compiler that comes with Doom 3 (dmap) is incredibly efficient at optimising and removing &#8216;dead&#8217; surfaces, simply splitting a brush in half means that dmap will join those back together as a way of &#8216;optimising&#8217; those surfaces (two triangles instead of four). This in turn means you need to place &#8216;trims&#8217; or architectural features  where the split or division is needed, this way the compiler is forced to keep brushes separated. Incidentally there is another method that can be used where the texture alignment of a surface is &#8216;offset&#8217; slightly relative to adjoining surfaces which then forces the rendering of each separate surface as dmap can&#8217;t then merge them back together.<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":2184,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[488,549,547,60,545,515,334,109,108,502,107,546],"class_list":["post-2183","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-brush-volumes","tag-d3edit","tag-dmap","tag-doom-3","tag-doom3radiant","tag-dynamic-light","tag-idtech4","tag-level-design","tag-level-editing","tag-lights","tag-radiant","tag-shadows"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/2183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/comments?post=2183"}],"version-history":[{"count":1,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/2183\/revisions"}],"predecessor-version":[{"id":2188,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/posts\/2183\/revisions\/2188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media\/2184"}],"wp:attachment":[{"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/media?parent=2183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/categories?post=2183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.katsbits.com\/site\/wp-json\/wp\/v2\/tags?post=2183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}