Hi, I am new to Unity and 3d itself and just playing around with some basics. But now I have a question about of a strange color problem and how to use textures properly. In my scene are only brown cubes, but looking from a special distance and angle the cubes get a green discoloration and I don’t know why or how to fix this. I uploaded a picture to show what I mean (and the unity test project):
This big cube consists of many small cubes which are instantiated prefabs via a script. The prefab cube has a “dirt” material assigned with a standard diffuse shader and a texture imported with aniso level 1, bilinear filter mode and repeat wrap mode. The material’s tiling and offset properties are set because the texture image has not only a dirt part, but also a green grass part for an other cube for the future. So in the image there are 4x4 quad slots for different terrain types and to my dirt cube there should only be the dirt quad assigned to wich is on position 1x2. That’s why tiling x is 0.25, tiling y 0.25, offset x 0.25 and offset y 0.75. In the preview window everything looks fine for a single dirt cube, no parts of green grass or other colors are visible. If I instantiate the prefab dirt cube, it looks okay. There are no green parts visible, but some edges seems to be white. I figured out that’s because of my white background in the texture image, so I switched it to black and the single cube in unity’s game mode looks fine. So I instantiated a lot of these cubes forming the huge cube shown in the picture above and there are no white edges, only black edges which are not so obviously and the green tint which in turn is. It seems to me, the green is belonging to the grass quad next to the dirt quad in the texture image which is also drawn in the scene, like the white/black background. I tried to fix this with tweaking the material’s tiling and offset properties, but I can’t get rid of this green, nor of the black/white edges. Changing the aniso level of the texture importer from 1 to 2 or the filter mode to trilinear softens the problem, but does not fix it. The only solution is to use one texture for each terrain quad, so there are no other terrain types and colors in the image and no tiling is necessary. But the documentation mentions this should be avoided, so using multiple terrain types for different cubes in one texture image should be the right way. I could try to place all green quads on one side of the texture image and the brown quads on the other surrounded by almost equal looking quad pictures, but there will always be some quads aligned which have different colors, maybe not in this example but later for sure. What can I do to fix this strange discoloration of edges? Is there something I did wrong or misunderstood? Any advise is welcome and thanks for it in advance.