• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by liverol · Nov 09, 2010 at 08:41 AM · shadertreebillboard

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

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Julien-Lynge · Mar 26, 2012 at 11:54 PM 0
Share

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.

7 Replies

· Add your reply
  • Sort: 
avatar image
1

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();

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tommynator · Feb 23, 2012 at 11:37 AM 0
Share

That's correct - fixed my problem.

avatar image Julien-Lynge · Mar 27, 2012 at 12:25 AM 0
Share

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();
 }
 }
avatar image c_v · Mar 27, 2012 at 08:14 PM 0
Share

Same problem... Any solution found yet?

avatar image altra4u · Jul 31, 2012 at 02:09 AM 0
Share

@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

avatar image
1

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DecipherOne · Nov 29, 2012 at 12:28 AM 0
Share

This worked for me, thanks.

avatar image Julien-Lynge · Dec 13, 2012 at 05:19 AM 0
Share

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.

avatar image
1

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!

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Steven-1 · Apr 19, 2011 at 07:34 AM 1
Share

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.

avatar image
0

Answer by Ayrik · Feb 10, 2011 at 05:23 PM

Check out this forum post: http://forum.unity3d.com/threads/62633-Pink-tree-billboards-in-built-player-correct-shading-when-mesh-and-in-the-editor

It's not a fix, but it is a good workaround, try RAB's solution first, as it won't increase your initial download size noticeably.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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

Does the built-in Terrain Tree Billboard cast shadows? 0 Answers

Black Trees 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges