Unity Community


Results 1 to 10 of 10

  1. Posts
    6

    Shader for grass

    Hey dear community,

    is there any way to improve the look of grass assets, like adding a bit of gloss or normal map?
    Because in the grass paint options you can only add the texture and some settings.

    I dont know why, but it looks pretty crappy Name:  Test.png
Views: 1220
Size:  1.43 MB
    Maybe because there is no variation in it, but can you add gloss or normal maps on it or any other
    suggestions?

    Sincerly,
    ElGreco
    Last edited by ElGreco; 06-02-2013 at 08:42 AM.


  2. Location
    The Netherlands
    Posts
    420
    What shader are you using?
    Normal mapping might help to simulate the curvature the of leaves. Right now they look like they're part of a flat plane (because they are).


  3. Posts
    56
    Quote Originally Posted by ElGreco View Post
    Hey dear community,

    is there any way to improve the look of grass assets, like adding a bit of gloss or normal map?
    Because in the grass paint options you can only add the texture and some settings.

    I dont know why, but it looks pretty crappy Name:  Test.png
Views: 1220
Size:  1.43 MB
    Maybe because there is no variation in it, but can you add gloss or normal maps on it or any other
    suggestions?

    Sincerly,
    ElGreco
    TRy creating a shader with two grass textures and use 1 alpha channel 2 blend them together. Then use a normal map and a rim light . And youre done.


  4. Location
    France
    Posts
    192
    If you want to improve your grass, you can use other shader like you said, but I suggest you to look at some modeling tutorial.
    It's not hard and you could improve your rendering.

    As you can see in this tutorial. The grass is not in one flat plane, you need to create multiple rounded planes (not so much, I think you care about performances).
    You can follow this tutorial on Unity until step 7), next is for creating grassmaps.

    PolyCount Grass
    Crydev


  5. Posts
    56
    this is a example of how i use grass
    Name:  Screen Shot 2013-06-05 at 13.24.51.png
Views: 669
Size:  590.9 KB
    these are the settings
    Name:  Screen Shot 2013-06-05 at 13.25.19.png
Views: 658
Size:  54.9 KB
    and this is the code
    Code:  
    1. Shader "MMWizard/Rim/Terrain" {
    2.     Properties {
    3.       _MainColor ("Main Color", Color) = (0.5,0.5,0.5,0.0)
    4.       _MainTex ("Main(RGB)", 2D) = "white" {}
    5.       _SeconTex ("Second(RGB)", 2D) = "white" {}
    6.       _MaskTex ("Mask(A)", 2D) = "white" {}
    7.       _BumpMap ("Bumpmap(RGB)", 2D) = "bump" {}
    8.       _RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
    9.       _RimPower ("Rim Power", Range(0.5,20.0)) = 5.0
    10.     }
    11.     SubShader {
    12.       Tags { "RenderType" = "Opaque" }
    13.       CGPROGRAM
    14.       #pragma surface surf Lambert
    15.       struct Input {
    16.           float2 uv_MainTex;
    17.           float2 uv_SeconTex;
    18.           float2 uv_MaskTex;
    19.           float2 uv_BumpMap;
    20.           float3 viewDir;
    21.       };
    22.       float4 _MainColor;
    23.       sampler2D _MainTex;
    24.       sampler2D _SeconTex;
    25.       sampler2D _MaskTex;
    26.       sampler2D _BumpMap;
    27.       float4 _RimColor;
    28.       float _RimPower;
    29.      
    30.       void surf (Input IN, inout SurfaceOutput o) {
    31.           half4 main = tex2D (_MainTex, IN.uv_MainTex);
    32.           half4 sec = tex2D (_SeconTex, IN.uv_SeconTex);
    33.           half4 mask = tex2D (_MaskTex, IN.uv_MaskTex);
    34.          
    35.           o.Albedo = lerp(main.rgb, sec.rgb, mask.a);
    36.           o.Albedo *= _MainColor;
    37.           o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
    38.           half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
    39.           o.Emission = _RimColor.rgb * pow (rim, _RimPower);
    40.       }
    41.       ENDCG
    42.     }
    43.     Fallback "Diffuse"
    44.   }


  6. Location
    Australia, Brisbane
    Posts
    578
    Quote Originally Posted by ElGreco View Post
    Name:  Test.png
Views: 1220
Size:  1.43 MB
    The color of your grass is way to dark compared to the terrain, either darken your terrain texture or lighten your grass detail to match either one, this will make a much more realistic blend. Think of it as not trying to make your grass look like a separate asset, your trying to give you terrain more depth.



    What you can also do is use crossover planes for a detail mesh instead of bill boarding a single plane, this will add a lot more depth.
    Last edited by Ben Massey; 07-17-2013 at 05:10 AM.


  7. Posts
    5
    Sorry to bring this post back up, but, Ben, what is a "crossover plane"? I've tried to find this phrase elsewhere and haven't gotten any good leads.


  8. Posts
    412
    I think he meant something like what's shown at figure 7-4 at http://http.developer.nvidia.com/GPU...gems_ch07.html


  9. Location
    Australia, Brisbane
    Posts
    578
    Quote Originally Posted by Dolkar View Post
    I think he meant something like what's shown at figure 7-4 at http://http.developer.nvidia.com/GPU...gems_ch07.html
    Sure do, I've updated my post I case anybody els is having trouble. Most design elements in unity are quite universal in the software world so it's good to do some research on other engines as well.

  10. rea rea is offline

    Posts
    716
    Disabling billboard option should do the joba isn't?
    billboard grass is evil btw.....if you looking for realistic grass style

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •