So, I recently upgraded to 5.0.1f1 from 5.0.0f4 and noticed that my terrain has a shiny layer has been added. All of the terrain tiles we use are generated via script and are using the “Built In Standard” for the Base Terrain material. Running from the editor, I tried changing the material and noticed that the “Built In Legacy Diffuse” is the Material that removes the odd shiny effect. In the picture below, you can see where the Legacy looks correct and the adjacent terrain tiles have the shiny effect.
As a current workaround, I have a small, hidden terrain object in the scene with the correct material that I want to use. Then for all generated terrain tiles, I set the material type to the one from the corrected terrain game object’s material type. Really not optimal… is there another way to programmatically reference the built-in materials?
Manipulating the direction of the global lighting does not change the effect, neither does disabling lighting from Scene view.
Another developer here has not upgraded yet (from 5.0.0f4) and does not encounter this rendering issue, so I can assume that it’s something to do with the changes in the version that I am using.
Is there a way for me to manipulate the Built In Standard material to not cause this shiny effect? Is this a known issue from the changes in 5.0.1? Or am I just stuck with using the Legacy Diffuse material for my terrain?
Update: Also tested with 5.0.1p2 and the effect is still there.
I don’t see a slider or anything that will let me modify the smoothness for a texture…
All I am doing is setting a loaded image to the texture of a SplatPrototype for the terrain. I tried setting the splat.smoothness to 0, but the effect still shows.
OK then we’ll need a repro project to figure out what’s going on. Is it possible for you to extract a single scene from your project in which you can reproduce this issue and attach it here?
I generated a completely new project from Unity 5.0.1p2, copied the bare essentials of the code and source data. Running it, the terrain still appears shiny. Please note, I cannot edit the source texture image and must use it as is. If any modifications need to be done to the image, they must be done through the Unity script and not from an external non-live editor.
Had to host it on my dropbox as the zipped project exceeds the forum attachment size (3.63mb): project link.
In your script, you used Texture2D.LoadImage to load a .png file. Texture2D.LoadImage will load any .png file into ARGB32 format. If the original image doesn’t have an alpha channel (which is your case), the default alpha value for the Texture2D is 1.0. As the standard terrain shader uses the alpha channel of the splat texture as the smoothness value for the surface, you got a very shinny surface with its smoothness = 1.0.
Changing the source image into .jpg format fixes the problem, as Texture2D.LoadImage will load .jpg files into RGB24 format. Terrain material system will correctly handle this format (smoothness will be controlled by SplatPrototype.smoothness instead).
If you can’t do anything about the source image, here is one of the tricks you can do in the scripts:
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(File.ReadAllBytes(pngImagePath));
texture.LoadImage(texture.EncodeToJPG(100));
Since the source texture can be either from file cache or loaded from the web. Things look back to normal now, I get to retain the standard material for terrain and no longer need the awkward extra base terrain tile.
I was using textures imported into Unity and getting the same shine on quite a few objects not just the terrain. I checked the import settings for all my textures and unchecked Alpha from greyscale and it looks fine now.
Hey guys I figured out a easier way to do it without coding just click on terrain and than click on the gear far right of the inspector under terrain, there you will see Base terrain next to material click and select "Built in Legacy diffuse’ and the shine will come right off. No need to open coding windows it wasnt that complicated XD
Considering that our terrain was being generated at run time via script, we definitely needed to edit the terrain data via script. The use case if for those that are doing streaming terrain and from source images that we cannot modify.
click on your terrain and make sure it’s selected in your hierarchy.
on your far right under the inspector tab, next to the little pad lock, look for a down arrow on the right side, click on the down arrow and select DEBUG.
There, under the DEBUG window, look for the terrain tab. There you will look for REFLECTION PROBE USAGE, have that setting set to Zero (0).
Then leave DEBUG and select NORMAL on the down arrow.
I found another fix thanks to some of your suggesting getting me looking in the right place.
I found that if you go into the Terrain Settings and change the Splat Map Distance, this has a great effect on how shiny the terrain texture is. Changing this to a value lower then 500 removes all shininess. At least for me! It seems a bit wonky.