Plsm configuration file

Source: Internet
Author: User
Document directory
  • Texture
  • Data Source Definition
Directory
  • 1 Introduction
  • 2. Select a map

    • 2.1 maptools. cfg
    • 2.2 paginglandscape2.cfg
  • 3. Map definition details
    • 3.1 Public configuration options (maptools. cfg and paginglandscape2.cfg)

      • 3.1.1 map Definition
    • 3.2 dedicated configuration for map Segmentation
      • 3.2.1 height chart Definition
      • 3.2.2 Data Source
      • 3.2.3 texture
    • 3.3 runtime configuration (plugin configuration)
      • 3.3.1 paging options
      • 3.3.2 Data Source Definition
      • 3.3.3 material definition
      • 3.3.4 more options
Introduction

Before continuing, pay attention to the relevant content in paging Scene Manager.

The configuration file mentioned later is a text file with the ". cfg" extension in ogre. In the configuration file"Key = Value"Format exists, for example:" imagespenders = yes ". 'Yes' or 'No' is used as the set value for the Two-choice option. In the configuration file, the writing order of configuration options does not matter, but the case-sensitive format of configuration items that appear in the form of strings is very important ).

For each map, you must have two configuration files, similar to XXX. cfg and XXX. gen. cfg. The previous one must be used when the plsm loads a map, and the later one is used when the tool software paging the map.

When creating a new map (assuming a 4096x4096 pixel map), you need to do the following to make plsm render it:

  1. First, you need to define a map segmentation configuration file (similar to XXX. gen. cfg mentioned above), which describes how you split and configure its texture;
  2. Then, you need to add the name of the configuration file formed in the previous step to maptools. in CFG, maptools. CFG has a map list. You can separate only one map at a time or multiple maps at a time. The map after defaultmap will be split first. As to whether the map will be split, it is determined by the batchmode behind it. If it is set to yes, all the maps in the list will be split, = No, only the map after defaultmap is split;
  3. Run the map splitting tool. [Translator: I recommend the one presented in the demo here. I think it is okay.] Note: depending on the configuration options, this process may take longer;
  4. Once you create a split map on the hard disk, if it is configured with a suitable runtime configuration file (that is, the xxx mentioned above. CFG files), plsm can render your map;
  5. In the runtime configuration file, you must at least define where to find the map files, how to load them, and how to apply the default texture mode. In fact, some options should be consistent with the split configuration file; otherwise, problems may occur during running.
Map selection Configuration

The configuration files maptools. cfg and paginglandcsape2.cfg list available and default maps.

The configuration file maptools.htm is used by the splitting tool, and the paginglandscape2.htm file is used by demo_paginglandscape2.exe. When running your own application, you can copy paginglandscape2.cfg and rename it (for example, plsmterrain. cfg). Use the setworldgeometry function of the scenario manager to load the file.

Example: mscenemgr-> setworldgeometry (Ogre: string ("plsmterrain. cfg "));

Maptools. cfg
  • Defaultmap: default map to be split. The map is always split first (if the program has no running error );
  • Groupname: Resource Group. You can find the location of the map configuration file;
  • <Short Map Name> = <Config File Name>: the short Map Name specifies the configuration file name (without a suffix), while the config file name indicates your split configuration file name (without a suffix ). Example: hf_129_3 = hf_129_3.gen. You can list more than one map, which can be processed one by one (if batch mode is enabled );
  • Batchmode = yes/no indicates whether you want to split all the listed maps or just split the default map.

Example: (maptools. cfg ):

# Default map. If batchmode is set to no, only the map is split.
Defaultmap = myterrain
# Other maps. If batchmode is set to yes, the map will be split.
Puget_sound = puget_1k.gen
Grand_canyon = gcanyon_height_4k2k.gen
Myterrain = worldterrainmap. gen
# Resource Group description. All plsm2 resources in this resource group can be found.
Groupname = plsm2
# Batch mode: Yes = splits all the listed maps. No = splits only the default maps.
Batchmode = No
Paginglandscape2.cfg
  • Defaultmap: the first map when the application starts to load. If it is set to "NONE", plsm2 will not load any map (default value: none );
  • Groupname: Resource Group description, indicating where the map configuration file can be found;
  • <Short Map Name >=< Config File Name>: Multiple maps configured. For example, myterrain = worldterrainmap. You can list more than one map and set defaultmap to select who to use;
  • Textureformatdebug: try to force texture mixing (default value: no ).

Example: (paginglandscape2.cfg ):

# Default map: Map to be loaded
Defaultmap = myterrain
# Other maps
Puget_sound = puget_1k
Grand_canyon = gcanyon_height_4k2k
Myterrain = worldterrainmap
# Resource Group
Groupname = plsm2
# Do not try to force texture Mixing
Textureformatdebug = No
Map definition details

