No announcement yet.

How could I apply a RGBA Alpha Maps (TM maps) to a terrain?

  • Filter
  • Time
  • Show
Clear All
new posts

    How could I apply a RGBA Alpha Maps (TM maps) to a terrain?

    Here is my scenario and a question I cannot find any references in the UDK documentation about:

    I downloaded a high resolution 120MB 30m DEM ADF of an island for my terrain. I downloaded the GIS map as an ADF file and I converted it into a 5120x5120 TER terrain map (Terragen format) with Global Mapper v11 x64. I then imported and edited the terrain in Leveller Professional v3.2 using some smoothing, blurring, and manually taking out some extremely rough terrain bumps. Then I exported the terrain back into a TER (Terragen Format) file and imported it into L3DT Professional as the Heightfield. In L3DT, I generated Water, Salinity, Attribute, Normal, Shadow, Light, Specular Light, Texture, and TN-tangent maps based on the Heightfield and a customized climate for the island. With those maps generated, I was able to further customize my climate and generate an Alpha map of my terrain with 10 different tropical island material layers.

    From L3DT exported the height-map as a G16 Bitmap file and I know to make the Height-map this size: (X + 1)px x (Y + 1)px (whereas X=Num Patches X and Y=Num Patches Y in the Terrain Actor properties in UDK) and create then create a Terrain that is (X * Y) Patches in UDK. So basically I downsized by terrain from 4096x4096 to 1025x1025 for the G16-Bitmap height-map.

    Next, I created sixteen versions of my alpha map sets 2048x2048, 2049x2049, 1024x1024 and 1025x1025 in both TGA and DDS formats and I made the alpha map sets with 3 layers per image (4 images per alpha map set in total) and 4 layers per image (3 images per alpha map set in total).

    My question is this: How can I use all three or four of the Alpha map images in UDK to define where to put all 10 materials on my terrain? With the Terrain actor, I plan to create an array with 10 Terrain Setup Layers/Terrain Materials and utilize the Alpha maps to tell UDK where to put all the the Terrain Materials?

    I was hoping, based on my Alpha maps, it will generate an entire terrain painted with materials ordered by the way I put TSL/TMs into the Terrain Materials Array (i.e. first layer in the first image is the underwater rock and layer 0 in the Terrain Materials Array, second layer is sand,......, highest layer is a steep mountain rock).

    Found my answer in the UDN documentation under Terrain Advanced Textures

    I found a great solution to my problem in the UDN documentation:

    Doing it this way will hopefully create a way more realistic terrain than the climate I created in L3DT. Basically, what I need to do in order to texture my terrain is to create a single material containing 4 texture samples (each 4096x4096, representing 1/4 of my modified Landsat7 TIFF), another 4 texture samples representing the four quadrants, and then build it into a single material using TextCoords (using these to map out where each quadrant goes) plugged into all the texture samples, and plug in the RGB of the Normal Map directly to the Normal node.

    Here is a picture of what I'm trying to do:

    So I downloaded my terrain texture (24-bit GeoTIFF from USGS Landsat7 30m), then I cut out the ocean, and I added a layer underneath containing a bigger beach and a mud/sand texture in place of the ocean. Next I used the patch and healing brush tools to take out all the clouds (there was only a few tiny clouds and a fire), and I brushed terrain over all the towns. For the Ocean, I will use modified UT Water Volumes, Post Process Volumes, and fluid surface actors with a two sided liquid material (which ever looks the best). Then I created a high res normal map (8192x8192) of the entire island with Crazy Bump using the 8192x8192 RGB-8 TIFF and the 8192x8192 heightmap (created from a height clamped DEM).

    Now my steps are to create the material of the entire Island using the 4x 4096x4096 textures and the 8192x8192 normal map. Next, add it to a terrain material (and set the Material.MappingScale property to the patches size of the terrain (in my case 1024x1024). Create a corresponding TLS using just the single TerrainMaterial in array slot 0. Finally, create a new terrain, size it to 1024x1024, use the single TLS I just created, and then open the terrain editor, and import the G16.BMP (1025x1025), selecting hight-field only, and into the current terrain. Now, I should have my entire terrain, with the elevation model, and fully texturized looking similar to the actual Island of Hawaii, I hope...

    I will report back after I finish the terrain, or if I have troubles creating the material.


      Be wary of using too many texture samplers on the terrain. I remember reading it was a maximal 6 different (you can reuse same textures in other materials on the terrain) textures (diffuse, normal, etc.) on each terrain patch.

      Is this terrain for visual goodies or actual gameplay? A large terrain (over 256x256) is a ***** on perfomance, and good optimization is needed especially for lower-end PCs.


        The game is designed for "visual goodies", and is not targetted too much for game play. The people playing the game will have higher end PC's.

        Basically, It is a final project game for a graduate level graphics class that is emphasizing "physics awareness" and should be a "visual sanctuary".

        Originally posted by musilowski View Post
        Be wary of using too many texture samplers on the terrain. I remember reading it was a maximal 6 different (you can reuse same textures in other materials on the terrain) textures (diffuse, normal, etc.) on each terrain patch.
        I thought that creating the terrain material this way (utilizing a single Terrain Material layer comprised of a single material with 4 texture samples, like the one pictured above) would limit the number of shaders to just a few, and would be utilizing a single material with somewhere around 40-100 instruction sets. Would this not be better than using say 6-10 materials (~50 instruction sets) and 6-10 TM/TLS layers? Because I thought that if I used 6-10 different materials, it would create shaders possibly compiled like (mat1 + mat2 + mat3 + mat4 + mat5 + mat6 + matN...). Am I wrong with this assumption? I am still a newbie with the Unreal Engine and UDK. I am a long time C/C++/Python/Java/Javascript/Actionscript/Shell scripting/PHP/CSS/XML programmer, but I have only been working with the Unreal engine and 3D games for 4 months.