Nature Soft Occlusion Shader Unity
How do I make a shader that operates like the Nature/Tree Soft Occlusion Leaves? I just recently updated to Unity 5 from 4 and now the shader I used for grass Nature/Tree Soft Occlusion Leaves isn't showing up.
- Properties {
- _MainTex ('Main Texture', 2D)='white'{}
- _BaseLight ('Base Light', Range(0, 1))=0.35
- _Occlusion ('Dir Occlusion', Range(0, 20))=7.5
- // These are here only to provide default values
- _SquashAmount ('Squash', Float)=1
- Tags {
- 'IgnoreProjector'='True'
- }
- ColorMask RGB
- Pass {
- #pragma vertex leaves
- #pragma glsl_no_auto_normalization
- fixed _Cutoff;
- fixed4 frag(v2f input): COLOR
- fixed4 c = tex2D( _MainTex, input.uv.xy);
- }
- }
- Pass {
- Tags {'LightMode'='ShadowCaster'}
- Fog {Mode Off}
- Offset 1, 1
- CGPROGRAM
- #pragma fragment frag
- #pragma fragmentoption ARB_precision_hint_fastest
- #include 'UnityCG.cginc'
- V2F_SHADOW_CASTER;
- };
- struct appdata {
- fixed4 color : COLOR;
- };
- {
- TerrainAnimateTree(v.vertex, v.color.w);
- o.uv= v.texcoord;
- }
- sampler2D _MainTex;
- {
- clip( texcol.a- _Cutoff );
- }
- }
- Tags {
- 'IgnoreProjector'='True'
- }
- ColorMask RGB
- Pass {
- #pragma exclude_renderers shaderonly
- #include 'SH_Vertex.cginc'
- AlphaTest GEqual [_Cutoff]
- SetTexture [_MainTex]{ combine primary * texture DOUBLE, texture }
- }
- SubShader {
- 'Queue'='Transparent-99'
- 'RenderType'='TransparentCutout'
- Cull Off
- Pass {
- AlphaTest GEqual [_Cutoff]
- Material {
- Ambient [_Color]
- SetTexture [_MainTex]{ combine primary * texture DOUBLE, texture }
- }
- Dependency 'BillboardShader'='Hidden/Nature/Tree Soft Occlusion Leaves Rendertex'
- }
I am making a location in Unity, and all of my trees shine in the background, then return to their normal color when I get close enough to the,.
It is also not the skybox since when I disable that it still happens. How can I fix this? Why is this happening? Thanks in advance
Unity Occlusion Map
closed as off topic by podiluska, Richard M, Jürgen Thelen, AProgrammer, AnteruAug 26 '12 at 10:10
Megaupload premium account password. Questions on Stack Overflow are expected to relate to programming within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.
1 Answer
Turns out you just need to change the Shader to Nature/Soft Occlusion Bark Shader
to fix the problem. I found this on the Tree page, where it says:
Trees must use the Nature/Soft Occlusion Leaves and Nature/Soft Occlusion Bark shader. In order to use those shaders you also have to place the tree in a special folder that contains the name 'Ambient-Occlusion'. When you place a model in that folder and reimport it, Unity will calculate soft ambient occlusion specialized for trees. The 'Nature/Soft Occlusion' shaders need this information. If you don't follow the naming conventions the tree will look weird with completely black parts.
Hope this helps!