The name of the map configuration file must be the same as that given in "defaultmap. That is to say, for "defaultmap = test", the configuration file name of the map is "test. cfg ". When plsm loads the map you specified, these settings may be used to index data files.]

Public configuration option map Definition
  • Groupname: Resource Group. All maps and map textures should be included in this resource group (see resource. cfg)
  • Landscapefilename: Terrain file name (not extension), must be in the resource path of ogre and under the Resource Group specified by "groupname"
  • Landscapeextension: The extension of the terrain file. Raw: if the format is 16 bits raw, the other supported terrain file formats are 8 bits, but the PNG 16 bits terrain file also supports (default value: PNG)
  • Landscapeexportextension: Description of the suffix format for Terrain Export (if you want to export 16 bits, use raw or other formats you need)
  • Textureextension: The generated texture extension. PNG can get the least loss of data. DDS is no longer supported now (default value: PNG)
  • Scalex, scaley, scalez: The terrain scaling factor can be different in the splitting setting and app setting, but it should at least be consistent with the terrain proportion. Otherwise, the splatting and normal of the texture are no longer true (default value: 1)
  • Pagesize: The pixel size of the page split from a height chart. It must be 2 ^ N + 1,513. This is usually a good setting (default value: 513)
  • Tilesize: The pixel size of the tile of the height chart, which must be 2 ^ n + 1. 65 is usually a good setting (default value: 65)
Height map definition for map Segmentation
  • Outdirectory: Specify the location where the split tool will store the generated data (use "landscapefilename" to add the file specified in the "landscapefilename" configuration item previously configured)
  • Minimap: Whether to generate minimap. It may be usable on the eagleeye graph (default value: No)
  • Paged: Determines whether to split the terrain file and texture file. It is mainly used for debugging (default value: Yes)
Data Source
  • Data2dformat: The type of the height chart. Optional values: 'heightfield', 'heightfieldraw', 'heightfieldn ', 'heightfieldntc', 'heightfieldrawtc ', and 'heightfieldraw '. (default value: heightfield );
  • Maxvalue, minvalue: If data2dformat = 'heightfieldtc 'is compressed, you need to know where the value range is from where the heightfield file is compressed (default: 5000, 0 ).
Texture
  • Colormapname: Name of a color texture chart. The color texture you set for your entire height chart, the splitting tool may be based on your settings, split it into several small textures so that plsm2 can be used directly (textureformat = image );
  • Colormapsplit: If you want to split a color texture image, set it to Yes (used with textureformat = image ). (Default value: No );
  • Imagesploud: Either 'yes' or 'no'. It is applicable to the "imagepaging" terrain texture mode. If colormapsplit is not set, this option is detected. If this option is set to yes, the splitting tool will split the large image into a small image suitable for the page size;
  • Litcolormapsplit: If you need to illuminate the terrain. See the following lighting options (default value: no );
  • Infinitemap: If you want your map to be infinitizable. (default value: No)
  • Heightmapblurfactor: Blur factor of the height chart. If you want to make the height chart smoother (default value: 0.0f)
  • Equalize: Make sure heights use the whole range 0-255 or 0-65535. (default value: No)
  • Heightmap: If you want to divide your height chart into a height chart of the same format (8 bits image or 16 bits raw (or PNG) format to adapt to data2dformat = heightfield, heightfieldraw, or heightfieldtc ). (Default value: No)
  • Normalmap: Generate a line chart. RGB is xyz normal. (default value: No)
  • Heightnormalmap: Generates normal maps and store it as RGB as XYZ normal and Alpha as 8 bits heightmap (usable with data2dformat = heightfieldn, or heightfieldntc) cannot be combined with raw files (it gives 8 bits instead of 16 bits .) (default value: No)
  • Colormapgenerated: Generate a color texture map. It is now obsolete. (Default value: No );
  • Litcolormapgenerated: Generate a color texture map with added lighting effects. For details, see the settings below (default value: no)
  • Nummatheightsplat: Specify the number of segments to be divided into. For details, see the settings below (default value: 0)
  • Materialheight1, materialheight2: The height segment value in the form of a percentage of the highest Terrain Height. Use splat0 below materialheight1, which is greater than materialheight1 but smaller than materialheight2 to use splat1 and greater than materialheight2 to use splat3;
  • Splatfilename0, splatfilename1, splatfilename2, splatfilename3, splatfilenamex: If you use the height segmentation method, these file names are the input of textures you configured for different heights, but these textures are still based on the basetexture texture layer (that is, the layers will be mixed with the basetexture texture layer when the texture is mixed );
  • Basemap: The basic texture set for a large scale will affect the distant terrain range, but it is different from basetexture. (Default value: No)
  • Litbasemap: Similar to the basemap above, but it has a bonus illumination effect. (Default value: No)
  • Coveragemap: Coverage is rgba, each channel has info for 1 splat (textureformat = splatting3). (default value: No)
  • Alphamaps: Generate an Alpha layer for each splatting (textureformat = splatting2, splatting4, splatting6, splatting7 ). (Default value: No)
  • Lightmap: Generate a illumination chart. With 8 bits texture white is full light to black being full shadow (see textureformat = splatting4). (default value: No)
  • Shadowmap: Used for debugging, which is opposite to the illumination diagram. (Default value: No)
  • Sunx, SUNY, Sunz: If the illumination graph is calculated and generated, the three values specify the direction of sunlight in vector mode.
  • Ambient, diffuse, blur: Parameters required to generate a illumination chart, including ambient light color and diffuse reflection color.
  • Zhorizon: Horizon mapping with Sun always on Z axis, and thus can be used in a shader to Real-Time shadows a terrain. (default value: No)
  • Numsplatmaptosplit, splatmapname0, splatmapname1, splatmapname (n) ': Specifies additional map you want to split. (user provided Alpha SPLA maps, for roads or anything)
  • Alphasplatrgbamaps, alphasplatlightmaps, rgbmaps, horizonmap, elevationmap, pvsmap: Deprecated. (default value: No)
  • Texturemodifiable: Whether the texture should/can be changed by users (for example, painting/deformation ). [Translator: this feature is very interesting, for example, decal and terrain editing that we often discuss].
