Back to Content

Terrain


CopperCube supports terrain rendering, and includes a sophisticated terrain editor, for creating terrain, plants, grass and more.



How to edit terrain

After you started and used the command to create a basic terrain, either by using the command "Edit -> Insert Terrain" or by clicking the terrain icon, you have the option to edit the terrain by a handful of new commands:





Distribute meshes across the terrain

Additionally, there is a command for distributing meshes, like trees or stones over the terrain. For this, you can use the tree generation or use any static or animated mesh. To start do the following:

Import your static or animated mesh using for example "File -> Import -> Static 3D Mesh from File" or "File -> Import -> Animated 3D Mesh". Note that you only can distribute animated meshes across the terrain, for performance and memory reasons (their data is shared and culled more efficiently), so if you use a static mesh, you have to convert it to an animated one: Right-click on it in the 3D view, select "Modify Selection -> Clone as static animated mesh". Then it will be added as static animated mesh, and shown in the animated mesh editor. In there, right-click and select 'Create instance'. Now you have this static animated mesh in your 3D view, and you can right-click it and select "Modify Selection -> Distribute over terrain"

This method of using animated meshes also has another advantage: In the Animated Meshes Editor, you can right-click into the 3D view and use the command "Set Static Collision Box" if you have a non-animated mesh in there. You can specify a box in there which is for example a bit smaller than the actual size of the mesh, which will then be used for collision detection. This is useful for example for trees: Let the box only sourround the trunk of the tree, so it is much easier to move through the terrain.


Add own meshes efficiently to the terrain

If you want to add your own meshes to the terrain, like for example houses or similar, and have them culled effiently in order to make your game or app run faster, you can do this easily:
In the scene graph explorer window, simply drag the mesh you want onto the terrain scene node. The mesh then will be attached to the correct terrain tile automatically, and only drawn and animated when necessary, making your app render much faster.
But there is a drawback: When you add a node as child to the terrain, the position of the node should not move anymore when your app or game is running. Or at least not move far away. So only use this for non-moving objects.


Tree generation


CopperCube includes the possiblility to create procedurally generated trees, based on user specified parameters. This feature is beta, and not very user friendly yet, but planned to be improved in future versions. Use the command "Edit -> Insert -> Create a tree" or the same scene editing button to open the tree generation dialog. In there, you can specify a lot of parameters for generating the tree.




Note that you can select 'generate as animated mesh' in order to make the tree to be usable easily for the "Distribute over terrain" command.


Wind


Grass and the leaves of the trees are moved by the wind, by default. You can adjust the wind parameters when selecting the root node in the scene graph explorer, by changing the values under the 'Wind' checkbox in the property window. Grass movement of the terrain can additionally by enabled/disabled in the property window of the terrain.

This feature works also for any other object you like: It is a material type setting: If you have a material of the type "Transparent (alpha channel)", you can select "Advanced Settings..." in the combo box of the material window, and check the "Moved by Wind" option.

This feature works on WebGL, Android and Windows/D3D targets. On systems not supporting this, the system automatically falls back to static vegetation. There is no performance impact, since every movement is computed on the GPU.


Textures for the terrain


We can recommend the software Genetica for creating textures to be used with the terrain in CopperCube. It is a very flexible tool, and also some of the textures included in CopperCube for the example terrain is based on textures generated with Genetica.


Import Heightmaps


You can import heightmaps from other programs into CopperCube. Just use the command File -> Import -> Terrain Heightmap. Coppercube is able to import terrain heightmaps of the format .raw, .r16, .r32, .png, .tga and .pgm. It also has the option to automatically apply textures to imported terrain and distribute grass onto it.

A good size for a heightmap to import is 128x128 pixels. You get (too) huge worlds for heightmaps bigger than that.