• TwitterFacebookGoogle PlusLinkedInRSS FeedEmail

Nature Soft Occlusion Shader Unity

5/13/2019 
Nature Soft Occlusion Shader Unity Rating: 7,3/10 835 reviews

Apr 17, 2014 - On loading the scene, the shaders Nature/Soft Tree Occlusion Leaves and Nature/Soft Tree Occlusion Bart do not work correctly on ter. So, I have some custom trees using the 'Nature/Tree Soft Occlusion' shaders and they looked great before baking a lightmap. However, now that I. 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'.

  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. }

Unity Custom Shader

NatureNature soft occlusion shader unity
tutorials‎ > ‎

gaia_terrain

Dec 31, 2015

Gaia 1.0 Unity Asset store
Unity 5.1.2
Gaia with rpg kit
175MB
not the terrain covered here
A couple of things that aren't in the manual or not covered well-
from standard assets- free on asset store-
Note: you'll need 'speedtree' and 'effects' to see his demo. Also 'environment/water/basic' at least if you
want water. My project already had Water/basic from RPG kit. There's also Environment/Water/fancy if you want that.
Importing old terrain, go window/gaia/gaia manager and /utilities, load your terrain and
gaia_utilities_export_png
Then 'show scanner' and drag in the .png it made, it may put it in Gaia/stamps/mountains or somewhere like that, then
when you go
gaia manager/advanced/create terrain, you can drag the png into texture 2d of the stamper. in Stamper 'show terrain helpers'
and smooth the terrain with the stamper not visible, the terrain will be very stair-step like.
gaia_create_terrain

It will say are you sure you want to smooth all terrain tiles? Yes,
get a shaded wireframe (upper left corner of scene view) to see if it's smooth
Make a couple of empty gameobjects, put an icon on them in their inspector upper left, because you'll need to FKEY focus on these
to see your terrain up close, move them to a spot then FKEY or get a view, select them and 'gameobject/move to view' Zooming in
on Unity terrain doesn't work.
view_anchors
Make a ctrl-D copy of your /project/gaia/data/gaia resources for every different tree/weed/gameobject setup you want to
try. Then for all your spawners pick Gaia_res_bog4 for your resources file.
Update: You need a new terrain from scratch to use a new resources file.

.
select the tree spawner and lock its inspector
You'll have to study the rule (for tree placement) selector there's all, fittest, weighted fittest, and random
location selector random location random location clustered, every location, every location jittered
There's a wank load of parameters, I just change the tree
tree_parameters
Once you've changed the trees, go back to your tree spawner, it will still read 'sonamoo, mogua' (the old trees) until you click on the names
then they'll change.
But 1st to see if they'll even paint on terrain, add them to the terrain, in the tree icon in inspector-
If you don't see a tree at all, it won't paint.
'The tree caveFern_fixed must use the Nature/Soft Occlusion shader. Otherwise billboarding/lighting will not work correctly.'
This means the Leaves must have nature/soft occlusion, bark could be legacy diffuse, or lmaybe not, but I have trunks that get
trashed with the nature/soft shader so I leave them at legacy/diffuse
If you get 'no valid mesh renderer' it's because you have an empty game object parent with subobjects like trunk, leaves, you
have to fix this in blender so it's all one object.
TIP: always tweak your 'base light' amb.occlusion, etc in a LIGHTED scene view, unlighted is completely different.
copal_tree_ron_lights_in_scene

Make sure your tree_spawner is using Gaia_bog3 resource file or you'll get the same old trees.
Warning if you check 'get from terrain' it means load the trees that you have in your terrain object 'paint tree' inspector I ended up with 14, including 7 I didn't want.
New terrain, bogwood5, same .png file
First you have to stamp it to make the terrain helpers- smooth in stamper work, i did it 3 times (later 5 more)
daylight simple water dimensions for a standard terrain- 1300 x and y
bogwood_5
I smooth it one more time, lets see if it does my trees and weeds

I don't like the 2 texture terrain so i make it all 1 texture. Most real terrains only have 1 texture, except
for say a sandy dry river bottom with green banks. For cliffs, why not use actual rocks like professional

