- Home /
Why the green horizontal lines above grass?
Recently, terrain areas with ordinary grass are covered with a thin layer of short horizontal green line segments, each one at the end of a blade of grass. This shows both in the scene window and the running game window. I haven't done anything unusual lately except import the Unity Terrain Assets from the store, and edited the x-y tiling on a couple of terrain textures (to improve appearance on hillsides). I'm using the indie version 4.3.4f1, and the project is the Unity Island Demo with a bunch of models and scripts added. Running on a fairly new MacAir, Mavericks OS. A game built for the Mac on June 12 did not have this problem, but deactivating most of the new objects added since then didn't make the lines go away. - Hosted image at i58.tinypic.com/9u16bo.png. - I read http://answers.unity3d.com/questions/118930/line-showing-at-the-top-of-my-tall-grass.html; I don't know if those lines are the same. In any case, I thought trying a new small project would be useful, and in fact the lines don't show there. So I still don't know what it is about my project that causes the lines. This answer also mentioned "clamping" the grass; but I can't find any reference to "clamping" grass in the documentation. Where is it? (Changing the edit parameters for the grass texture doesn't help.)
Answer by Jackevin99999 · Aug 24, 2014 at 12:05 AM
I have found a solution to this problem The issue is, whichever grass texture has a line above it, it is being caused by the next texture in the details list of your terrain: http://puu.sh/b4O1P/5013da3e84.jpg
What you need to do is go into every grass texture that is in the Details list under terrain, and make sure there are only transparent pixels on the bottom couple of lines, about 3 or so pixels.
Also, make sure you have clamping on under wrap mode in import settings.
Answer by GalanoDev · Jun 16, 2014 at 03:24 PM
When you edited the tiling you probably changed the atlas and textures are "overlapping". This means that your grass is also showing some of the texture top of it in the atlas. Try playing with the grass texture values, specially its height, so you stop getting the above texture.
I tried adjusting the grass texture values, with a wide range of max/$$anonymous$$ heights. No effect on the lines. Unchecking billboarding makes them shorter, but they are still there. Restoring the values as they were in an older copy of the project also failed. Is there anything else I can restore, the atlas itself perhaps, from the older version?
Well, somewhere in your project there must be an Atlas, a big sprite containing all of your other small textures. Each texture is referenced with a Rect that contains its position in the atlas and its width and height. Say that you grass is located at 0,0 in your atlas and its measures are 100*100 pixels, then your Rect would be something like: Rect(0, 0, 100, 100). If you change this height to say 50 ( Rect(0, 0, 100, 50)) then you will only see the lower half of the grass (and hopefully not the green lines). If this is the case, then you must play with this value to try and paint the whole grass while avoiding the upper texture (in this case the green lines), with something that would look like: Rect(0,0, 100, 98). Hope it works!
That makes sense; but how can I find and modify the texture Rect? The terrain editor parameters just affect scale. Reducing the grass max height gives me shorter grass with the same lines. Do I need to look through Unity-generated library or script files?
I have a feeling that the "workmanly" thing to do is to restore the last good project version and re-enter the new features, this time without modifying the tiling.
Answer by plindsey · Apr 26, 2018 at 06:38 AM
Hey y'all. If anyone finds this in 2018 and onwards, I found a simple fix that just simply shrinks the UV box slightly.
Save this WavingGrass.shader file to your project to replace the default grass one. http://pastebin.xyz/p?q=VDhWQkg
If that site fails you need to change line 35 in the built in WavingGrass.shader to
fixed4 c = tex2D(_MainTex, (IN.uv_MainTex * 0.98) + float2(0.01,0)) * IN.color;
Not a good idea. your method needs extra GPU calculation per pixel per triangle per frame. also it doesn't work when several sprites packed as one texture. If it's just one sprite in one texture, just set the texture's wrap mode to "clamp".
Problem is the detail textures are cul$$anonymous$$ated to an internal texture and doesn't use the texture you supply. The strip is from another texture not the wrap from the same texture. Unity needs to fix this in their terrain code really.
Your answer
![](https://koobas.hobune.stream/wayback/20220613151621im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotation error while painting grass with terrain editor 1 Answer
Line showing at the top of my tall grass 3 Answers
terrain grass doesn't appear 1 Answer
create a array or stream from a movie in unity3D 1 Answer
Console display 0 Answers