目录

PLSM2

    假设,你可能已经对你的选择进行了评估,并决定开始使用Paging Scene Manager。

    如果你对怎样编译并安装Paging Scene Manager感兴趣, 参见 Paging Scene Manager Installation。如果你对使用PLSM2创建新的应用程序感兴趣,参见 Creating a PLSM Application

    Paging Scene Manager 允许将场景分割成多个pages。这些pages只有在需要被加载的时刻才会被加载到内存中,当然也允许你武断地加载一块非常大的场景。每个page使用自己的heightmap,每个 heightmap可以使用多层纹理。(例如:你可以为大雪覆盖的山顶单独应用一块表示积雪的纹理。)

    目前的最新版本是paging landscape manager 2 (PLSM2),好像PLSM3还需要等待一段时间。(我对这个比较担忧)

    A good Introduction to PLSM2 use is Terrain Scene Manager, from which PLSM2 is derived and why would you use heightmaps

   关于PLSM2的一些帮助,bug,请求,及较集中的讨论在 这里 可以看到,在发帖之前请阅读已经发过的帖子。
    最新的win32二进制Demo和示例地图在 这里 (03/07/2005)
    SVN上的PLSM2代码是最新版本的源代码, 仅仅与最新的Ogre (1.6 及更高版本)兼容。
    已经打包的可供下载的源代码与OGRE v1.2兼容,可以在 这里 下载。

    SVN上目前有4个部分可以使用:

    你可能还会看到其它一些文件夹:WIP (IPLSM) 或者老版本的PLSM1

Plugin

介绍

    plugin包含了所有你需要的关于terrain scene manager的东西,而不仅仅是"分页":

  • 优化的渲染过程,包括内存的使用(vertex compression aka displacment mapping, texture coordinates sharing) 和运行速度(LOD).
  • Real-Time Deformations
  • Quality render with splatting, morphing, real-time mountain shadows, 超大纹理 (可以比高度图heightmap的尺寸更大(比如用2048x2048的纹理作为513x513的 page 已经变得可能))
  • Its flexibility, as all texture modes and datasource can be plugged in and out, tilesize and page size
  • Map loading, unloading and changing at the speed of light.
  • Build on top of an octree scene manager it handles all sort of queries (ray, sphere, box, etc...)
  • Offers software horizon occlusion culling. (Hardware occlusion query is to come)
  • To be used with maptool and mapeditor, that splits map generates automatically, at the resolution choosen, normal map, horizon maps, texture maps, etc... in order to help you texturize the terrain.
  • Paging.
  • Coherent Occlusion Culling : 意味着观察者看不见的objects根本就不会渲染,节省了宝贵的FPS。

