{"id":1994,"date":"2015-11-29T23:57:41","date_gmt":"2015-11-29T23:57:41","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=1994"},"modified":"2015-11-29T23:58:25","modified_gmt":"2015-11-29T23:58:25","slug":"p-152-virtual-world-concept-update-78-chunked-levels-of-detail-using-quad-trees-part-45","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p-152-virtual-world-concept-update-78-chunked-levels-of-detail-using-quad-trees-part-45\/","title":{"rendered":"P-152: Virtual World Concept Update 78: Chunked Levels of Detail Using Quad Trees Part 45"},"content":{"rendered":"<p>I haven&#8217;t fully tested my implementation of the optimised algorithm for populating the render list from the quad tree data, however, I am very close to doing this.<\/p>\n<p>I am now roughly in the same position I was in several months ago, where I am ready to test the final step of the spherical terrain Chunked level of detail rendering system. However,\u00a0I had previously made a number of fundamental errors in the way the terrain code was set up, which I now believe I have fixed.<\/p>\n<p>These errors included using just one quad tree, when I should have used 6 (one for each face of the quad sphere), and rendering the terrain in triangles, instead of rendering each node of the quad tree as a separate, independently rendered, quad. I have fixed these issues and several more, and so I am reasonable confident that I will achieve proof of concept this time.<\/p>\n<p>I came up with my solution to the problem of parsing and subdividing the tiers when I previously tried to implement this with the older code. This same solution should work with the new code as well. I basically need to get the centerpoint of the current node that I am processing, transform it to world space, and then project a vector from that node to the players position.<\/p>\n<p>I can then scale that vector by the blocksize\/2, where the blocksize is the length of a quad at that resolution, so if the maximum resolution is 64, the first tier has a blocksize of 64 (just one node), this then splits to form 4 quads, each with a block size of 32, then these split to form 16 quads with a blocksize of 16, etc.<\/p>\n<p>This will give me a vector with an endpoint which is the closest point to the player within the circle centered on the node center, and with a diameter\u00a0equivalent to the blocksize of that tier. I can then simply get the distance between this endpoint and the players position. If it is within the players view distance, I subdivide the node, if not, I render it as it&#8217;s current resolution.<\/p>\n<p>This should solve the problem I was having, when I just grabbed the closest node to the player and subdivided it (which\u00a0failed if the player was near a node border, since only the closest node, and not the node on the other side of the border, would be subdivided, leaving a noticeable gap). I have posted about these issues more in previous posts.<\/p>\n<p>I am currently in the final stages of testing before I implement this solution fully, so I should know relatively quickly if this will work or not.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I haven&#8217;t fully tested my implementation of the optimised algorithm for populating the render list from the quad tree data, however, I am very close to doing this. I am now roughly in the same position I was in several months ago, where I am ready to test the final step of the spherical terrain [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10,11],"tags":[],"class_list":["post-1994","post","type-post","status-publish","format-standard","hentry","category-astral-realms","category-software-and-games","category-spiritus-astrum","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1994"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=1994"}],"version-history":[{"count":2,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1994\/revisions"}],"predecessor-version":[{"id":1996,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/1994\/revisions\/1996"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=1994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=1994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=1994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}