Search Unity

Advanced terrain shaders for groundplants, trees and paths

Discussion in 'Made With Unity' started by larsbertram1, Jun 13, 2011.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    $ats_trees.jpg $ats_road.jpg $ats_fern.jpg


    hi there,

    in addition to my lately published shader for groundplants [http://forum.unity3d.com/threads/91055-Terrain-Engine-Shader-for-groundplants-supporting-wind] i am working on a package also containing a hacked tree_soft_occlusion_bark shader which brings bump mapping as well as receiving real time shadows and bending to all famous tree models from the official terrain asset or any other imported tree.
    last the package will ship with a shader and texture example which enables you to lay out rough paths and roads nicely blending with the terrain. those can be used e.g. with the great path and road tool published by sixtimesnothing.

    i hope you will like it! Coming soon to the asset store as a free package.

    webplayer: http://bit.ly/jitkzp


    lars
     
  2. Taigo

    Taigo

    Joined:
    Feb 18, 2010
    Posts:
    128
    That looks very nice!
    Keep it up :D
     
  3. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Nice....i like the grass btw....it match the ground textures ( how to create that actually? :p ).
    Btw...the camera movement is too fast. And...idk it is just me or maybe because 3.4 webplayer update, when moving across the area with grass the camera movement is laggy
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Last edited: Jul 6, 2011
  5. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Great work. Unity team should be kicked in the ass for not providing this by default.
     
  6. 95KillerZ95

    95KillerZ95

    Joined:
    May 27, 2011
    Posts:
    253
    Very good work! Unity should implent this in next versions....
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    hi there,

    the pack has been downloaded more than 300 times within the last 2 weeks, nice!
    nevertheless, it would be great to get some feedback from you folks:
    does it fit your needs?
    how do you like it?
    have you encountered any problems?

    so please post your thoughts or even screenshoots!

    lars
     
  8. rumblemonkey

    rumblemonkey

    Joined:
    Mar 25, 2011
    Posts:
    280
    Took a look. Ran beautifully on my HD 5850. Since you'd like feedback, here's what I saw in the demo:

    1. I really liked the deep feel of the tree bark and the path shaders; with a bit of work on the textures by a professional level designer, they'd probably look very close to real.

    2. I did not care for the wind simulation of the ferns. It just looks like a sin manipulation of the verts, governed either by vert painting or a bitmap; it needs more wind-like patterns of behavior; localized patterns of disturbance and variable wind simulation. Maybe try a local bitmap FBO centered around the POV, that updates as the POV changes world position and uses some gaussian blurred circles. It doesn't need a complex sim; just render a few quads with additive blurs against a black quad and move them over time, then save the result to FBO. I think that that would give a much more real result, and each pixel could simulate at least 2X2 meters and be fine. I'm surprised nobody's done it yet, honestly :)

    3. Next time you post a demo, please post a much larger window, even for web demo. I like web demos, because they're fast to evaluate, but this is too small for what is essentially a rendering test.
     
  9. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    1) Tree bark bump was MUST. This is something everybody must have. 10x shame on unity team.
    2) Road shader is very nice too, it is very handy with some road generator like easyroads, or free sollution from Sixtimenothing.
    3) I like animating detail meshes too, but this shader is really "hack" and I cant control these meshes by modifying windzone like other vegetation. Anyway I will probably use it, because great games are done by small details.
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks for your replies.

    @xenoargh: of course it would be nice to have much more realistic bending and wind simulation or even some kind of reaction if the player walks through the fern [like discussed here: http://forum.unity3d.com/threads/5785-shader.SetGlobalVector]… so my shader is just a first step and may be somebody else is going to improve it.

    webplayer is updated and has a larger resolution now [1024 x 576px].

    @demonstenes: right now windzones only effect trees, neither grass nor detail meshes. but it should not be too difficult to add a global float which controls the overall bending of all detail meshes:

    vertexlit.shader [line 137]:
    Code (csharp):
    1. float waveAmount = v.texcoord.y * (v.color.a + _Color.a) * _MyGlobalWindVar;
    lars
     
  11. Pixero

    Pixero

    Joined:
    Dec 10, 2009
    Posts:
    130
    I'd like the animated detail shader to work also for non terrain stuff. Like imported plants that I place manually.
    I guess its possible by making a duplicate shader and giving it another name?
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ pixero: the animated detail shader already works with none terrain stuff! just have a look at the demo scene: all ferns casting shadows are placed manually, all ferns just receiving shadows but not casting any are placed using the terrain engine.
    read the docs included to find out more.

    in order to use the shader with your object, just drag the shader onto the object’s material within the project tab (you can't select it in the shader dropdown as the shader is "hidden").

    lars
     
  13. Pixero

    Pixero

    Joined:
    Dec 10, 2009
    Posts:
    130
    Ah, ok. Thanks!
     
  14. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    2lars: Thanks a lot!
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    more than 360 downloads, guys what is going on?
    not interested in getting into discussion?

    feedback is welcome.

    lars
     
  16. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    This looks awesome. I downloaded it, just haven't had time to dig through it yet. Thanks very much for sharing! :)
     
  17. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Looks fantastic. I have no plans on using it, but I know there are many who will.

    I tried out the web player and I just wanted let it be known my GeForce GT240 1GB card lags slightly when moving around at its current speed. I know, the GT240 is an "old outdated" card by today's standard, but I would not have guessed the "simple" scene would stutter on it.
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @makersofgames: although it doesn't look like the scene is not as simple as one might think: 75 visible mesh trees, a very large terrain [4 x 4 km], a pretty high detail resolution to paint grass and ferns rather precisely and real time shadows end up in 600 – 800 draw calls and 650k triangles.
     
  19. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    @larsbertram
    I knew there had to be more going on there. Precisely why I placed simple in quotes in my original post. Thanks for the details on why my machine was having performance issues.
     
    Last edited: Jul 6, 2011
  20. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Well, there is one thing I am missing. Soft vegetation like 2.6 :) Btw, it would be interesting to have some advanced vegetation system with new shaders, everything aniimated, shadows, bump, soft etc...and driven from one menu (or API) to be able to turn on/off various features, set wind...Some nice out-of-box package, this is something i would probably buy.
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @demostenes: that is exactly what i dream about too. meanwhile i will help myself as good as i can… i hoped to get some news on a new terrain system from the ninja camp but unfortunately it is not mentioned even in the lately published roadmap.

    lars
     
  22. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    I never understood, why unity 2.6 had soft vegetation and 3.0 no. I see no reasonable point in lowering quality, especially when HW is stronger and stronger.
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @demostenes: i think it is due to deferred rendering: it does not support any alpha blending by nature. but there are several techniques to get around this which unity will have to implement like msaa/mlaa.
     
  24. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Well, but still there should be option to keep soft grass when using forward rendering. It would be far more felixible, for example deffered for dungeons, forward for scenery.....
     
  25. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Just one thought, would be possible to make that detail mesh shader standalone? So I can use both original (for terrain painting) and this modified (for hand placed meshes)?
     
  26. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Demostenes: in case you don’t want to use the hacked vertexlit shader within the terrain engine but on manually placed game objects you can just rename the shader to whatever you like by editing the first line.

    is:
    Code (csharp):
    1. Shader "Hidden/TerrainEngine/Details/Vertexlit" {
    might be:
    Code (csharp):
    1. Shader "MySuperdupershader" {
    that’s all you have to to.

    lars
     
  27. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    Thanks, I know nothing about shader scripting, so i hadnt idea, that this is so easy :)
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    more than 600 downloads by now, wow!
    any problems, questions or even pictures of what you have done so far with the asset?

    lars
     
  29. ScienceFiction

    ScienceFiction

    Joined:
    May 28, 2008
    Posts:
    393
    This looks really good lars. Don't be surprised that you aren't getting as many responses on the forums as you have on the asset store... in my experience there are far more guests on the forums than there are members, and i highly doubt that everyone using the asset store is on the forums, in fact i wouldn't be surprised if most people on the asset store aren't using the forums.
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    more than 1200 downloads by now.
    any feedback is still appreciated – as it might help me to during the further development of this asset.
    so please don’t hesitate to post your problems, suggestions, results.

    lars
     
  31. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Hey Lars, I have a question...how would I set this up to use on my terrains like my beach setup...will i be able to include normal mapping on my terrain?
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Neptune_Imaging: i don’t get your question, sorry. normal mapping on your terrain just works using the script provided by sixtimesnothing.
    any other normal mapping? may be to the details? no, that is not supported as the terrain engine does not support it. but i am quite sure that i did not get your point. so please specify your question.

    lars
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    watch out for the "advanced foliage shaders v.5" – once the asset store is back again.