Announcement

Collapse
No announcement yet.

More than 2 terrain materials?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    More than 2 terrain materials?

    Does UDK support the use of more than 2 terrain materials?

    I mean that I can use 4 or 5 materials and they do not overtake the other materials.

    I can add several materials but I never can have more than 2 materials showing on the terrain at one time.

    Every tut I have found only shows 2 materials. Is there one that shows how to use 3 or more and have all 3 show up on the terrain at the same time?

    #2
    You can have as many as you want as long as you don't use more than 16 texture samples total. That's a Shader Model 3 graphics card limitation. Not a UDK limitation.

    If you use too many textures, your terrain will turn into a giant rainbow. That's a GPU error telling you that it's too complex for DirectX9 and/or your graphics card.

    You add more layers just like the first layer. Then you select whichever layer that you want to paint on to your terrain in the terrain edit window (Where it shows a list of your layers at the bottom). Once the layer that you want to paint is highlighted, you use the paintbrush (CTRL+Click)to paint it wherever you want it. The same paint brush that you use to raise/lower the height when you have the heightmap layer selected.

    In the layer properties, you can adjust min/max values to help your accuracy. Such as only painting your cliff rock material on slopes greater than 0.8. All of those settings, except for height, are on a 0-1 scale. So, 0 will be flat. 1.0 is 90 degrees, straight up. There's also an Alpha setting that allows the covered layer to show through if you like. 1.0 is totally opaque. 0.0 is completely clear.
    Noise will feather the edge of where you paint to blend the edges and make a smooth transition.

    For reference, here's a list of the UDN links that may come in handy when starting out with terrain:
    http://udn.epicgames.com/Three/SettingUpTerrain.html
    http://udn.epicgames.com/Three/CreatingLevels.html
    http://udn.epicgames.com/Three/Terra...dTextures.html
    http://udn.epicgames.com/Three/UsingTerrain.html
    http://udn.epicgames.com/Three/TerrainDesign.html

    Comment


      #3
      That is what I did however here is what happens:

      Material 1 Soil
      Material 2 Dirt
      Material 3 Grass

      I use Soil as the base material. I add the Dirt layer. I paint the Dirt layer onto the Soil. Looks great. Now I add the Grass layer and puff magically my Dirt that I painted is now Grass. I never painted with the Grass just added the layer. Everywhere I painted with the Dirt is now Grass. Even if I paint the the Dirt again it just paints Grass. I no longer have any Dirt on my terrain unless I delete the Grass Layer. Now if I move my grass layer up to the number 2 spot on the list, my Grass disappears and now my Dirt shows everywhere including the new areas I only painted with Grass. It seems to only ever show 2 materials on the terrain at one time.This happened with both the Aug and Sept builds.

      Comment


        #4
        Is there anything unusual about the materials? Are you using parameters in them?

        Comment


          #5
          They are material instances with params. However I have the same problem with just a basic material with only the texture plugged into diffuse.

          Comment


            #6
            We should use basic Materials for Terrain instead of Instance Constants anyway, I figured that Instance Constants only increase the number of instructions in the Material for Terrains, although they give us less instructions in every other application.
            But they also cause errors if there is the same parameter used twice somewhere in the parent Material, so they are probably really not supposed to be used with Terrain.

            But I had the same problems with my Terrain, it just didn't want to let me paint the other layers: everywhere where I did turned the Terrain just pitch black.

            Comment


              #7
              2 things:
              1: Terrain folds all of the materials and layers into a single shader. Thus, if you use the same material twice, and it has parameters in it, it will always use the settings of the first parameter instance as the setting for every parameter of that name in the entire terrain. So, if you have an instanced material with a texture parameter and you have the 1st layer set to use grass textures, then you use a second instance of the same material for the second layer and set the texture parameter to use dirt.... The terrain will encounter the grass first and use 'Grass' as the texture parameter input for all instances of that material. It will overide your dirt setting.

              2: When working with multiple layers, it is very important to update your shaders after every change that you make. The shaders break and strange things happen.
              To re-compile your shaders, look on the right hand side of the terrain editor window and find the small button that has a red RM on it. Click that and choose Yes. It'll re-compile your shaders and re-sort your layers to where they should be.
              Expect to need to use that very often.

              My newest terrain has 5 layers, so I know it can be done. I've had no issues other than constantly needing to re-compile my shaders and the parameter issues that I mentioned in my other thread here:
              http://forums.epicgames.com/showthread.php?t=747568

              Comment


                #8
                Got it to work. I got rid of the material instances and just use simple materials with only a diffuse and hit the RM after each one. Now I have 4 materials on my terrain and they all behave the way they should.

                Comment

                Working...
                X