特性

  • Real-Time Deformations (Craters predefined, user can submit a Float Array containing Delta to apply to terrain, like a Brush in a paint tool.)
  • 10 different texturing methods :
    • Splatting (using multi-texture, multi-pass or using shaders)
    • Real-Time Texturing (creates Textures on the fly, or updates it upon deformations)
  • Geomipmaping LOD (LOD choice comes upon tile complexity, screen size and camera to tile distance)
  • GeoMorphing between Lod transition (using vertex shaders, it's visually great but is slower and takes more GPU memory. I would consider using it with 128 memory GPU card at least of one years old GPU ( ATI 9800, NVIDIA geforce fx 5,6 or when wihtout it, and you have at least 140 fps in windowed mode. (be aware that fullscreen mode is faster.)
  • Octree Culling .
  • Horizon Culling (do not show tiles hidden by moutains)
  • Displacement mapping : defining a point only by its Y instead of X,Y,Z (using vertex shaders, divides GPU memory by 3, named VertexCompression in cfg files)
  • Buffer Sharing Texture coordinates and IndexBuffers sharing across pages (saves GPU memory by number of pages)
  • Tiles and Renderables Pooling.
  • Load Queues : Data, Texture and uploading to GPU are done separatly and not at the same time, preventing frame hits. Pages are queued and loaded using a distance to cam sort (nearest pages loaded first).
  • Paging Event Listener that gives you Load, unload, deformed events, along with a pointer to heighfield data.
  • Perfect Ray Scene Queries that interpolates between terrain vertices even near boundaries of tile/page (stitching make it harder on this case.)

数据资源加载模式

    数据资源加载模式定义了怎么加载你的地形数据。你可以使用8bits的图像(OGRE支持的任何格式),或者16bits的Raw格式(可以通过terragen导出)。It can transform heights on Load (TC) or loads land Normals along with land heights. Raw is recommended for best details.

  • Ogre::PagingLandScapeData2D_HeightField : 从8bits灰度图加载地形;
  • Ogre::PagingLandScapeData2D_HeightFieldN : Loads data from a 8bits grey image, and Normals from 32bits image
  • Ogre::PagingLandScapeData2D_HeightFieldRaw : 从16bits raw格式加载;
  • Ogre::PagingLandScapeData2D_HeightFieldRawTC : Loads data from 16bits rawimage and expands heights using TC algo.
  • Ogre::PagingLandScapeData2D_HeightFieldTC : Loads data from 8bits grey image and expands heights using TC algo.
  • Ogre::PagingLandScapeData2D_HeightFieldNTC : Loads data from 8bits grey image and expands heights using TC algo, and Normals from 32bits image
  • Ogre::PagingLandScapeData2D_Spline : create on the fly spline terrain
  • Ogre::PagingLandScapeData2D_HeightFieldBlendNeighbor: Loads data from a 8bits grey image, and blend it with already loaded neighbors. (dynamically created pages)
  • intensively tested and supported.

纹理模式

    纹理模式决定了你的地形将被怎么着色。你可以为每个Page使用很大尺寸的纹理文件 (彩色纹理模式), 或者使用splatting 以得到更好的地形细节, 但是这样会消耗更多的GPU和内存资源。

PLSM2 提供的纹理模式

彩色纹理模式:

固定管线:

  • Image : 使用给定的Map(例如:用terragen生成)
  • BaseTexture : Computes a Color Map based on height and slope
  • BaseTexture2 : 和BaseTexture差不多,但是是预计算的。
  • InstantBase : like BaseTexture but using precomputed map, and reflect deformation on terrain dynamically.

shader:

  • InstantBaseShadowed : like BaseTexture but using precomputed map, with dynamically shadow changes upon sun position.


Splatting Modes :

fixed pipeline :

  • Splatting : Computes 4 alpha maps (one for each splats, based on height and slope) => 4 passes 2 texture unit
  • Splatting2 : like "splatting" (using precomputed 4 alpha maps) ) => 4 passes 2 texture unit
  • Splatting4 : like splatting2 but 7 texture units per pass (using precomputed 4 alpha maps) => 1 passes 7 texture unit

shader :

  • Splatting5 : like splatting4 but 4 texture units 1 pass, use of a Pixel Shader (arbfp1 or ps_2_0) 1 passes 4 texture unit all real-time (no alpha maps, so uses less texture units)
  • SplattingShader : like splatting4 but 4 texture units 1 pass, use of a Pixel Shader (arbfp1 or ps_2_0) 1 passes 7 texture (using alpha maps.)


Splatting Lighted Modes :

  • splatting3 : One pass, 3 Texture Units + one for light = 4. (using precomputed 3 alpha maps)
  • Splatting6 : like splatting2 but 3 texture units per Pass, 4 Pass (using precomputed 4 alpha maps)
  • Splatting7 : multitexturing splatting using 6 Texture Unit in one Pass (using precomputed 3 alpha maps)

用户自定义纹理模式

    Provide the Plugin the material script you want to use using CFG file or setOption mechanism. Inside the material script you provide, just use keyword inside material scripts : Splatting, Alpha, Coverage, Horizon, Image, Light and those keywords will be dynamically replaced by the related page texture (Coverage will become coverage.1.2.0.png if page X is 1 and page Z is 2 and Coverage keyword is read for the first time in this material technique.)(case sensitive.)

Best may be to have a look on plsm2 provided texture mode material scripts to read some samples on how to do that.