Configuration File paging option during runtime
  • Width: the width of the world. In the X direction, the number of Columns cannot be the default value. For example, if the value is 4, each row (in the horizontal direction) has four pages;
  • Height: the map height. In the z direction, the number of rows cannot be the default value. For example, if the value is 2, two rows exist;
  • Visiblerenderables: sets the number of tiles radius that can be seen around the camera.
  • Maxadjacentpages: determines the number of radius of pages to be loaded around the camera (not necessarily visible, depending on visible renderables.) (default: 2)
  • Maxpreloadedpages: the number of radius of pages to be preloaded around the camera (which must be larger than maxadjacentpages) (default value: 3)
  • Maxnumrenderable: Maximum number of loads that can be rendered at a time;
  • Maxnumtiles: specifies the maximum number of tiles that can be loaded at a time (that is, the size of the tiles buffer)
Data Source Definition
  • Data2dformat: 'Hightfield', 'hightfieldraw', 'hightfieldn', 'hightfieldtc ', 'hightfieldntc', 'hightfieldraw'. Specify the format of the height graph page data file. Heightfield corresponds to 8-16 bits grayscale image files, heightfieldraw corresponds to 16 bits raw format, and heightfieldn corresponds to 8bits grayscale image files + and 32bits line chart files. The format TC corresponds to maxvalue, minvalue for highly scaled data sources (default value: heightfield );
  • Maxvalue, minvalue: If data2dformat = 'heightfieldtc ', this setting will referMaxvalue, minvalueThe specified range scales the Y value of each vertex, whereMaxvalue, minvalueHeight range. (Default value:, 0 );
  • Deformable: whether the terrain supports real-time deformation (default value: No );
  • Texturestretchfactor: texture extension factor, acting on pagesize and texturesize. For example, to store a 1024 texture on a 513 page, set texturestretchfactor to 2 (default: 1.0f ).
Material Definition
  • Textureformat: Defines how the terrain will be colored. If you want to use your own texture, image it?
Texture Mode

The texture mode determines how your terrain is colored. you can use a large image (color texture modes) for each page, or use splatting to get some near-earth details, but it will consume more GPU and memory resources.

Texture mode provided by plsm2

Color Texture mode:

Fixed pipelines:

  • Image: Use the map specified by the user (for example, generated by terragen)
  • Basetexture: colormap generated based on height and slope Calculation
  • Basetexture2: similar to basetexture, but pregenerated
  • Instantbase: similar to basetexture, but uses a pre-generated method, and dynamicallyDeformationReflected to the terrain.

Shader programmable pipeline:

  • Instantbaseshadowed: similar to basetexture, but uses a pre-generated method, but dynamically changes the shadow according to the sun's position.


Splatting mode:

