This project is read-only.
  • Terrain Component (Components\TerrainComponents\TerrainComponent.cs) 
    • Creating a terrain heightmap
      • Creating your own heightmap is actually done outside of the engine at this point. We plan on having a world/scene editor as soon as we can, but for now, heightmaps are created from grayscale images, which can be created with most photo/image editing software.
      • The QuickStart Engine supports only grayscale heightmaps at this point. We may support color heightmaps in the future once we get an editor for the engine.
      • Greyscale heightmaps give you 768 separate elevations possible per position in the world. The QuickStart Engine has Terrain Smoothing, which will take these elevations and smooth them out so the terrain looks smooth instead of jagged.
      • For an example of what a heightmap image looks like, you can find the sample one we’re using in the \framework\test\QuickStartSampleGame\Content\Images\Heightmaps directory. The map being used is called gcanyon.png.
      • CautionAll heightmap images must have equal dimensions of height and width, and must be power-of-two in each dimension. Power-of-two means (2^n), e.g. 2, 4, 8, 16, 32, 64, 128, etc. Failure to use a power-of-two dimension will cause an exception during runtime.
      • Tip: To make sure you do not blur your heightmap in your image editor, save it in a lossless format (that XNA supports), like .png, or .bmp.
    • Setting up Terrain Splatting
      • Terrain splatting is technique the QuickStart Engine uses for multi-texturing its terrain. It involves blending textures based on RGB values in a terrain map image.
      • You must have an image for the terrain splatting that has the same dimensions has your heightmap image. That is, if your heightmap is 1024x1024, your terrain splatting image must also be 1024x1024.
      • You can set which image is used for splatting inside of the Terrain.qsm file (or whatever file you assign as a Material for your texture). Inside Terrain.qsm you’ll see the path to the splatting file for the sample game, which is ../Images/TerrainMaps/gcanyonTerrain.
    • Terrain Smoothing (EXTRA READING)
      • Eventually this setting will be adjustable within the world editor, but for now if you’d like to mess with it, you’ll find it being used in SampleScene.cs in the LoadTerrain() function. You’ll see a line that says newTerrain.Initialize. The default value we’re using in this sample scene is 2, which you’ll see if the 4th parameter in the Initialize function. This means we perform 2 smoothing passes after we read in the terrain. Usually you’ll never need to go any higher than about 5-10 passed, but if you go too low you may see jagged terrain. Try setting it to 0, 5, or 10 and see the difference.

Last edited Jan 5, 2012 at 5:17 AM by LordIkon, version 1

Comments

No comments yet.