Search Unity

[Coming soon] Advanced terrain shaders – Volume 2

Discussion in 'Assets and Asset Store' started by larsbertram1, Jan 12, 2012.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    $ats_intro.jpg

    this reworked version of the advanced terrain shaders ships with:

    check it out on the asset store:
    http://u3d.as/content/forst/advanced-terrain-shaders-v2/2Bo


    lars
     
    Last edited: Jan 20, 2012
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    just a quick preview on the lighting features supported by the grass and vertexlit shader:

    $basic_comparison.jpg


    due to the fact that the terrain does not cast very accurate shadows you might get some problems on shadowed slopes:

    $light_adoption.jpg


    lars
     
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    and a preview on the enhanced billboard shaders:

    $billboards.jpg
     
  4. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Great ! billboard tree shading with original shader is really bad. Seems to be fixed soon :)
     
  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    first demo is online:

    http://bit.ly/zBHqU8

    it contains all mentioned shaders and shows:
    - "high" detailed meshes placed within the terrain engine with improved bending (compared to the original shader) like reed and flowers
    - better lighting of billboarded trees
    - enhanced tiling of the rock texture on the terrain

    any feedback is very welcome,

    lars
     
    Last edited: Jan 12, 2012
  6. holger53

    holger53

    Joined:
    Mar 15, 2010
    Posts:
    30
    Lars,
    does the new demo show the demo terrain which is included?
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ holger53: yes, it shows the terrain which will be part of the package.
     
  8. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    This is superb, thank you lars.
    I ran the web player...and noticed some "ghosting" or stretching of some of the grass, blowing like crazy. Maybe just my machine though.
     
    Last edited: Jan 12, 2012
  9. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Hi Lars

    great stuff , did you paint the terrain by hand ?

    thanks

    Norby
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @jc_lvngstn: i guess this occurs near the water plane and only in forward rendering mode?
    i don’t know why but this could be the reflection camera not using the modified shader, because this floating around of grass is what you get when you use the standard grass shaders on imported geometry…

    @norby: no – for the basic heightmap i used geocontrol, for basic texturing unity terrain tools. but there is a lot of hand work involved as well ;-)

    lars
     
    Last edited: Jan 12, 2012
  11. holger53

    holger53

    Joined:
    Mar 15, 2010
    Posts:
    30
    lars,

    very interested in your demo terrain.

    You already can mention a price?
     
  12. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Also...any idea how well this would work in deferred rendering mode, or would there be much difference?
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @holger53: it will be free.

    @jc_lvngstn: ...hmmm – you can switch between the two rendering modes: "1" = forward / "2" = deferred
     
  14. ivanzu

    ivanzu

    Joined:
    Nov 25, 2010
    Posts:
    2,065
    Very nice cant wait to use it,really hated old billboard but now it looks good.
     
  15. psyclone

    psyclone

    Joined:
    Nov 17, 2009
    Posts:
    245
    looks great, shadow distance in the demo between forward and deferred seems inconsistent, and I was getting a strange (i think shader based) artifact around the nearest pond to start location with a shadow of the grass flicking across the pond.

    P.S. View using Safari on Max OS Lion
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @psyclone: thanks.
    and as far as the flickering is concerned:

     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    just submitted to the asset store ;-)
     
  18. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Eeek sorry about that, my window wasn't sized large enough, so I missed the text.
     
  19. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    One question....does this package supports custom meshes now for grass / plants? And does that means that any model can be used now for plant?
     
  20. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @janpec: well, custom meshes for grass have always been supported – although they tend to float around for the bending is applied to a whole cluster and not a single "plant" or mesh.
    my grass shader provides individual bending for each mesh. but the amount of bending is controlled by the vertex’ uv y-coordinate.
    so there are certain restrictions for the meshes and how they have to be mapped. pretty easy for simple meshes like the fern or the reed shown in the demo – a bit more complex for a more "detailed" meshes like that of the flowers shown in the demo: not really a top model, as i am not a modeler at all, and with a rather weird uv mapping: everything but efficient – just a proof of concept and my first attempt to model and map some bit more complex geometry fitting the constrains of the shader.

    $flower_uv.png
     
    Last edited: Jan 13, 2012
  21. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,788
    Where is Demostenes
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    Last edited: Jan 20, 2012
  23. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    Well done! Making richer terrains is easier now.

    I liked that you implemented the non-repeating tile method also.
     
  24. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Thanks so much for your contributions, lars. Excellent work!
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @jc_lvngstn: thanks for your kind words. and let me know whether you have any problems using the shaders or suggestions.

    lars
     
  26. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Quick question...the overfill technique you use in photoshop to spread the colors out...is that the actual name of the filter/process, or does it have some other name?
    Unfortunately, I don't have access to photoshop, I need to see if Gimp can do something similar.
     
  27. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @jc_lvngstn: the filter is called solidify B – by flaming pear (a free filter pack for photoshop).

    lars
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    i have just pushed the terrain shaders a bit further, so it now supports better tiling even on textures like grass or sand.

    lars

    $improved_grass_terrainshader.jpg
     
  29. Demostenes

    Demostenes

    Joined:
    Sep 10, 2010
    Posts:
    1,106
    This improved tiling is nice, problem is, when you want to paint regular shape like mozaic, stone road...

    Maybe it would make sense to enable this only for few textures and let rest without uv multisampling or to decide by for example color of alfa channel, if use multisampling, or not.

    Support of bump would help too.

    Anyway I really dont like, that such work wasnt done by UT, to not support bumped maps on terrain in 2011 is ridiculous and modification of terrain shaders is problematic. Btw, default terrain shaders are slow, again piece of really nice work.
     
    Last edited: Jan 25, 2012
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Demostenes:

    * bump mapping is fully supported.

    * you can enable / disable multi uv-mixing on any texture just by editing the shader which should be very easy to anybody.

    using the alpha channel would not be a good idea i think because it would increase the need on texture memory. bur instead of just using it for telling the shader yes or no it could contain a low frequency disturbance texture which would be mixed with the original rgb texture.

    * thanks for your commendation. and you are absolutely right: UT should have paid much more attention to the terrain engine in the past*– especially as i think that it is pretty easy to improve. may be we can wake them up.

    lars
     
  31. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    Hey this looks great, i attempted to import this and use the bump shader and i followed the read me file but i dont get bump mapping in either your scene or my own i created from scratch =/
     
  32. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @Efraser2007: you have to assign the script to the terrain, put the normal maps to the texture slots, set the tiling and the terrain size.
    then hit "play".
    it won’t work unless you hit play, for only in playmode bumpmaps are send to the shader. after having hit play once it also works in the editor.

    lars
     
  33. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,467
    Sweet man... I hope this one works a bit better... :) I had a few problems with the last one...

    EDIT: how do I actually use the grass shader?
     
  34. Legacy

    Legacy

    Joined:
    Oct 11, 2011
    Posts:
    651
    yep got it to work i was not aware that the normal maps only worked during play mode in the editor works now thanks :)
     
  35. hike1

    hike1

    Joined:
    Sep 6, 2009
    Posts:
    401
    The app store ought to tell you it's downloading to C:\users\username\AppData..it goes on, had to search my computer for it and then
    rename it. Anyhoo, it's very nice, but I can't get the 1st person controller I added to work, the game view doesn't move, how do I move
    around?
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    what did not work using ats v1 shader?
    it will be used automatically for it overwrites the original shader.
    for further information just resd the readme file:

    2. usage
    --------------------------------------------

    - import the package
    - save, quit an restart unity in order to get the hacked shader working

    2.1. terrain engine --> Grasstexture

    - add any detail texture or an single sided model to your terrain using "Add Grass Texture" or "Add Detail mesh"
    - uncheck the checkbox "Billboard"
    - start painting some plants
    - hit play so you can see the bending
    - still in playmode open the "Edit Detail Texture" dialogue and tweak the values of dry and healthy color:
    --> alpha: overall Factor to adjust the bending

    2.2. terrain engine --> Detail Mesh

    - add a single sided model to your terrain using "Add Detail mesh"
    - set render mode to "Grass"
    - start painting some plants
    - hit play so you can see the bending
    - still in playmode open the "Edit Detail Mesh" dialogue and tweak the values of dry and healthy color:
    --> alpha: overall Factor to adjust the bending

    ___________________________________________
    IMPORTANT
    unity automatically bakes the textures of all details like grass, fern and bushes to one big texture atlas. as the bending depends on the y-position within the uv map, the y-position of each detail changes when adding are removing one. this will effect your adjustments.
    either you will have to readjust your settings or you first add all details you want to use then adjust the bending.
    ___________________________________________

    3. needs
    --------------------------------------------

    - single sided models
    - uv mapping: bending depends on the y-position within the uv map. so make sure that your uv-mapping and textures always are upright as vertices at the bottom wont’t bend at all whereas vertices at the upper part of the texture / uv map will be fully effected by bending.
    - export webplayer / standalone: make sure that the shader is assigned to any game object in your scene – not only to detail meshes placed within the terrain engine but also to any manually placed mesh. otherwise it will not be exported and the webplayer/standalone will fall back to the built in vertexLit shader.
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    sorry, but the first person controller is not my part of the job… usually it just should work out of the box.
     
  38. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Larsbertram thanks for answering before, i am still a bit confused. Could you just please confirm if bushes (different shapes) and simple plane (few triangles) grass models are supported? Could you please provide some example or do some test model, as i would really like to make sure before purchase.

    For grass model i mean something like this:

     
  39. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I have an updated version of the terrain shader that I would like to get someone to test before posting. This version supports mixing by texture (you can determine the percentage (0.0 - 1.0) that each slot uses to mix in the scaled texture. In addition, it supports specular highlights and I've added an overall "specular scale" so you can tune them down if you don't want to mess with the alpha channels. You can also adjust the overall scaling used for mixing.

    Using this, for example, you could turn off mixed-scaling for paving stones, while having grass, stone and sand mixed.

    These changes reflect the changes in the version I did for substance-based terrains, which I have not posted yet. (waiting on permission).
     
  40. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
  41. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ janpec: your models look almost perfect to me, so they should work. and do not worry: the advanced terrain shaders are for free. so just get them and test it yourself.

    @ jaimi: just post the shader – or its core lines ;-) because it might be really helpfull! great stuff! so watch out for it.

    @ duke: i will have a look into that – but is it still needed? billboard shading gets much improved using the package and to me billboards now look pretty good. do you have any other experiences? just let me know.
     
    Last edited: Jan 28, 2012
  42. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    OK - Here it is, hope someone finds it useful.

    Modified Terrain shaders
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    @ Jaimi: i am sure there will be a lot of people finding it useful…
     
  44. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    Just a question: are you able to prepare demo where is used more than 4 normal maps for terrain textures?
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    it is easily possible but quite expensive as the whole terrain would have to be rendered twice… therefore i am not going to do so, sorry.
     
  46. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    I understand. 4 textures per terrain is recommended.

    Thank you for your response
     
  47. pinkhair

    pinkhair

    Joined:
    Dec 17, 2010
    Posts:
    141
    Could you use the second uv set for the model for the bending?
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    my latest package (advanced foliage shader) uses vertex colors to control bending – so there are no more restrictions as far as the uv mapping is concerned:
    http://forum.unity3d.com/threads/133398-Advanced-foliage-shader-released

    but of course you can also use a second uv set.

    lars
     
  49. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Just wanted to say I love this package. I'm using it in my game right now.
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,902
    thanks a lot!
    i would just like to see some pics… so do not hesitate to post some.

    lars