Fixed pipelines:

  • Splatting: calculates the layer-4 alpha image (each image corresponds to a splats, based on the height and inclination) => 4-Channel 2 Texture unit
  • Splatting2: similar to "splatting" (use a pre-generated 4-layer Alpha chart) =>4-Channel 2 Texture unit
  • Splatting4: similar to splatting2, but each channel has seven texture units (using a pre-generated 4alpha image) => 1-Channel 7 texture units

Shader programmable pipeline:

  • Splatting5: similar to splatting4, but with 1-Channel 4 texture units, the pixel shader (arbfp1 or ps_2_0) and 1-Channel 4 texture units are used in real time (no alpha diagram is used, therefore, fewer texture units are used)
  • Splattingshader: similar to splatting4,1-channel, 4-Texture unit, using pixel shader (arbfp1 or ps_2_0), 1-Channel 7 Texture unit (using the Alpha image)


Splatting lighting mode:

  • Splatting3: 1 channel, 3 texture units + 1 illumination = 4 (use a pre-generated 3 Alpha image)
  • Splatting6: similar to splatting2, but each channel has three texture units and four channels (using a pre-generated 4 alpha chart)
  • Splatting7: Multi-Layer Texture splatting. Each channel uses 6 texture units (Use a pre-generated 3 Alpha chart)
  • Numtextureformatsupported: Set the number of supported texture formats (depending on the format you used when splitting a map, coverage or light texture layer];
  • Textureformatsupported <n>: List all texture formats supported by this map. (For example, textureformatsupported0 = base textureformatsupported1 = instantbase );
  • Materialheight1, materialheight2: The height split line in the form of a percentage of the maximum height. In the lower part of the terrain splat0, higher than materialheight1 but less than materialheight2 terrain splat1, higher than materialheight1 but less than materialheight2 terrain splat2, higher than materialheight2 terrain. (Used in real-time splatting mode, or when the terrain requires a texture update due to deformation)
  • Splatfilename0, splatfilename1, splatfilename2, splatfilename3: Map defining textures used as input for averaging colors in basetexture map generation.

Textureformat = splatting4)

More configuration options
  • Maxrenderlevel. Must meet 2 ^ maxrendervel <(tilesize/2 ). 0 means lodvalue is not used, and 100 means the maximum possible value. (Default value: 100 );
  • Maxpixelerror: the maximum error allowed when determining which d3to use. That wowould determine complexity on screen. More precise means slower. (default value: 8 );
  • Pagesize: determine how the GPU divides the terrain into batches because it determines the texture size of each page. This value is relatively large, but not all graphics cards support large textures. (Note: plsm2 demos uses a small size of 257, mainly to test the page management function), but this may make you mistakenly think that plsm2 is slower than TSM. With the same pagesize and number of pages, you may get the same (or faster) results. You can try 513, (default value );
  • Tilesize: this value is difficult to adjust. It determines the size of the vertex buffer. A large tilesize (> 193) causes plsm2 to use the index buffer of 32 bits (slower or not supported by all graphics cards); a small tilesize (<65) plsm2 will process thousands of tiles in each frame and increase the number of GPU batches, but it will be able to get more cutting optimizations (pyramid cutting, horizontal line cutting, cut the tree ...). (Default value: 65)
  • Vertexcompression: If your video card supports it, enable it (if your video card does not support it, this setting will be ignored ). On the premise of GPU Factor 3, it will affect the usage of GPU memory (default value: No );
  • Vertexprogrammorph. However, this will cause a great performance loss, so it is better to disable this function if the performance is not good. (For ATI, when OpenGL is used, a bug of the driver will also be thrown );
  • Horizonvisibilitycomputing: horizontal cut calculation. If your map has mountains and cliffs, open it, but if it is just a plane, close it. All things (for now just other terrain tiles, soon also any objects) under the terrain tiles will not be sent to the GPU, which can greatly increase the frame rate, but this is only in special circumstances. (If it is always enabled, it will not affect performance too much) (default value: No)
  • Lodmorphstart: this is as a proportion of the distance between the current lods valid range, and the valid range of the next lower (default value: 0.2f)
  • Horizonvisibilitycomputing: Enable it if your map have moutains, cliff... not if it's mainly a plane. everything hidden will not be sent to GPU, thus saving framerates .. (default value: No)
  • Vertextive.

// Linux plugin is created as plugin_paginglandscape2.so and set up to run
// Via the Plugins. cfg Config File
// # If ogre_platform = ogre_platform_win32
// # Ifdef _ debug
// Root: getsingleton (). loadplugin ("plugin_paginglandscapescenemanager2_d ");
// # Else
// Root: getsingleton (). loadplugin ("plugin_paginglandscapescenemanager2 ");
// # Endif
// # Endif

If you have loaded the plsm2 plug-in plugin. cfg, comment out the plug-in here!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.