Announcement

Collapse
No announcement yet.

Terrain - Static mesh vs Landscape

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

    Terrain - Static mesh vs Landscape

    I'm quite descriptive and specific in this thread, so please make sure you read and understand the type of map I'm making, and the various other elements before replying.

    To start with I will include an image of the said terrain, and a brief description of what you're looking at.

    In this image, you see the entire terrain. The final version is separated into pieces before importation into UDK as the total exceeds 50,000 tris. The total amount of tris(not quads/polys) used in this render before any optimisation is 384,000 roughly.
    This isn't just a mere displacement on a plane with many segments. There are many features, such as the cavern that has been highlighted inside the red box. Many other caverns do exist and contribute to the amount of tris used.
    Here is an image from inside the cavern from an older build of UDK done some time ago.


    As you may have noticed from the render in 3DS Max, the vertex points follow a very uniform grid like you'd expect to see from something like game engine terrain.
    Since some areas like the ocean won't be playable or even visible, I can optimise by using very large tris which reduce the entire meshes together to 160,000 tris.. keeping the verts either entirely unchanged or only somewhat where need be.. such as vertex colouring, or smoothing in the playable areas.

    Rendering quads/tris. Static mesh vs Landscape.

    I might be wrong, but I don't think the terrain at 160,000 tris is going to be harming performance, even after remaining details are added (buildings, trees, etc).
    Considering that cavern areas can be unloaded when outside, and perhaps vice versa.. if needed.

    The scale of the static mesh from x to y is almost 100% identical to a landscape (not legacy terrain) that follows the standard 255x255 scale, which is quite small. So I was able to import a heightmap that was created from this mesh, capturing all that the displacement side of things can do for the exterior.
    Whilst in-game, I went into wireframe mode, and I didn't see any optimisation benefits with regards to the landscape's automated LOD abilities. My map is so small, that the LOD only appears to kick in after I've travelled far outside the maps intended play area, infact outside of the mesh itself.

    I know there are probably more benefits to landscape than just its ability to LOD distant terrain the way it does, but it kind of contradicts what a friend of mine complained about, when he said my static mesh would be "too many raw polygons". If the LODing isn't kicking in with the landscape because the map itself is too small for the distance needed, then that means I'm still rendering roughly the same amount of geometry that I would otherwise be rendering with a static mesh.
    Maybe it renders better though. Maybe 1 quad on landscape is more optimised than static mesh, but I have my doubts and don't know enough to conclude anything more on that.

    So considering those points above; brief re-hash, that I don't appear to see any optimisation kicking in whilst in the playable areas in the landscape version, and considering that with the static mesh, I have complete freedom with resolution and topology.. Which is the best option when it comes to rendering out quads/tris?

    I'd like to obviously use what is best for the type of map, and the scale, and also the kind of quality/detail that I'd like to see in my terrain.
    The map is intended to be a multiplayer map for a melee combat game. Most of the areas are not playable, and if I took the static mesh route.. many of the non visible areas would be either deleted or heavily optimised.


    What is the limit of detail texturing between static mesh and landscape?

    Now I'm not sure how correct I am on this next subject, so I hope to be enlightened about this. To my knowledge, if I've got this correct, the landscape allows more than just 4 detail textures to be painted on a single landscape object.
    With a static mesh, I wouldn't know how to use more than 4 detail maps, cause I'm pretty sure the static mesh can't do that, but maybe I'm wrong.

    How do you scale landscape?

    But one issue I do have with the landscape terrain is that it doesn't appear to allow very much customisation with dimensions outside of the actual heightmap. The actual dimensions used apparently are specified by the heightmap itself (and when I try to use different dimensions from the heightmap, it won't work).
    This, perhaps from my ignorance, appears to be the same situation with height. I see absolutely no controls to specify what the max height aka what pure white in the heightmap would mean in terms of height. So when I import the heightmap, I end up with a terrain thats EXTREMELY stretched in its height.
    Due to my lack of being able to find any other controls to adjust the height of the import, other than perhaps darkening the heightmap itself.. I was forced to use the scale tool. To avoid any confusion about what scale tool, I mean specifically this one highlighted in the image below.


    Does the use of this scale tool to adjust the landscape, have any consequences? If so, what are they, and what are my alternatives to using this tool to adjust the XYZ dimensions of my landscape?

    #2
    Originally posted by DIFTOW View Post
    So considering those points above; brief re-hash, that I don't appear to see any optimisation kicking in whilst in the playable areas in the landscape version, and considering that with the static mesh, I have complete freedom with resolution and topology.. Which is the best option when it comes to rendering out quads/tris?
    You can change the landscape LODDistanceFactor in its properties to move the lod transition closer to the camera. On the other hand you can also, and you should, create LoD models for a static mesh terrain to end up with much less than those 384k or even 160k tris.


    Originally posted by DIFTOW View Post
    What is the limit of detail texturing between static mesh and landscape?

    Now I'm not sure how correct I am on this next subject, so I hope to be enlightened about this. To my knowledge, if I've got this correct, the landscape allows more than just 4 detail textures to be painted on a single landscape object.
    With a static mesh, I wouldn't know how to use more than 4 detail maps, cause I'm pretty sure the static mesh can't do that, but maybe I'm wrong.
    I'm not sure what you mean by detail textures specifically. But yes it's possible to smoothly blend between more than 4 textures on a static mesh - this can be done by using vertex colors and a painted RGBA mask texture. However there is the shader model limit which won't allow you to use more than 12 textures in total on a single mesh.


    Originally posted by DIFTOW View Post
    How do you scale landscape?

    Does the use of this scale tool to adjust the landscape, have any consequences? If so, what are they, and what are my alternatives to using this tool to adjust the XYZ dimensions of my landscape?
    You can do it this way or by changing the Landscape Properties -> Display -> Draw Scale 3D -> Z.

    Comment


      #3
      well. there's also the consideration of what the level will look like once you add everything else--like foliage and stuff like that. I think a good number for visible tri count is like 1million, so if your terrain is taking up 160,000 then that's quite a big chunk of your budget. Ultimately if it runs well enough for you using a static mesh then I don't see a reason to change it even though it's not the "right" way of doing it.

      I think probably it would be easier to create your materials on using the Landscape system rather than static meshes. And on top of that while you can add an LOD to the static mesh, since it's all one object and your character would be standing on it then there wouldn't be a chance for it to switch it out, whereas the landscape system would be able to dynamically subdivide based on distance so even though it's one object it would be able to improve performance.

      Comment


        #4
        Originally posted by mAlkAv!An View Post
        I'm not sure what you mean by detail textures specifically.
        You have a base layer which is a colour map, and then you have smaller tiling detail textures that blend into that. Now the detail textures are kept either entirely greyscale, or very desaturated to allow for the colour information in the base layer to dictate its colour and allow long distance variation where obviously a tiling texture couldn't provide.

        Here is an example of this being done in Crysis, which is over 5 years old.


        Originally posted by mAlkAv!An View Post
        But yes it's possible to smoothly blend between more than 4 textures on a static mesh - this can be done by using vertex colors and a painted RGBA mask texture. However there is the shader model limit which won't allow you to use more than 12 textures in total on a single mesh.
        I understand the vertex colour bit. I did 3 of the 4 possible channels in 3D studio max, and used the material editor in UDK to specify which textures use which of the 3 colours. Didn't touch alpha at all for that.
        Is there an example of how you would do this RGBA mask with the 4 vertex colours to get 12 textures?

        I don't think I'll be going with static mesh, but it would be some useful knowledge and I'm sure I'll need it.

        Originally posted by mAlkAv!An View Post
        You can do it this way or by changing the Landscape Properties -> Display -> Draw Scale 3D -> Z.
        But is it costly to performance or does it cause any issues I should know about?

        Originally posted by mAlkAv!An View Post
        You can change the landscape LODDistanceFactor in its properties to move the lod transition closer to the camera. On the other hand you can also, and you should, create LoD models for a static mesh terrain to end up with much less than those 384k or even 160k tris.
        Thank you for taking out time to help me. I did try the LODDistanceFactor, raising it to its maximum value of 3. Unfortunately the distance in which the first LOD kicks in, is far away from the playable area, so the LOD would never be used in-game, even set to that value. If I were to stick with static mesh, that was the plan to make LODs, but I would prefer to use landscape.

        Here are some screencaps of the Landscape version of the terrain.

        The LOD is visible out this far as I show you in this shot.



        But by the time I get up to the playable area, it reverts back to the full display, aka no LOD.


        Originally posted by darthviper107 View Post
        well. there's also the consideration of what the level will look like once you add everything else--like foliage and stuff like that. I think a good number for visible tri count is like 1million, so if your terrain is taking up 160,000 then that's quite a big chunk of your budget. Ultimately if it runs well enough for you using a static mesh then I don't see a reason to change it even though it's not the "right" way of doing it.
        That is a good point and I agree, but since the LOD isn't kicking in, the only way for UDK terrain to be more optimised with regards to tris displaying, is if it has a feature like this -> http://www.youtube.com/watch?v=A1ELR...ailpage#t=138s

        Notice how in wireframe, portions of the terrain will 'cull' when it is no longer visible.

        If UDK has this feature, I haven't seen it. Took this while in wireframe in-game.

        Unless the wireframe is overriding the optimisation.

        Just for fun, here is the map so far as a static mesh.

        Comment


          #5
          Originally posted by DIFTOW View Post
          You have a base layer which is a colour map, and then you have smaller tiling detail textures that blend into that. Now the detail textures are kept either entirely greyscale, or very desaturated to allow for the colour information in the base layer to dictate its colour and allow long distance variation where obviously a tiling texture couldn't provide.


          I understand the vertex colour bit. I did 3 of the 4 possible channels in 3D studio max, and used the material editor in UDK to specify which textures use which of the 3 colours. Didn't touch alpha at all for that.
          Is there an example of how you would do this RGBA mask with the 4 vertex colours to get 12 textures?
          Blending 12 textures smoothly is not possible this way, but 7 or 8. You'll be probably using normal maps too which raises the total texture sample count further.

          You can paint Vertex colors either in 3ds max or directly in the UDK, which will give you of course more flexibility.
          For this take a look at the Mesh Paint Tool documentation: http://udn.epicgames.com/Three/MeshPaintReference.html

          The can RGB(A) mask can be painted in every 3d modeling prog that has a texture painting tool. Just instead of textures you paint colors (pure red, green and blue). Again there is also the possibility to do it in the UDK by using the Texture Paint Tool: http://udn.epicgames.com/Three/Textu...Reference.html

          In your material you have to use the R, G, B, A channels of your Texture mask and a Vertex Color node as the input for LERP nodes to blend between your (detail) diffuse textures. The material setup should somehow look like this in the end: http://img843.imageshack.us/img843/4482/002dxl.jpg

          To save texture memory you should put 3 or 4 of your greyscale detail textures into a single texture, each in one channel (RGBA). This will also come handy to keep the number of texture samples low.


          Originally posted by DIFTOW View Post
          But is it costly to performance or does it cause any issues I should know about?
          No, this is the usual way to do it as far as I know.


          Originally posted by DIFTOW View Post
          Notice how in wireframe, portions of the terrain will 'cull' when it is no longer visible.

          If UDK has this feature, I haven't seen it. Took this while in wireframe in-game.
          http://root.miriscus.com/island_5.jpg
          Unless the wireframe is overriding the optimisation.

          Just for fun, here is the map so far as a static mesh.
          http://root.miriscus.com/island_1.jpg
          http://root.miriscus.com/island_2.jpg
          What about the UDK stats? Open the console in game (tab) and type in stat engine to check the actual tris count.


          Originally posted by darthviper107 View Post
          And on top of that while you can add an LOD to the static mesh, since it's all one object and your character would be standing on it then there wouldn't be a chance for it to switch it out, whereas the landscape system would be able to dynamically subdivide based on distance so even though it's one object it would be able to improve performance.
          Well, you should always subdivide a static mesh terrain into multiple pieces (not just because of the 65536 tris count limit) to make the engine culling/occlusion system work properly and to benefit from it's LoDs.

          Comment


            #6
            Doesn't look like the OP is still working on this project, but for anyone else who stumbles across it, the major downside to using a static mesh for your terrain as opposed to a landscape is the the way UDK culls/occludes meshes. Basically put, as soon as one vert from your mesh is visible to the player, the entire mesh will be rendered. So unless you chop your mesh into dozens of pieces both vertically and horizontally, you're going to be rendering geometry that doesn't need to be in the scene. For example, if you were to use a 32 floor skyscraper model for this example, if the entire building is one mesh and you're standing on the ground and other objects are occluding all of the building, but you can see the top floor, the engine can't do anything other than draw the entire model because it knows that the top of the building is visible. Unless the entire model is occluded from view, everything is drawn so you end up with a lot of wasted tris. In this case you'd want to make each and every floor of the building its own unique mesh, that way the floors that aren't visible can be culled and thus 31 of the 32 floors would be removed from the scene when only the top floor is visible. HOWEVER, this also creates another issue in that UDK is made to use Instanced objects. If every floor but the first and last were using the same static mesh and its just instanced 30 times in between, then your optimization is good. If each floor is unique (as it would be with this terrain) then the engine has to do 32 draw calls in order to render the building instead of only 3 draw calls if there are only 3 unique pieces (bottom, floors, top). This sort of setup is fine if you're never going to see the entire terrain all at once but if that were the case, then you'd be better of using a landscape with proper LOD adjustments that drop out the quality dramatically once you're outside the normal viewing distance. If in my example, you are going to see the entire terrain at once and its divided into 32 unique meshes as with my skyscraper example, then the engine would have to process 32 draw calls every frame. And that's not factoring in other meshes thrown onto the terrain to make it look better. Using landscape, there's only 1 draw call and thus its faster to render.

            There's a very good reason why Epic created the Landscape system. Its quite frankly the best way to get the highest amount of detail from your terrain with the best overall performance. Changing the MaxLOD level to something like 3 but increasing the LODDistance Factor to 2 for example, will only have 3 different LODs for your terrain, but cause them to switch between each LOD sooner. This system is great for maintaining the silhouette of your landscape while removing all of the unnecessary detail when you're at a distance. Also keep in mind that the landscape system can give you a much higher detail level than 130,000 polys when viewed at the maximum LOD. If you export your landscape from UDK to .obj format and then import this to 3ds max, it will do so at the highest LOD level possible and you'll see that your scene is actually closer to 2 million tris.

            Comment


              #7
              I am still undecided which solution I will pick for my next game. However currently the performance in my dynamic lit level is BETTER with a static mesh. Then again at the moment it has only 3k of the 50-100k (split into 2 meshes) planned tris. The landscape system doesn't seem to take dynamic lighting too well as the framerate dropped a lot while I used it. With static lighting the landscape didn't affect the framerate whatsoever.

              Comment


                #8
                I know this has been said before (I've read the post and the replies), but I suggest you use Terrain/Landscape for the Great Outdoors, and static meshes for the caves where the terrain/landscape couldn't give a ceiling.

                Terrain/Landscape: Tesselation and occluding for great performance, easy and (almost) in-game editing for last touches without repeatedly importing the terrain meshes.
                Static Meshes: Cull Distance and streaming for great performance.

                Comment


                  #9
                  Originally posted by XilenceX View Post
                  I am still undecided which solution I will pick for my next game. However currently the performance in my dynamic lit level is BETTER with a static mesh. Then again at the moment it has only 3k of the 50-100k (split into 2 meshes) planned tris. The landscape system doesn't seem to take dynamic lighting too well as the framerate dropped a lot while I used it. With static lighting the landscape didn't affect the framerate whatsoever.
                  The performance with dynamic lighting directly depends on the overall tris count. The more triangles beeing lit dynamically, the less FPS you'll get. So there will be a difference between a 3k and a 100k landscape mesh for sure.

                  Comment


                    #10
                    Originally posted by Haxzor View Post
                    Terrain/Landscape: Tesselation and occluding for great performance, easy and (almost) in-game editing for last touches without repeatedly importing the terrain meshes.
                    Static Meshes: Cull Distance and streaming for great performance.
                    You can also cut your landscape into pieces and save them as streamed levels for even better performance.
                    plus, you can set the landscape's LOD to be more agressive so you can control the performance better

                    Comment


                      #11
                      Originally posted by mAlkAv!An View Post
                      The performance with dynamic lighting directly depends on the overall tris count. The more triangles beeing lit dynamically, the less FPS you'll get. So there will be a difference between a 3k and a 100k landscape mesh for sure.
                      I just tested this with the terrain tesselated in 3DS Max. I increased the triangle count by 10times to 30k+ and it had no impact on performance whatsoever. As long as the tri count is reasonable (e.g. max 1mil tris per frame) it doesn't seem to have any impact on the frame rate. What cripples the framerate is too many objects casting and receiving shadows. My personal guess is that the landscape system parts count as individual objects in this calculation. So that would be why big landscapes kill the framerate if dynamic lighting is used.

                      One may argue that 30k isn't quite the same as 100k but I also placed 4 small 30k terrains next to eachother and had all of them on the screen without any framerate impact. If I had 100 more objects at 1k tris each in that scene the impact would be quite noticeable. ^^

                      Comment


                        #12
                        I was assuming shadow casting - this is what affects performance obviously.

                        I'm working on a scene right now that is still fairly simple and contains a few objects only. Replacing a large rock mesh with 8k tris by a more detailed version with 110k tris caused a FPS drop from 84 to 75. The impact is even more noticable if there are multiple shadow casting lights, 3k cave model = 50FPS, 24k cave model = 45FPS.

                        Comment


                          #13
                          Originally posted by mAlkAv!An View Post
                          I was assuming shadow casting - this is what affects performance obviously.

                          I'm working on a scene right now that is still fairly simple and contains a few objects only. Replacing a large rock mesh with 8k tris by a more detailed version with 110k tris caused a FPS drop from 84 to 75. The impact is even more noticable if there are multiple shadow casting lights, 3k cave model = 50FPS, 24k cave model = 45FPS.
                          Well the terrain meshes are shadow casting. However I only have one shadow casting light so that may be the reason. Anyway you should probably test your game on PC instead of PIE. I found that the dynamic lighting looks VERY different then. Or did you remove the 62FPS cap and test on PC? That would explain the high FPS ofc.

                          Comment

                          Working...
                          X