Importing Terrain Data in MojoWorld Generator V2This tutorial has been updated for version 2 of MojoWorld. The tutorial for version 1 is still here and may also shed light on the process, so you may also want to check that after you're through here. The term 'terrain data' refers to any file which can be interpreted as a height field. It includes some common image formats: .bmp, .png and .jpg and it also includes some formats that are specific to heightfield data: .pgm, .dem and .bt 'binary terrain'. This type of data may also be called a 'bitmap heightfield'. The type of data being imported will have an effect on how 'smart' the automatic height scaling is. For example, a high contrast bitmap consisting of text or a logo may be too exaggerated by the automatic height scaling, while a continuous tone image representing a terrain may not have enough exaggeration. This tutorial will use a text heightfield and will integrate it with the v2.0 default planet. For best results, use white text on a black background with a slight blur.
A lot about importing bitmap heightfields has been automated in version 2. This will first discuss all the things which happen automatically upon import. Next, it will go through the steps to integrate the bitmap with the planet's terrain. Finally, we'll do a material blend such that the lettering is a different material than the surrounding planet. These steps are not the only way to accomplish these or similar results - it's the underlying concepts to watch for here. To import terrain data, create a Parameter Bomb helper object then open the PB Editor dialog and choose 'Import Terrain' from the menu.
The Import Terrain menu item opens a dialog with spots for both a terrain texture and a color texture map. Use the checkboxes to optionally select which type of data you are importing - heightfield or color map. Both may be imported at the same time, or either one individually. Use the 'Load from Disk' icon at the end of the file name field to specify the file name.
KNOWN FORMAT ISSUES Some formats are better tested than others. Some have known bugs. Some you'll be able to import and it'll be just right. Some you'll import and then will have to spend time tweaking the parameters to fit the output of the bitmap to your world. For DEM files - the file must be uncompressed and end in a .dem extension. If you are selecting a SDTS DEM, the folder must be uncompressed and of the many files in there, load the one ending in CADT.ddf (all the files in an SDTS DEM end in .ddf but only the CADT.ddf one will load). More detail on DEM-related issues will be found in the DEM tutorial.
For PGM files - a known bug is that MojoWorld will not
correctly interpret PGMs with comments. A PGM is a text
file, so if a PGM results in a completely flat terrain
no matter what the Height Scale is set to, there's a good
chance the PGM has comments in it. To fix this problem,
open the PGM file in a text editor. The first few lines
of the file will look something like this:
Automated Terrain Texture Creation To access the terrain texture after import, click the Parameter Bomb land editor hot button - the circle-T highlighted in the hot button stack shown to the left. The relevant portions of the terrain texture editor look like this:
Parameters to note here are:
Automated Diffuse Color Texture Creation To access the diffuse color texture after import, first click on the circle-M highlighted in the hot button stack shown to the left. This will bring up the material editor from where the diffuse color texture editor can be accessed:
Click the T icon attached to the Diffuse parameter to open the diffuse color texture editor:
Automated Response Curve Creation Using the Import Terrain menu will not only automatically create the above items, but it will also edit the Parameter Bomb's Response Curve to automatically take the form described in the v1 tutorial. To adjust the abruptness of the transition between the parameters of the planet and the parameters of the area affected by the Parameter Bomb, edit this curve (brought up by clicking the Response Curve icon in the Parameter Bomb editor).
This composite image shows the same PB with the automatic Response Curve, the default curve (what you get if you click on 'reset curve' in the curve editor), and an edited automatic curve where the top left point has been moved to the right until it is at 0.5.
Adding In the Default Terrain To integrate the bitmap into the default planet terrain, we'll use the very same leaves as the terrain texture. A quick look in the default planet's terrain editor shows two leaves, one called 'Mountains' and one called 'Continents'. They are blended using the 'Multiply' blend option. Go back into the Terrain texture editor for the Parameter Bomb, enable the second texture leaf and choose 'Mountains' off of the DDLB:
Then enable the third texture leaf and choose 'Continents' off the DDLB:
Set the blend between the second and third leaves to 'Multiply':
Set the blend between the first and second leaves to 'Add':
Because we're adding in the same terrain as the surrounding planet, the Height Offset on the bitmap field is no longer needed. Change it to 0. And because we're using the exact same texture leaves for the Mountains and the Continents, changes to those will also happen inside the Parameter Bomb. Tweak with the Height Scaling parameter until the desired effect is achieved:
A Technique for Masking Materials The sample render above with the text-shaped terrain is interesting, but better still would be to have the lettering show up with a different material. Using the same bitmap that was used for the terrain as a mask is how that effect will be made. This process is not automated - configuring the bitmap mask will be done manually. Open the material editor for the material inside the Parameter Bomb. It may or may not have a material in it already, depending on whether or not a 'texture file' was imported through the Import Terrain dialog. Create a new material. Change the first leaf to a Nested Material Tree. Select the Planetary Material off the DDLB to the right. Enable the second leaf. Set the blend between the two leaves to 'blend'. Set the input coordinates of the blend to 'Helper Position' and choose the Parameter Bomb off the DDLB to the right:
Change the fractal to a Bitmap Node. Note that this has slightly different parameters than a Bitmap Heightfield. The important items to change are the Bitmap Size and the Bitmap Offset.
The bitmap to load in is the same one as is creating the terrain shape. Where the image is black, the first material leaf will be used. Where the image is white, the second material leaf will be used.
|