速度优化

  • MaxPixelError : The maximum error allowed when determining which LOD to use. That would determine complexity on screen. More Precise means slower.
  • PageSize : determines how 'GPU batched' your terrain will be, as it determines the size of the texture per page. Bigger is Better, but not all video card would support too big texture. (note that plsm2 demos uses small pagesize like 257, mainly for page management testing), that can lead to false impression that PLSM2 is slower than TSM. At same pagesize and number of page, you'd get same results or faster. try 1025, 2049.
  • TileSize : Difficult to tweak, 决定了顶点缓冲区的大小。使用太大的Tilesize (> 193),将使plsm2使用32位索引缓冲区(减慢速度或者得不到所有显卡的支持)。使用太小的Tilesize (<65) 将使plsm2在每一帧里处理数以千计的tiles并带来很高的GPU渲染批次,但是可以得到更多的裁减优化(视锥裁减, 地平线裁减,八叉树裁减...)
  • 顶点压缩:如果你的显卡支持该技术,请打开它 (如果显卡不支持,将会被忽略). It divides GPU Memory usage by at least factor 3.
  • VertexProgramMorph : If you notice too much popping when tiles changes Lod, this reduce it a lot. But it has a big performance cost, so in case of bad performance, be sure to diable it. (on ATI opengl, it leads to a driver bug.)
  • HorizonVisibilityComputing : enable it if your map have moutains, cliffs... not if it's mainly a plane. Everything (for now just other terrain tiles, soon also any objects) hidden by Terrain Tiles will not be send to GPU, saving massive amounts of framerates, but in particular case. (didn't cost much if enabled anyway.)

Coherent Occlusion Culling (CHC)

  • Using setOption, getOption Mechanism, per camera, you set the occlusion mechanism.

ie : scenemgr->setOption ("NextCullMode", myCamObject); scenemgr->setOption ("setCullingMode", "VIEW_FRUSTUM_DIRECT") scenemgr->setOption ("setCullingMode", "CHC") scenemgr->setOption ("setCullingMode", "CHC_CONSERVATIVE")

  • Nodes are now either static or movable (use static in entity names), so they're either in Octree or loose octree.Nodes are either Occluders, Occludee or none (skipping tests.).
    • A node is a static if containing only entities that name begins with "Static".
    • They're Occluders only if containing entities that begins with "StaticOccluder".

(StaticGeometry, Terrain Renderables are static occluder by default.)

    • They're Occludees only if containing entities that begins with "Occludee".

Run Time Option and Scene Manager Features Uses

Paging Scene Manager Option

Demo Application

Usage:

  • F1 = cycle Help / debug panels
  • M = Switch between camera mode and cursor mode (that enable deformation, and sphere test)
  • K = Texture Mode changes, 'n', 'p' or 'l' for map changes.
  • N, P or L, = Load Next, Previous or reload map.
  • LEFT CONTROL = Increase the moving speed
  • A = Move Left
  • D = Move Right
  • W = Move Forward
  • S = Move Backward
  • PgUp = Move Up
  • PgDn = Move Down
  • Cursor Right = Rotate Right
  • Cursor Left = Rotate Left
  • ESC = Exit
  • F = Show/Hide the debug overlay
  • T = render terrain Solid/Wireframe
  • PrtSc = Makes a Screenshot
  • F2 = Display the terrain height at the current position.

Mapsplitter应用程序

    map splitter 将地形分割成sections,这些sections可以被PLSM作为page载入,预计算和生成基本纹理和splatting textures。也可以计算光照图和blur heightmaps。所有的参数都来自配置文件: maptool.cfg 和为每一张图配置的配置文件。maptool.cfg 文件"DefaultMap"指明了将要生成的每一张地图的配置文件的名字。maptool.cfg 基本上就是将要分割成的地图的列表,in batch mode or one at a time.

    既然MapSplitter是一个Ogre应用程序的plugins,资源配置文件就必须设置正确。在运行时,程序将会生成.log格式的文件。在调试时如果程序出现问题,log文件里将会记录详细的信息。

高度图

    作为mapsplitter的输入的是一个单个的大的地形高度图,该高度图将会被分割成很多尺寸和格式都正确的pages,以使你可以运行plugin。 (如果没有分割高度图,将不能正常运行 (除非你仅仅使用一个page。))

Config

    见 PLSM 配置文件介绍

安装

    见 PLSM安装过程介绍

与物理引擎的集成

与PagedGeometry的集成

Todo

PLSM2 Todo

PLSM3 roadmap

Known Bugs

- searching ! - Please Report plsm2 ogre addon forum

Faqs

Faq

Projects

Projects using PLSM

Reference