Grass artifacts

I am getting these artifacts from the grass and weeds in Unity and the Terrain Assets. Does anyone know how to get rid of them or why they are there?

I modified the texture to make it look toonish which is why it looks different. Nothing more than a few filters on the layer in Photoshop. The Alpha layer went untouched. The artifact is at the top of the textured plane, but the alpha shows that it should be transparent.

341762--11969--$artifact_188.png

I get them too :frowning:

This has been brought up many times. Do a search.

From what I gather here:
http://forum.unity3d.com/viewtopic.php?t=8779

Its either a psd error or its something from the texture map that brokenpoly mentioned. I will try to change the native file type tomorrow when I have time to play in Unity again. Hopefully a file type change will fix it.

Try to change your texture setting “Wrap Mode” to Clamp.

when you have transparent textures, the “repeat” wrap mode often cause artifacts to the corners. else it could be a texture compression artifact.

Ok, here is something strange. I changed the texture size from Max Size of 1024 to 256(the actual texture size) and the line went away. I bumped it back up to 1024 to see if the line would come back and it did not. I am very confused. I saved as a tiff and line still stayed. Also changing wrap mode to clamp. Only when I changed texture size did it go away but changing back to the original size did not create the problem again. :? So it seems its at least temporarily fixed.

I would like to note that the lines appear only when I add a detail mesh and change its rendering mode from grass to vertex. Then changing the mesh back to grass does not get rid of the lines. I had a whole field of grass get lines above it previously when I added a detail mesh(rock mesh from the terrain assets pack). Deleting the detail mesh got rid of the lines in the grass too. :? Just some more info on how I have worked with this problem before.

1 Like

On a somewhat off topic, where did you get your grass from? Is that a in the standard or terrain assets and I just missed it? I am in need of more “prairie-looking” grass.

I modified the textures from the standard grass in Unity and the Terrain Assets pack. The golden “grass” in the image is actually the “weed” texture but I changed the color balance to make it yellow instead of green. :slight_smile:

Edit: Here is an image of my modified default grass texture. Played with the healthy and dry colors and grass tinting. This is the result. The default grass can look rather good. Mine is more toony though, ran it through some cutout and pallet knife filters in Photoshop. I also don’t billboard the grass as I think that takes out much needed depth.

342297--11982--$grassfield_158.png

this is an old problem from an art perspective.

this is one problem and one problem only:

the upper extents of your uv unwrap are RIGHT at the top of the texture. the shader will attempt to repeat the texture, and what you’re seeing there is the VERY BOTTOM of the grass texture repeating up to the top of the plane.

frankly, clamp might (shoud?) have fixed it, but if you want to be certain, the best way is to simply edit the uvs of the plane that you’re using in a 3d program, and pull down the top uv-verts so that they are away from the top of the texture. if you have a 3d program you can play with this manually and see what i’m talking about.

btw, i certainly HOPE that you are using a 3d program, and these textures aren’t projected onto unity plane objects… which have an insanely high polygon density…

The grass is just a plain PSD with RGB layers and an alpha layer. I am using the default terrain->add grass. So I am unsure of how to change the UV wrap as there is none, its just the terrain grass with uses two triangles to create a plane to project the grass onto. Also, its the grass textures that come with the standard assets and terrain assets with only modifications to the RGB layers, not the alpha. So I am assuming that there textures were tested by the Unity team before release.

I think I was able to solve it. Unity defaulted to my larger texture import size of 1024 and the grass textures were 256x256. Once I changed the size the lines have disappeared and haven’t come back yet. Perhaps the lines are artifacts from up-scaling the image? Either way it seems that is the issue as changing to clamp from repeat and playing with having mipmaps and all other various settings didn’t change a thing. Once I changed to 256 it went away but then I changed it back to 1024 and it didn’t come back yet.

I am rather confused. The lines only first showed up when I added detail meshes and changed their rendering from grass to vertex lighting. Deleting the mesh usually makes the lines go away, but I need detail meshes in my scene. It seems for now, changing the max texture size is the solution.

yeah, the reason that upping the size of the texture is fixing the problem is that there’s more space for the geometry to sample from, so it’s less likely to bleed over to the bottom again. you could also make sure that you turn off mip-mapping on your texture import settings for the grass. that might very well solve the problem as well

it’s your project, but using a 1024 image for grass is pretty much totally unacceptable, as it’s a gargantuan waste of resources.

if you can’t edit the geometry, you could try adding some transparency to the bottom of the texture… so on the texture, the grass starts just an inch off the bottom.

there is some crazy chance that this is something else, but I’ve seriously run into the problem about 50 times in my career.

I think you misread me. I have 256x256 grass textures and upsizing was causing the problem it seems. Which seems rather strange.

MakerOfGames, where is the option to not billboard the grass? I think your image looks great. Also, did you just match the tinting to the terrain texture that you were using?

Thanks!
The option to not billboard the grass is under edit grass->scroll to the bottom of the small grass properties window and uncheck Billboard. Billboarding grass also takes some resources so by turning off bilboarding you will increase FPS by a few frames(at least on my system it did). And yes I tried my best to match healthy and dry colors of the grass to match it with my grass texture on the terrain.

All the maps for grass and detail objects are compiled into one map. If you have detail textures without alphas or with all white alphas they’ll bleed into your grass textures! If you don’t need alphas in your detail textures just go into Photoshop and add a channel in the channels panel and make sure it’s black.
Turn on all of your channels including the alpha.
Your texture should have a red tint to it but don’t worry it wont look like that in Unity.
Save it as a 32 bit alpha and make sure when you bring it into Unity it interprets it with an alpha.
Replace the old texture with the new one in your detail mesh.
Once all your detail meshes have alpha, edit one of your detail meshes or grass textures and it should update.
Now the lines in the grass textures should be gone!

Hello.
I am getting this artifact in the grass, at certain distance from the viewer, and angle. White pixels around the alpha channel.
It’s not an alpha problem because:

  1. I am using TGA (no PSD or PNG alpha problem)
  2. The tga background is green (no white pixels)
  3. It’s just with grass under realtime shadows at certain distance and a bit random.

I tried turning off mipmaps, changing texture size, even the filtering mode. Nothing solves the problem.

I discovered this only hapens emulating Shader Model 3. With Shader Model 2 that doesn’t happens…
I will update my drivers just in case.

Deicoon is correct. This is not clamping or mip maps. It’s an artifact from Unity putting all the detail textures into one map internally. You have to imagine all the detail textures layed out in the same images packed as close together as possible. Whether you have an issue will just depend on how Unity decides to lay things out. The poster who changed the max size of the grass texture caused Unity to change the layout and the grass texture was no longer bordering a non-alpha texture. I solved it by removing the Rock mesh from my list of detail objects. Now I only have textures with alpha maps in my detail object list and the artifacts are gone. If I want to add the rock I guess I’ll have to make a texture for it with a border having alpha 0.

1 Like

Maybe it could be added to the documentation? Forums are a poor substitute for that…

Cyberben3d is right. The artifacts disappears only if change detail objects (ie rocks) texture.