- Home /
help,the tree became Pink Billboard
Since I use Unity 3, all my tree (with terrain) become pink when they swap to billboard version. And only on the webPlayer, on Unity Editor it's ok.
check the log it says:
shader 'Nature/Tree Soft Occlusion Bark': dependency 'BillboardShader' shader 'Hidden/Nature/Tree Soft Occlusion Bark Rendertex' not found
Shader 'Nature/Tree Soft Occlusion Leaves': dependency 'BillboardShader' shader 'Hidden/Nature/Tree Soft Occlusion Leaves Rendertex' not found
please help
As of April 2012 and the 3.5 release, this is still an issue. It happens in any compiled version (e.g. webplayer, standalone, but not in the editor) when loading a scene from an AssetBundle.
Answer by Heather · Nov 19, 2010 at 03:41 AM
I'm sort of new at this, but I've had similar happen. May be these problems:
1) You accidentally deleted your Bark texture shader and leaves texture. When a material is deleted and has nothing to replace it, it becomes pink. ?
2) I'm not familiar with using the web player, but I assume you need to place the assets there that are missing.
3) You deleted the assets in your project folder, but not your hierarchy.
Hope one of these helps!
thanks for answer,but the tree shaders are bulit in so you can't delete.... in editor it's ok,it's just like the trees shaders aren't pakced into web player file.
Answer by adam michaels · Apr 12, 2011 at 03:29 PM
I tried the solution from RAB, but to no avail. I posted my response to that forums thread as well. I can only eliminate pink billboards for the Trees that I add to the WebPlayer startup scene terrain (1 of each tree type)... this is not workable, since each tree seems to add 0.5MB or so of size to my webplayer.
I need to know the answer to a low-level question then, I think -- I am supposing that the billboards render using a generated texture (but has no asset file associated with it). How do I access this generated texture? I would love to save it out and include it somehow as a bundle.
Use Case is this: 1. Artists make a beautiful Terrain and Environment -- all stored beneath a single top game object. 2. Artists make this object into a Prefab. 3. Artists build this Prefab into an Asset Bundle. 4. Run-time we load and instantiate this Asset Bundle. 5. It works perfectly -- except for the PINK TREE billboards! Critical defect!
the bilboarded textures are generated at runtime, so including a texture wouldn't help even if you could. Plus, as you can see, the pink trees still have the correct shape, which it gets from the alpha of the billboard texture. So I guess it's not the texture that's missing, but the shader.
But if that solution of jonnyhilly works, it would mean the shaders aren't included because of an easily fixable bug in Unity. This should be one of their top priorities.
Answer by unitylove2 · May 31, 2011 at 01:42 PM
Your problem is caused by using AssetBundles (as you mentioned in the comments).
Here's a workaround for that bug: Create a dummy object which uses a material with the missing Nature (billboard tree) shader. That way the shader for the billboard trees is not being 'neglected' by Unity when building an AssetBundle.
You should be able to include a reference to the shader in a public variable in a script too - just so long as there's a reference somewhere, Unity will know to include it.
Answer by jielin · Nov 23, 2011 at 09:47 AM
use BuildPipeline.BuildPlayer to builder webplayer after all build scene, not use unity build, it will resovle this problem. it looks like this:
BuildPipeline.PushAssetDependencies();
foreach scene in scenes
BuildPipeline.BuildStreamedSceneAssetBundle scene
....
end
BuildPipeline.BuildPlayer...
....
BuildPipeline.PopAssetDependencies();
I just tried this solution in our project (in Unity 3.5) and it didn't seem to make any difference. Here's the code I'm using - perhaps I made a mistake?
using UnityEngine;
using UnityEditor;
using System.Collections;
public class CreateAssetBundleFromScene : $$anonymous$$onoBehaviour {
[$$anonymous$$enuItem("$$anonymous$$y$$anonymous$$enu/Create Win64 AssetBundle From Scene")]
static void createAssetBundle()
{
string[] sceneName = new string[] { "Assets/" + Application.loadedLevelName + ".unity" };
string outputName = Application.loadedLevelName.ToLower().Replace(' ', '_').Replace("scene", "");
while (outputName.Substring(outputName.Length - 1) == "_")
outputName = outputName.Substring(0, outputName.Length - 1);
outputName = "windows64_" + outputName + ".unity3d";
Debug.Log("Creating AssetBundle for scene " + sceneName[0] + ". Saving to " + outputName);
BuildPipeline.PushAssetDependencies();
BuildPipeline.BuildStreamedSceneAssetBundle(sceneName, outputName, BuildTarget.StandaloneWindows64);
BuildPipeline.PopAssetDependencies();
}
}
@jielin are you sure that is the code? In your code BuildPipeline.PushAssetDependencies();
foreach scene in scenes
BuildPipeline.BuildStreamedSceneAssetBundle scene
....
end
BuildPipeline.BuildPlayer...
....
BuildPipeline.PopAssetDependencies();
What is the point of doing BuildPlayer after BuildStreamedSceneAssetBundle. Its not like BuildPlayer is taking in parameters that use the output of BuildStreamedSceneAssetBundle. I also wrote something similar to @Julien.Lynge and it did not work.
It looks like this
var scenes = new[] { "scene1" };
foreach (var scene in scenes)
{ Debug.Log("Building scene [" + scene + "]...");
// build the scene as an asset bundle
string inputPath = "Assets/scenes/" + scene + "/" + scene + ".unity";
string outputPath = GetOutputPackagePath("scenes/" + scene, "terrain");
BuildPipeline.PushAssetDependencies ();
string result = BuildPipeline.BuildStreamedSceneAssetBundle (new[] { inputPath }, outputPath, BuildTarget.StandaloneWindows);
//BuildPipeline.BuildPlayer(new[] { inputPath }, outputPath, BuildTarget.StandaloneWindows, BuildOptions.BuildAdditionalStreamedScenes | BuildOptions.UncompressedAssetBundle);
BuildPipeline.PopAssetDependencies ();
Debug.Log("Result: " + result);
}
Thanks
Answer by dinsley · Dec 21, 2010 at 02:19 AM
check out this first http://unity3d.com/support/documentation/Components/terrain-Trees.html
after you go through that, and get re-acquainted with how to put the trees in game. Your problem has to do with the material that you're using.
Click on the object in your project, in the inspector look for Shader
it should say diffuse, but you need to change that to Nature/Tree Soft Occlusion Bark or Nature Soft Occlusion Leaves otherwise the billboard affect happens.
There's another thing that they say that you need to do is put the tree into a folder containing the words "Ambient-Occlusion" so that Unity applies occlusion to your trees.
Hope this helps
Your answer
Follow this Question
Related Questions
Tree billboard with tree creator shaders 0 Answers
Problem with unity tree billboarding 0 Answers
Water Pro + Terrain Tree Billboard Shaders 1 Answer
Tree billboards with ZWrite 1 Answer
Tree billboards have a white outline... 0 Answers