Vertex Y Position = Vertex Y Position + Scale * (Average Height – Vertex Y Position)<\/em><\/p>\nBy passing in a negative scale the Smooth function becomes an Extrude function. \u00a0Moving the vertices away from the average height position.<\/p>\n
Updating The Terrain<\/h3>\n
Locking Vertices and Indices of a mesh can be fairly process intensive. \u00a0So when doing this type of editing it can be helpful to store the Vertices and Indices in a local array or list. \u00a0Then make all your edits to the locally stored Vertex and Index lists and set a flag to signal that the mesh needs to be updated. \u00a0This allows for you to make multiple edits to the same vertices and only lock the mesh once for the final updated vertex.<\/p>\n
Helpful Thing I Learned<\/h3>\n
In order to edit a ID3DXMesh you will not be able to use a managed pool of memory. \u00a0So the locally stored vertices and indices also help in reconstructing the mesh after the device has been lost and reset.<\/p>\n
Even though you may not make any changes to the Indices within the index buffer of the mesh. \u00a0I found that I needed to still reset the indices at the same time I reset the vertices.<\/p>\n
If you are doing any light calculations it is nice to recalculate the normals after updating the vertices.<\/p>\n
Using some sort of shadowing can help define the shape of the terrain. \u00a0I used my modified SSAO shader to dynamically give detail to the curves of the terrain.<\/p>\n","protected":false},"excerpt":{"rendered":"Picking The Terrain\nThe first piece of information needed when morphing a terrain is to find out where the user wants to morph the terrain. \u00a0By …","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/posts\/519"}],"collection":[{"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":23,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":573,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/posts\/519\/revisions\/573"}],"wp:attachment":[{"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.westleywood.com\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}