Announcement

Collapse
No announcement yet.

Getting ground color for grass

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

    Getting ground color for grass

    Hi!

    I've got a bit of a project going but I'm a complete beginner so my understanding on the material system is still pretty limited, though growing each day.

    I've got an idea I want to try out, which is to set the base color for my grass on a piece of landscape, as the color of the terrain the grass is located on. As if the grass picks up the color from the ground. I could then apply detail texture on top of that, but the base color for it should come from the ground.



    The thing is, I haven't got a clue on if it's possible or how I'd go about doing it. I'd appreciate any help, a nudge in the right direction?

    Thanks!

    #2
    It's certainly doable, CDProjekt is doing just that for The Witcher 3.

    There is a presentation floating around on the net showing how they handled this.

    Comment


      #3
      Originally posted by FatJoe View Post
      Hi!

      I've got a bit of a project going but I'm a complete beginner so my understanding on the material system is still pretty limited, though growing each day.

      I've got an idea I want to try out, which is to set the base color for my grass on a piece of landscape, as the color of the terrain the grass is located on. As if the grass picks up the color from the ground. I could then apply detail texture on top of that, but the base color for it should come from the ground.



      The thing is, I haven't got a clue on if it's possible or how I'd go about doing it. I'd appreciate any help, a nudge in the right direction?

      Thanks!
      Oh, Good luck with that, just keep working on it and improve it more and more.

      Comment


        #4
        Here's the PDF for how CDProjekt is doing their terrain. Might give some guidance or help a light bulb appear above your head . It's not a tutorial. I'm no pro myself so I'm interested in learning. They're doing exactly what you want. Specifically detailed in the "Pigment Map" portion of the presentation. It's certainly interesting and hopefully some experts chime in to help translate CDProjekt's method into a BP method.

        Anyway, the PDF link: http://twvideo01.ubm-us.net/o1/vault...eation_and.pdf

        Comment


          #5
          I've done this both in UDK and UE4 so it's certainly doable.
          I did it by having a color map that shows the variation in color throughout the landscape, I removed all unwanted colors like rocks, sand and such and only had variations of green and brown then I let that color my foliage.
          I'm not at home right now and it was a while ago so I don't remember exactly but i found that Ülrich Thümmler did something similar here:
          http://ulrichthuemmler.blogspot.de/p...rld-color.html
          Click image for larger version

Name:	landscapematerial.jpg
Views:	1
Size:	286.3 KB
ID:	1052891

          I can check when I get home exactly how I did it but that should get you going.

          Comment


            #6
            That scene with all the colored grass looks great- I'm curious how it actually runs.

            Comment


              #7
              There is something like that in CryEngine2/3, and there was no noticeable rendering cost for coloring grass to match underlying terrain color.

              Though, my bet is, to make it really performance friendly, you would need to create custom shading model in HLSL, with access to Landscape textures info, and sample colors from here, to blend them over grass.
              A task, for someone, who is good at writing shaders and understands unreal rendering .

              I'm not sure if material editor have enough information exposed to it, to make it work.
              https://github.com/iniside/ActionRPGGame - Action RPG Starter kit. Work in Progress. You can use it in whatever way you wish.

              Comment


                #8
                Originally posted by TimeSpirit View Post
                That scene with all the colored grass looks great- I'm curious how it actually runs.
                This sample scene run in udk with 120fps (460gtx). In UE4 is the same performace.

                The important thing is to clone your landscape(ground) texture and set the mipmap to 128px or 64px.

                You can expand the shader, for example, snow, autumn, rain, wind or alpha mask death trees.
                Last edited by Ulrich.Thümmler; 07-24-2014, 08:07 AM.
                reference
                http://dirty-windows.de

                my blog
                http://ulrichthuemmler.blogspot.com/

                Comment


                  #9
                  The Witcher 3 grass looks a bit like what I had in mind, after a quick glance, looks good as well. I think I understand what they did but need to read through it to form how I'd do it. The whole document seems like an interesting read actually, thanks for that!

                  Inside, yeah, Refractor 2 (Battlefield 2) had that same option, which is where I got the idea from to try this out.

                  Ülrich, great work on that grass, it looks fantastic! And gives me something to try out with the material, will be testing it tonight. Thanks for clarifying the numbers!

                  Thanks everyone for the help, I'm loving the helpfulness of this community! I'll post an update on if I get it working!

                  Comment


                    #10
                    The basic idea is to have a texture showing the base colors of the underlaying terrain. When using an external terrain generation software you might be able to export that texture from there. Otherwise you could to a top down render of your landscape in game or editor.

                    Once you got the texture it's all about sampling it properly in the grass material to match the actual landscape size and position:
                    Click image for larger version

Name:	landscapegrassblendf3s34.jpg
Views:	2
Size:	293.6 KB
ID:	1052930
                    3.14159265359

                    Comment


                      #11
                      Originally posted by mAlkAv!An View Post
                      The basic idea is to have a texture showing the base colors of the underlaying terrain. When using an external terrain generation software you might be able to export that texture from there. Otherwise you could to a top down render of your landscape in game or editor.

                      Once you got the texture it's all about sampling it properly in the grass material to match the actual landscape size and position:
                      [ATTACH=CONFIG]7480[/ATTACH]
                      Noob here How do I make a top down render of the landscape?

                      Comment


                        #12
                        Switch from perspective camera to top.

                        Comment


                          #13
                          Originally posted by Kuro1n View Post
                          Switch from perspective camera to top.
                          Thank you

                          Comment


                            #14
                            has anyone figured out a way to actually get the color from the terrain? if I take a picture from up top and then I repaint something on the terrain I'll have to start over.
                            Current Projects -Cat Interstellar
                            Lead Developer - Ionized Games

                            Comment


                              #15
                              Originally posted by sanford87 View Post
                              has anyone figured out a way to actually get the color from the terrain? if I take a picture from up top and then I repaint something on the terrain I'll have to start over.
                              I have a color overlay map on my grass tileset material, it tints the grass to give it variety. I then use the same map and scaling (world coordinates) on the grass model material.

                              This way wherever I paint my grass, it always matches the landscape material.

                              Comment

                              Working...
                              X