{"id":168,"date":"2018-05-11T22:50:22","date_gmt":"2018-05-12T03:50:22","guid":{"rendered":"http:\/\/www.chroniclesoftright.com\/blog\/?p=168"},"modified":"2018-05-11T22:50:22","modified_gmt":"2018-05-12T03:50:22","slug":"better-lighting-etc","status":"publish","type":"post","link":"https:\/\/www.chroniclesoftright.com\/blog\/2018\/05\/11\/better-lighting-etc\/","title":{"rendered":"Better lighting, etc."},"content":{"rendered":"<p>Here&#8217;s the latest:<\/p>\n<p><a href=\"http:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-169\" src=\"http:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1-300x152.png\" alt=\"\" width=\"300\" height=\"152\" srcset=\"https:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1-300x152.png 300w, https:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1-768x390.png 768w, https:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1-1024x520.png 1024w, https:\/\/www.chroniclesoftright.com\/blog\/wp-content\/uploads\/2018\/05\/penrithForest-2018.05.11-1.png 1919w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a>You&#8217;ll notice a few things.\u00a0 First, the scene is just much brighter overall.\u00a0 I bumped up the ambient light by a good bit and darkened the material on the terrain so it wouldn&#8217;t look blown out by the brighter lights.\u00a0 Also, SHADOWS!!\u00a0 <a href=\"http:\/\/threejs.org\" target=\"_blank\" rel=\"noopener\">THREE.js<\/a> is so awesome.\u00a0 Adding the shadows to a directional light took a little bit of fiddling but overall it was actually quite easy.\u00a0 The shadows do affect performance.\u00a0 You can see in the FPS counter I&#8217;m down to around 50 frames per second with this simple scene.\u00a0 I want the game to be able to run on very low end hardware so users will need the ability to disable the shadows, but my goodness does it make a difference in the overall look and feel of the game.\u00a0 I absolutely love that objects even shadow other objects, so you can see the shadow of the tree on the left hand side of the screen partially covering the crate.\u00a0 Just absolutely fantastic.<\/p>\n<p>Some notes on implementation.\u00a0 To keep the shadow map relatively small the directional light that is the sun now moves whenever the camera pans.\u00a0 This means you will never see shadows more than about 50 meters past the camera&#8217;s target, but who cares?\u00a0 This is also totally configurable so if a player has better hardware maybe that distance could change automatically to show shadows farther away.\u00a0 I also added in the ability to remove objects from the world.\u00a0 That was, as expected, quite simple.\u00a0 You can also now toggle viewing the light helper objects so that if you want to see a directional light&#8217;s position and orientation, just hit &#8216;l&#8217;.\u00a0 But most of the time that just gets in the way while editing so you can hide it.<\/p>\n<p>That&#8217;s it for now.\u00a0 I&#8217;m really happy with the better lighting.\u00a0 I think the next step is to allow live editing of the lights in the scene.\u00a0 Right now you can see the lights through the associated helpers, but you can&#8217;t actually select them and move them around in the world editor.\u00a0 If I&#8217;m going to have lamps with individual lights in them or any other kind of somewhat complicated lighting in a scene I&#8217;ll need some better tools to place and move lights around.\u00a0 Oh, and I&#8217;ll keep creating assets for Penrith Forest.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s the latest: You&#8217;ll notice a few things.\u00a0 First, the scene is just much brighter overall.\u00a0 I bumped up the ambient light by a good bit and darkened the material on the terrain so it wouldn&#8217;t look blown out by the brighter lights.\u00a0 Also, SHADOWS!!\u00a0 THREE.js is so awesome.\u00a0 Adding the shadows to a directional&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-168","post","type-post","status-publish","format-standard","hentry","category-planning-and-development"],"_links":{"self":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/comments?post=168"}],"version-history":[{"count":1,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":170,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/168\/revisions\/170"}],"wp:attachment":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/media?parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/categories?post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/tags?post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}