====== SphericalDistort ====== ===== Plugin information === ^ Authors | [[user>Aaron]] and [[user>Tillot]] | ^ Description | Applies a spherical distortion to a heightfield and water map. | ^ Menu option | '//Extensions->SphericalDistort//' | ^ Download link | [[http://www.bundysoft.com/L3DT/downloads/plugins/bin/SphericalDistort-bin.zip|SphericalDistort-bin.zip]] | ^ Source code | [[bundydocs>zeolite:downloads:examples|Over here]] | ===== What does it do? ===== A picture tells a thousand words, so here's three thousand: ^ Before ^ After (pos. radius) ^ After (neg. radius) ^ | {{:plugins:calc:atsphericaldistort:sphdist_before.jpg?280|Before distortion}} | {{:plugins:calc:atsphericaldistort:sphdist_after.jpg?280|Positive radius}} | {{:plugins:calc:atsphericaldistort:sphdist_after2.jpg?280|Negative radius}} | As you can see, //SphericalDistort// distorts the heightfield as if it were on a sphere. This plugin, and L3DT in general, cannot produce //complete// spherical worlds. This is due to some [[wp>Topology|topological]] differences between planes and spheres. ===== Using SphericalDistort ===== When you select the '//Extensions->SphericalDistort->Apply spherical distortion//' option, you will be asked to enter the sphere radius, which is measured in kilometres. Regarding the radius: * The default value is the radius of Earth (6400km). * A negative value will create an inner-sphere effect, or can be used to un-do a positive distortion. * You should not use radii smaller in magnitude than about 4x the largest side-length of your map, as heightfields tend to look a bit silly when tilted too far (see screenshots above). ===== Extended clipping options (by Tillot) ===== I hacked the source for the SphericalDistort plugin to allow for limiting the curvature in the x,y, or at some specified radius. This allows for 'pieces' of a sphere to be generated kind of like a cookie cutter. The option is available using the 'Extensions->SphericalDistort->Apply spherical distortion (extended options)' menu option. Here's the heightmap: {{ :projects:terrainsliceheightmap.jpg?300 |:projects:terrainsliceheightmap.jpg}} Here's a terrain screenshot: {{ :projects:terrainslice.jpg?600 |:projects:terrainslice.jpg}} This plugin doesn't currently allow removing the surrounding terrain edges, but will some day (see to-do list). If the terrain is converted into a poly mesh it would then be as simple as using poly editing tool like Maya, Max, Lightwave, or Blender to cut out the pieces and stitch them together into a sphere. ===== To-do list ===== * Run in L3DT's worker thread. * Make last used settings persistent. * Export clipped area. * Set MAPFLAG_INVALID for TN, LM and TX (if UseLM enabled). ===== Changes ===== **2009/03/26** * Changed function arguments to VarID_hvars from VarID_maps. * Updated to Zeolite v2.7.1. **2008/12/03** * Added support for 'undo'. **2006/11/21** * Fixed fault with variable renaming in extended version. **2006/11/16** * Changed to include Tillot's modifications. **2006/10/23** * Changed radius from metres to kilometres. * Distort the water map too. * Updated MAPFLAG_MODIFIED for HF & WM, so maps are saved after distortion. * Released with L3DT v2.4b build 5. **2006/10/22** * Released.