U E D R S I H C RSS
ID
Password
Join
자기가 하고 있는 일에 마음을 반밖에 쓰지 않는다면, 그것이 갑절 힘들어 질 것이다. 자기가 할 일을 발견한 사람은 행복하다. 그로 하여금 다른 행복을 찾게 하지 말라. 그에게는 일이 있고 인생의 목적이 있기 때문이다. -토마스 칼라일


GLScene은 동적 또는 직접 설정된 높이필드(높이값들의 정규적인 그리드배열) 지형의 효과적인 랜더링을 위해 특별하게 디자인된 TGLTerrainRenderer 객체를 가지고 있습니다. 이 객체는 비정규적인 매시를 다루지 않습니다. 거대한 지형은 연속적인 LOD 관리를 통하여 처리되며 내장된 객체들은 페이지로 구분된 지형만 허락됩니다. TGLTerrainRenderer는 뷰어 위치에 따라 높이필드 정점을 감소시키기 위해 개발된 ROAM 알고리즘을 사용합니다.

TGLTerrainRenderer는 장면 상에 지형을 그리는 객체입니다. 이 객체는 설정되어있는 THeightDataSource 객체(HDS)로부터 정의된 지형데이타를 가져옵니다. 그러므로 일반적으로 장면에 지형을 추가하는 단계는 (1) 우선 TheightDataSource 파생객체(예:GLBitmapHDS,GLCustomHDS)를 form에 등록하고, (2)GLTerrainRendererGLScene 객체에 추가합니다. (3) 그런다음 GLTerrainRendererHeightDataSource 속성을 추가한 HDS 객체로 설정합니다.

GLTerrainRenderer가 장면을 랜더링할 때, 지형을 TGLTerrainRenderer.TileSize 값으로 지형을 분할합니다. (다시말하면, 만약 TileSize 속성이 64이고, 내장된 지형은 64x64 타일로 구성되어있다고 가정합니다)

만약 처음에 한 타일이 뷰 절두체안에 놓여있다면, 랜더러는 내장된 HeightDataSource로부터 TheightData 객체형태로 제공되는 타일데이타를 요청합니다. 만약 HeightData 타일이 카메라와의 거리가 GLTerrainRenderer.QualityDistance 이내에 놓여있다면 타일은 본래 detail에 맞게 랜더링 됩니다. I.e. every point on the grid is rendered as vertex. If it is greater than this quality distance away, then the ROAM algorithm is applied to reduce the number of vertices created while still providing a good representation of the tile as viewed by the camera at that moment. Every time the view parameters change (eg moving the camera), ROAM tiles are recalculated and also tiles are checked to see whether their location with respect to QualityDistance has changed. The renderer manages a cache of rendered tiles and GLHeightDataSource manages a cache of Heightdata tiles.

The terrain renderer looks for all terrain right out to the limit of the view frustum – ( the “horizon limit” is given in GLScene by the current camera property DepthofView). To impose a smaller range of interest for the terrain renderer, use the event OnGetTerrainBounds. This event passes the current terrain rectangle of interest and in the event, the rectangle can be reduced to a smaller area of consideration. Note that this will mean there will be a defined edge to the viewed area unless fog or similar limiting effect is used.

A note on coordinate systems. GLScene objects use normal OpenGL coordinate space with x along screen, y up screen and z being distance behind screen. However, note that GLTerrainRenderer, GLHeightData objects reference normal map coordinates with xy being position on ground and z being height.

Texturing.

GLTerrainRenderer does not using lighting! The reason for this is that calculating a normal map on ROAMed tiles is horrendously expensive because the geometry changes virtually every frame. Because of this, the terrain should be textured with a lighting. A “lit” texture is used in Terrain but the obvious alternative is to use GLScene’s multitexturing capability and supply both a lightmap and an ordinary texture. A great deal of work is still going on behind the scenes on issues around texturing. The TilesPerTexture property is used to match texture size to terrain size.

Key properties: (play with the Terrain Demo to get an understanding of these)

HeightDataSource: Got to supply this to make it work at all. This is the object that will supply THeightData tiles to the renderer.

QualityDistance: If any part of the tile is less than QualityDistance from the camera, then all vertices in the patch are rendered as a big triangle strip. Beyond this distance and the tiles are reduced by the ROAM algorithm

TileSize: This is the size of the square patch that is the fetched in a single Heightdata object and rendered as an entity.

There is a sweet spot for performance in the combination of Tilesize and QualityDistance. If QualityDistance is too big, then none of the patches are ROAMed and vertex count gets very high. Too small and the CPU get extremely busy doing ROAM reduction on all tiles. Tilesize is similar. Too large and you have huge areas unnecessarily rendered in full resolution with little frustrum culling possible. Too small and ROAM gets very inefficient and the system slows under the load of a huge number of patches. A tile size between 32 and 128 will probably be the best choice on most hardware.

TilesPerTexture: If overlaying a 2D texture onto the terrain, this controls how the texture is matched. It details how many tiles are covered be a complete texture. Eg. Suppose the terrain is 512x512 and texture covers the entire terrain. If tilesize is 32, then texture must cover 16x16 =256 tiles (512/32 = 16).

MaxCLODTriangles : Maximum number of triangles in a scene EXCLUDING those produced from high resolution tiles. This is used as a memory allocator provide storage for ROAM triangles.

CLODPrecision : This is the control which controls the coarseness of terrain in tiles beyond QualityDistance. It is broadly interpreted as a measure of how much visual error (the variance between rendered terrain and actual terrain) is tolerable. The higher the number, the coarser will be the approximation to real terrain.

OnGetTerrainBounds : Default rendering bounds will reach depth of view in all direction (DepthofView property of a GLCamera) . Use this event to specify a smaller rendered terrain area.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.3598 sec