目錄

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