CreateObjectFromHeightMap

Description

Creates an object from a specified height map, useful for making terrain. The image should be PNG 8-bit greyscale or RGB, if it is RGB then only the red channel is read. 16-bit greyscale support may be added in future. The object will have a single UV channel with the range 0 to 1 mapped to the entire terrain. If you wish to modify this then you can use SetObjectUVOffset and SetObjectUVScale, or use a shader that multiplies the UV coordinates by a specified amount. A shader can also be used to create multiple UV channels from this single channel by applying different scale factors to each. A smoothing value of 1 is recommended to remove stepping artifacts, adjust as necessary. The split value lets you create multiple meshes which can improve performance, as unseen meshes will not be drawn. The split value specifies how many meshes to create along each edge, for example a split value of 5 will create 5x5 = 25 meshes in total. Unlike other objects collision data is not generated by default on this object as it can consume a lot of memory, use SetObjectCollisionMode if you want to turn it on. For terrains greater than 1024x1024 this is not recommended on mobile devices, and you should use GetObjectHeightMapHeight instead if possible. Turning on physics for this object will use even more memory and is not recommended on terrains greater than 1024x1024 on any platform.

Definition

integer CreateObjectFromHeightMap( szImageFile, width, height, length, smoothing, split )

CreateObjectFromHeightMap( objID, szImageFile, width, height, length, smoothing, split )

Parameters