TextureScape
Summary: This Lightwave [6] Modeler Tool plugin opens the Texture Editor and allows the user to interactively create a Lightwave object that approximates a landscape based on the texture's Image, Procedural, and Gradient layers. Instead of creating a large uniform rectangular grid of heights, this plugin allows the user to specify the number of points in the final object, then proceeds to optimize the landscape, creating an irregular triangulated Lightwave object that best approximates the original texture.
This plugin uses routines written by Michael Garland and Paul Heckbert, distributed as part of their public domain SCAPE Terrain Simplification software. The algorithms used in this software are described in their technical report titled "Fast Polygonal Approximation of Terrains and Height Fields" (Technical Report CMU-CS-95-181).
Lightwave [6] textures can be conveniently converted into landscape models simply using a displacement map on a subdivision surface (see Gregory Duquesne's Creating a Landscape tutorial). However, most landscapes require a very large number of subdivisions, resulting in a grid with very many triangles. A subdivision surface with a uniform mesh of points ignores the fact that most landscapes have large, fairly flat areas that can be approximated by large polygons.
Top view of a uniform mesh of points
(20 x 20 points, 722 triangles)
This plugin uses a greedy insertion algorithm to create an irregular triangulated object instead of a uniform mesh. This allows for a higher density of triangles in detailed areas of the landscape (such as mountain and coastline features), and far fewer triangles in the large, flat areas. The algorithm starts with the most simplistic triangulation of the data (2 triangles) and uses a multi-pass refinement method to progressively build the final object. Each pass locates the height value with the highest error in the current approximation, and inserts that point into the triangulation. This minimizes the errors in the approximation and also allows the user to specify the total number of points generated, which is the criterion used to terminate the algorithm.
Top view of a 400 point triangulated
irregular network (783 triangles)
The images below show a perspective view of a landscape at full
resolution, the same landscape sub-sampled to 2 smaller resolutions,
and 2 triangulated irregular networks (TIN) created with the
TextureScape plugin, that contain the same number of points as the
sub-sampled examples. Click on each image to view a larger version.
![]() |
![]() |
![]() |
![]() |
![]() |
| Full resolution 1201 x 1201 pts. 2,880,000 tris. |
Sub-sampled 60 x 60 pts. 6,962 tris. |
TIN 3600 pts. 7,157 tris. |
Sub-sampled 120 x 120 pts. 28,322 tris. |
TIN 14,400 pts. 28,700 tris. |
Obviously, the TIN landscapes display more detail in the mountain regions than the corresponding sub-sampled grids containing the same number of points. And even though the final TIN contains only 1% of the total number of points in the full resolution landscape, it is a fair approximation of the original.
WARNING: Always save any existing work on your computer before using the TextureScape plugin. The possibility always exists that TextureScape will crash Modeler or lock up your machine. I have attempted to make the plugin as safe as possible, however if you have unsaved work, I'm sure it will crash at the most inopportune time. Please heed this warning, I would hate to hear from someone who has lost valuable work.
The TextureScape plugin is a Modeler Tool which allows the user to interactively experiment with the plugin's parameters in a variety of ways. In many ways, it acts like other Modeler Tools like creating objects such as boxes and capsules or the scaling of the Spikey Tool. However, there are a few differences, but hopefully those differences will not cause the user much confusion.
By default, the plugin can be found by clicking on Modeler's Construct tab, then pulling down the Utility->Additional menu. After invoking TextureScape the first time, the Texture Editor window will be displayed, and a flat plane composed of 2 triangles will appear in the quad views of Modeler. The flat plane will be displayed until an actual texture is specified in the Texture Editor. At any time, you may click in one of the quad view windows, and hit the "a" key to autosize the windows to the texturescape object.
After you make changes in the Texture Editor, click or drag the mouse in one of the Modeler viewports to view the changes. You should see a low resolution version of the texturescape drawn as a blue wireframe, and once the mouse button is released, you will also see the actual texturescape object drawn in whatever mode your viewports are normally drawn. The texturescape will always be created with the Yaxis as the "up" direction, so dragging the mouse in the "Back", "Front", "Right", or "Left" viewports will usually result in the best interactivity while scaling the low resolution, wireframe approximation of the texturescape. Remember, changing texture values in the Texture Editor does not automatically trigger a re-draw in all the viewports... you will need to click or drag the mouse in a viewport to refresh the object.
Since the texturescape is always created with the Y-axis as the "up" direction, you will always want to remember to set your Texture Axis for images and the Displacement Axis for procedurals to the Y-axis. If you try to use the X or Z axes, you will not see anything but the flat plane that was originally shown when you first invoked the TextureScape plugin.
To create the final texturescape object, you will need to "drop" the TextureScape Tool by hitting the space bar or selecting another tool. Probably the best way to complete the texturescape is by hitting the "m" key, which activates Modeler's Merge Points command. You will want to do an Automatic merge of all the points in the texturescape, because each triangle was created seperately, and therefore each visible point in the object is really multiple points stacked on top of each other. This automatic merge makes the final object much more efficient, makes all the triangles "connected", and also allows the surface to be "smoothed". (For those of you familiar with DEMScape, this merge was not necessary because DEMScape was a CommandSequence plugin, and I could do the automatic merge in the plugin's code. Since TextureScape is a MeshEdit Tool plugin, I do not have the capability of doing the merge from the code.)
As
with other Modeler Tools, you may also hit the "n" key
while the tool is active to bring up the numeric options for the tool.
Here is a brief description of the Numeric panel's options:
Texture button:
This button just toggles the Texture Editor open or closed.
Height Scale:
The scale factor for the height of the texturescape. This is the parameter that is changed when interactively dragging the mouse in one of the Modeler's viewports. If you interactively drag the mouse, the actual texturescape object is erased and the low res approximation to the texturescape is the only thing that is redrawn in the viewports until the mouse button is released, at which time the actual texturescape object will be redrawn. If you use arrow button in the numeric panel to adjust this parameter, it will be slower because the previous texturescape object is also drawn along with the low res version while the mouse is being dragged.
Length and Width:
These parameters determine both the length and width of the texturescape, but also the number of samples taken along each dimension of the texture. As the length and width increases, the resolution of the texturescape will increase, and the time it takes to calculate the texturescape will also increase. It is best to keep these values as low as possible until the final generation of the texturescape. Also remember that when the length and width are increased or decreased, you will probably need to adjust the Height Scale value. For instance, if you change the length and width from 100 to 1000 to generate the final object, you will need to increase the height scale from 0.3 to 3.
Final Point Count:
This is the total number of points that will be present in the final triangulated landscape.
Data Dependency:
TextureScape uses either a Delauney method or a data-dependent method to triangulate the data points in the heightfield. If this button is checked it will use the data-dependent method.
Delauney triangulation is the faster method, but it makes no use of the heights of the vertices. It only attempts to create well-shaped 2D triangles, completely ignoring the 3D structures of the landscape. Data-dependent triangulation provides more control over the approximation method but is slower than the Delauney method. The data-dependent method generates a slightly better quality approximation because the topology of the triangulation is based on the 3D fit of the surface to the original input points.
If the Data Dependency button is checked, the following parameters will also be available. For more information about these options, you will need to read the technical report referred to in the summary section of this page.
Supersampling threshold:
This parameter controls the algorithm's supersampling resolution. 0 results in infinite supersampling, 0.8 in moderate supersampling, and a large number (such as the default) results in no supersampling. The lower the number, the more time it takes to generate the texturescape.
Quality threshold:
Determines the quality and amount of the data dependent triangulation. 0 results in pure data-dependent triangulation, 1 results in pure shape-dependent triangulation, and any value in between results in a hybrid of the two. Hybrid methods tend to yield the best overall approximations.
Maximum error:
Three different ways for computing the error between the data in the height field and the triangulated surface.
Currently, the TextureScape plugin is only available for the Intel platform. If you would like to attempt a compile on the Mac platform, please contact me (marvinl AT email.arizona.edu) for the source code (be warned, some people have successfully compiled it on a Mac, but every attempt has resulted in the plugin crashing when executed).
Intel Executable: TextureScape.zip
Intel x64 Executable: TextureScape_x64.zip
Source Code: I will gladly give
the source code for this plugin to anyone interested.
Just send me some e-mail (marvinl AT email.arizona.edu) and ask.
(To compile the source code, you will
need a C++ compiler that supports templates.)