Creating the Landscape in Truevision
  • Open up your languague of choice. (Code here is for VB .NET but should be easily understandable if you use another language)
  • I’m not going into details about instancing the engine and the objects, you probably know how to do this. We need to instantiate a TVEngine, TVTextureFactory, TVScene a TVLandscape and a TVInputEngine if you want dynamic movement on your landscape.
  • Use these setting for your Scene :

Scene.SetViewFrustum(60, 5000) Scene.SetTextureFilter(CONST_TV_TEXTUREFILTER.TV_FILTER_TRILINEAR)

  • Now load the final texture you created in L3DT like this :

Texture.LoadTexture(”texture map from L3DT”, “land”, 2048, 2048)

  • And now we will create the landscape from our heightmap :

Land.GenerateTerrain(”height map from L3DT”, CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_BEST, 8, 8, 0, 0, 0) Land.SetCullMode(CONST_TV_CULLING.TV_FRONT_CULL) Land.ExpandTexture(Globals.GetTex(”land”), 0, 0, 8, 8)

  • TV_PRECISION_BEST can hurt your FPS but it’s required if you made some steep mountains or plateaus in L3DT, otherwise you can use TV_PRECISION_HIGH or even TV_PRECISION_AVERAGE.
  • Now just add the main loop and render your landscape.
  • If you want an overview of what you just made just use these setting for the camera :

Scene.SetCamera(0, 1000, 0, 1024, 0, 1024)

  • By now if you run your application you should see something similar to this :

  • You can add a detail texture to the landscape to add even more realism.
  • Write some movement code.
  • Happy landscaping :)
 
3_-_creating_the_landscape_in_truevision.txt · Last modified: 2013/11/22 13:30