5/11/2019»»Saturday

Nature Soft Occlusion Shader Unity

5/11/2019
    86 - Comments
Nature Soft Occlusion Shader Unity Rating: 9,4/10 2511 votes

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.

  1. Properties {
  2. _MainTex ('Main Texture', 2D)='white'{}
  3. _BaseLight ('Base Light', Range(0, 1))=0.35
  4. _Occlusion ('Dir Occlusion', Range(0, 20))=7.5
  5. // These are here only to provide default values
  6. _SquashAmount ('Squash', Float)=1
  7. Tags {
  8. 'IgnoreProjector'='True'
  9. }
  10. ColorMask RGB
  11. Pass {
  12. #pragma vertex leaves
  13. #pragma glsl_no_auto_normalization
  14. fixed _Cutoff;
  15. fixed4 frag(v2f input): COLOR
  16. fixed4 c = tex2D( _MainTex, input.uv.xy);
  17. }
  18. }
  19. Pass {
  20. Tags {'LightMode'='ShadowCaster'}
  21. Fog {Mode Off}
  22. Offset 1, 1
  23. CGPROGRAM
  24. #pragma fragment frag
  25. #pragma fragmentoption ARB_precision_hint_fastest
  26. #include 'UnityCG.cginc'
  27. V2F_SHADOW_CASTER;
  28. };
  29. struct appdata {
  30. fixed4 color : COLOR;
  31. };
  32. {
  33. TerrainAnimateTree(v.vertex, v.color.w);
  34. o.uv= v.texcoord;
  35. }
  36. sampler2D _MainTex;
  37. {
  38. clip( texcol.a- _Cutoff );
  39. }
  40. }
  41. Tags {
  42. 'IgnoreProjector'='True'
  43. }
  44. ColorMask RGB
  45. Pass {
  46. #pragma exclude_renderers shaderonly
  47. #include 'SH_Vertex.cginc'
  48. AlphaTest GEqual [_Cutoff]
  49. SetTexture [_MainTex]{ combine primary * texture DOUBLE, texture }
  50. }
  51. SubShader {
  52. 'Queue'='Transparent-99'
  53. 'RenderType'='TransparentCutout'
  54. Cull Off
  55. Pass {
  56. AlphaTest GEqual [_Cutoff]
  57. Material {
  58. Ambient [_Color]
  59. SetTexture [_MainTex]{ combine primary * texture DOUBLE, texture }
  60. }
  61. Dependency 'BillboardShader'='Hidden/Nature/Tree Soft Occlusion Leaves Rendertex'
  62. }

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

Liam McInroyLiam McInroy

Unity Occlusion Map

closed as off topic by podiluska, Richard M, Jürgen Thelen, AProgrammer, AnteruAug 26 '12 at 10:10

Nature Soft Occlusion Shader Unity

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:

Nature soft occlusion shader unity

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.

Unity shader download

Hope this helps!

Liam McInroyLiam McInroy

Not the answer you're looking for? Browse other questions tagged unity3d or ask your own question.