Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Grass & Foliage Question

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

  • Grass & Foliage Question

    Hey everyone,

    Just a quick question. In my world I set up a landscape and got all of my layers painted to look nicely. I am now trying to add foliage to make the environment look more realistic. The first thing I wanted to do was add grass. So to test how it looked I tried a grass static mesh that already came with UDK to see how it worked. The only thing wrong when I did this was that I had some pretty big performance trouble when I had the grass at the density I needed. My question is how can I create grass that I can still make interactive and not have such a performance error.

    I have read that several people said to try using speed tree but I could not create realistic grass.

    Lastly, When I model grass, what is the best way to set it up for foliage painting. For example would using a large patch of grass work better than modeling a single blade then making it extremely dense.

  • #2
    what I did was to create a mesh that is a 'group' of grass, which all form some mix of a cylinder and a box. the actual grass that forms the group is nothing more than a few planes with an alpha texture, each plane has like 8 blades of grass painted in it.
    since the foliage tool now supports LOD, I also have 3 LOD levels for my grass. every level has a few less grass planes

    the UDK grass is indeed nice (a little too pointy for my taste, and I hate how everyone uses the same one so people's scenes share that something that you can tell it's UDK) but it is indeed a little of a performance killer.

    Comment


    • #3
      Could you explain in a little more detail by what you mean each group is just a plane with an alpha texture on it? Does this mean that almost all work for the grass is actually done inside of photoshop to create the grass? Also if I make my grass this way, will I still be able to use the interactive foliage actor with it and make it affected by wind?

      Comment


      • #4
        Yes, you will.
        One of the main things about the Foliage Editor is that you are painting a helluva lot of objects at once - so the fewer amount of polygons in your mesh the better.

        What Chosker refers to is where you create a simple square plane mesh made of two triangles and import it into UDK (slightly more if you want them to animate smoother in-game).
        You then make some nice 2D blades of grass in Photoshop as a texture.
        Next, mask where you want to be visible in the image and where you want to be transparent by creating a new Alpha channel:



        The white denotes where the material is opaque.

        Then save this image as a .tga 32-bit (to preserve the Alpha channel) and import to UDK.
        Create a Material in UDK and drag your grass texture into the Editor. Next you need to set the material to BLEND_Masked or BLEND_Translucent, plugging the Black RGB node from the Texture Sample into the Diffuse channel and the White Alpha node into the Opacity/Opacity Mask channel.

        Save this Material and apply it to your mesh.


        Edit: If you add a Vertex Color function in your material and Multiply that with your Alpha channel before plugging that into Opacity, you can make the grass fade out when a certain distance from the camera.
        Just set the 'Cull Distance Start' and 'Cull Distance End' values in the Foliage Editor to denote where the grass fades out.

        Comment


        • #5
          Alright, thank you so much guys, I have been really struggling with this lately.
          Just to make sure I have this right, these are the steps.

          -Create a patch of grass out of just normal planes then subdivide it a little so I can have them animate
          -Create the colors of the blade in photoshop then create the shape through the alpha channel
          -Import model and textures into udk then plug the all colors square into diffuse and the alpha channel square into opacity then change the masking to BLEND_Masked

          Comment


          • #6
            And you're good to go

            To get the grass to animate, you'll need to add some World Position Offset commands in the material too.
            These functions move the vertices of an object, based on the material applied to it and the criteria specified (hence why more vertices makes a smoother animation).

            Just to give you an idea of how it works, check out the UDN page.
            This tutorial by 'A Rabbit' is quite helpful for in-depth effects too.

            Comment


            • #7
              you're on the right track there.
              I didn't need to subdivide my grass planes though, each plane is a single quad polygon.
              I did the WorldPositionOffset animation thing in such a way that it looks as if it rotates+stretches at the tip, while the base pretty much stays the same. This means my grass does not "bend" in a smooth way but it does rotate (think of it like a rotating stick vs. a curling rope). I thought I'd save as many polygons as I can as I'm in favor of 'a lot of grass' as opposed to 'a few grass that looks kickass upclose'

              Comment


              • #8
                Thanks for your help guys, I'll post a screen shot when I am all finished.

                Comment


                • #9
                  Alright guys I got the planes set up with grass painted on and the material all set up. The mesh shows up perfectly fine in the editor with all of the grass on and it looks great, the only problem is when I actually play the game I get nothing but a shadow. I have rebuilt the lighting and I am a little confused on how to get the working again, thanks.

                  Comment


                  • #10
                    Try saving the package if you haven't done that already

                    Comment


                    • #11
                      Ooops... Hehe Thank you

                      Comment

                      Working...
                      X