The detail(weeds)
I check rule selector random get different fitness and failure rates
weed_fitness_failure
it's got all 16 weeds
I only had 5 trees so I add 2 more
add_duion_fir_a_Christian_n
to add a tree up the number of 'size' by1 and hit enter, you'll get a copy of the last tree, edit it. Note I'm loading all of these
into my tree painter area of Terrain to see if they show up vertical.
The resources are in gaia_bog3, but the tree spawner doesn't update, hit 'advanced' on the gaia manager to spawn 1 (ONE) tree spawner,
if you create a full set accidentally delete them.
It makes a bunch of trees, but 1 of them is insanely huge, and 2 are very tiny, I fix their model import settings.
when I mess with a tree unity crashes forgot to save scene, start over, this is weeds random every location jittered, I think it means if I plant a
weed, move the next instance of the weed a distance away, have to look it up. The one I used before was better, probably have to try them all
The parameters-
rule selector- all fittest weighted fittest random
location- random random location clustered, jittered, etc.
WARNING the minus next to visualise doesn't mean 'dismiss the visualizer' it means DELETE THE TREE
I chose 'fittest', every location random
ekasia_a_likes_cliffs

all the other trees hate cliffs, note you have to pop back and forth between visualizer and tree spawner to get these infos
ekasia_a_spawn_criteria
If you get a tree where you don't want it, go to your terrain object, tree painter select the tree, hit
shift-paint to get rid of it. The new terrain seems to be planting the trees, the last one the cliff

This is useful, if you have a road texture, etc. it won't draw any trees there. Checks slot 3 for presence of slot 3 !3 checks for absence. Haven't tried this yet though. I draw my roads with thin paint brush.
matching_textures_check
Beats the heck out of me. Ekasia a has the same criteria (I didn't edit anything) but the opposite feeling toward cliffs as all the others.
trees fittest, every location jittered was going very slow so I switched to weighted fittest random location
TIP: to get a view of your level w/o making a FP controller, select main camera in scene, get a game window, and move/rotate the main
camera around
I'm getting no trunks at a certain distance because they don' have nature soft occlusion shaders (not billboarding, which is a 2d image of the tree
at a certain distance, have to fix that I guess.
My trees tree_d
copal
duion_fir_tal
ekasia A
cave_fern_fixed
duion fir a
christian
Some of them have black trunks when I choose 'nature/tree soft occlusion bark' Have to have it
for the billboarding, no idea why this is. If you have a non-symmetrical tree, which looks different
from different angles, spawn it as a GameObject and you can rotate it randomly.

Note if you have your texture spawner inspector locked you wont see the visualizer
here's some shots
fog shot
there's a free fog script- search unity forum for this
Extended Global Fog (Unity5)
forum.unity3d.com/threads/extended-global-fog-unity5.313358/
haven't tried it yet.
Where it goes into standard assetseffectsimageeffectsscripts
standard assetseffectsimageeffectsshaders
select your main camera and in inspector- 'add component' global fog, then you'll see it in the

Next for the rocks (game objects)
I got these rocks from the asset store rocks 2 manufactura k4
you can see they need to be stuck further in the ground,
its a group of 4, single rocks wouldn't need lowering.
A lot of stuff buried behind these tiny arrows
the offset was in rock1LOD-grup4/instances/rock1LOD_grup4
rock_lod_grup2_terrain_offset

If you make any changes you have to 'reset' the
game object spawner in spawn controller at the bottom
of inspector, have a scene view of your rocks, I see
that -0.5 was too much so I go for -0.2
Remember you set the parameters in Gaia Resources,
not the Game Object spawners
Apparently if you have a group, they're not going to
conform to slope, even if you turn off 'rotate random'
so you either have to fix all the groups by hand or
use individual rocks.
You'll probably wipe out all your rock changes if you change something else,
not sure.
I change the terrain offset from -0.1 to -0.5
So you can get a nice Gaia terrain, but you have to start with a fresh terrain, putting new resources on a terrain that had a different resource file
doesn't work.
There's also a fog particles that you can attach to your camera, duckduckgo Chris Deleon unity fog efffect youtube. Just a video, you'll have to get
his settings off of it.
The rocks are 'popping in' have to find that setting, should be in gaiadefaults or the terrain gear icon
tip: if your player falls through the terrain at teleport, pause it and pull him up above ground, no idea why this is happening.
tree trunks are all black, 'nature/soft occlusion bark' bug, if you don't have it you'll get no trunks though.
make sure weeds all use billboarding
Copyright 2015 by Terry Morgan
hike1213@gmail.com