Search Unity

  1. Unity 2017.2 beta is now available for download.
    Dismiss Notice
  2. Unity 2017.1 is now released.
    Dismiss Notice
  3. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  4. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice

ats Colormap terrain shader [RELEASED]

Discussion in 'Assets and Asset Store' started by larsbertram1, Aug 9, 2012.

  1. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    hi there!

    The Shader replaces the built "first pass" terrain shader and gives you the possibility to use a colormap and different normal maps along with the standard detail maps in order to give your terrains a more lively look.

    the shader supports
    * 1 colormap which is used as basemap on far viewing distances and as underlay on close distances
    * 1 terrain normal map covering the whole terrain
    * 1 custom made and imported splat map controlling the the splatting of the detail maps
    * 4 detail maps which are mixed in at shorter distances
    * 4 detail bump maps
    * multi uv mixing

    Released
    just go and get it from the asset store for free: http://u3d.as/content/forst/ats-colormap-terrain-shader/3fr


    watch the demo: http://bit.ly/P8lib6

    $fully_normalmapped.jpg

    $ats_colormap_comparison.jpg

    $ats_colormap_features.jpg


    the shader is super simple to setup and does not need specially tweaked detail textures.


    Donate

    just in case you would like to support further development, go and get one of my tree packages: http://u3d.as/publisher/forst/1Lf ;-)

    lars
     
    Last edited: Aug 16, 2012
    Gozdek and vfxjex like this.
  2. UnlimitedEdition

    UnlimitedEdition

    Joined:
    Feb 27, 2012
    Posts:
    287
    Hi, are the shaders the ones in your signature?
     
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    3,582
    Looks really good. Do you have the workflow from WorldMachine published or documented?
     
    Last edited: Aug 9, 2012
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    no, this shader is a completely new one.

    lars
     
  5. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    I would suggest you Wenda tutorial from polycount.com forums or wenda111 from youtube. You got all covered there in hours of tutorials. It is primary for Cryengine but it works 100% for Unity too.

    Ok i got my test terrain sitting and waiting, now waiting for Asset store to approve this shader.
     
  6. caldrin

    caldrin

    Joined:
    Dec 4, 2011
    Posts:
    127
    Looks nice, i have followed that guys tutorial for a map i was working on in cryengine.. will take a look at this when its up in the store :)
     
  7. Dogcomplex

    Dogcomplex

    Joined:
    Jul 10, 2012
    Posts:
    17
    Not able to view the demo as it just points me to downloading the web player which I've installed but it doesn't recognize that fact.
     
  8. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,578
    Awesome! Just a question, are you selling this or is this free?
     
  9. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    Open it in Mozilla, Chrome has problems with Unitys webplayer.

    He is giving it for free.

    I can confirm that shader works like charm, true next gen terrain look can be achieved with it, but the main point of this shader is to use external app like WorldMachine 2 or Mudbox to create terrain, otherwise you cant grab full potential of normals and color map.
     
  10. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    1,782
    maybe I'm missunderstanding something, but the webplayer link just looks like an overly stretched diffuse texture + directional light.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    it is not: on the far away parts of the terrain it is bumped diffuse, on the closer parts its mixes together 1 base colormap, 4 diffuse detail textures (color corrected on the fly to fit the color map), 4 normal detail textures and 1 normal texture covering the whole terrain.
    you will have to get close to the terrain to notice the detail textures.

    but i have to admit: this has been the first time working with world machine and i guess some more experienced user than me would get much better color maps out of this app. another thing that keeps the demo far behind from what i guess could be achieved is the fact that i used the free edition of world machine which limits the texture resolution to 513x513px.

    lars

    lars
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    as janpec has already mentioned: it will come for free.
     
  13. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    but to make sure that the shader really works for you (and you do not just see the fallback shader) i would like you to paste a screenshot from the webplayer. or compare it to the second screenshoot of this post: it should look like shown on the right side of the image.

    lars
     
  14. sleglik

    sleglik

    Joined:
    Jun 29, 2011
    Posts:
    682
    I really love your work especially terrain shaders but in this web demo I don´t see any details even if I am close...
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    well, it seems to turn out that the original version of the shader does not work correctly under windows.
    so here comes a link to a modified version of the shader:

    http://bit.ly/P8lib6

    thanks, lars
     
    Last edited: Aug 9, 2012
  16. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,669
    This is very nice... I almost moved away from terrains in Unity, because of the issues with sculpting detailed terrain... I am also more interested in the workflow to get these detailed maps in there (I am a VUE user) from ZBrush... for example, I want to model a complete cliff face and be able to use it in Unity
     
  17. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    well – cliffs still are very difficult to model just using a heightfield due to the fact that the textures will be streched extremely at slopes with an angle > 60 degrees. the only way to texture them correctely is to use a triplanar shader on the terrain which is pretty expensive to render…
    but you will find one on the forum e.g. one made be farafar. but i think it does not work on mac.

    if you model your cliff in zbrush just import it as regular game object and place it on you terrain. that is the way everyone does.
    janpec posted a "link" to some tutorials, just have a look at them:

    http://www.youtube.com/user/wenda111287

    lars
     
    Last edited: Aug 9, 2012
  18. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    You could easily use Zbrush or Mudbox to make whole terrain and even make detail maps each of them tiled. Cliffs are different story, you cant or rather should not make cliffs with heightmap terrain, the only solution that could be used is voxel terrain, but in either case modeling cliffs by hand in 3d modeling app or Zbrush gives much better results than voxels or heightmap terrain.
     
  19. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,669
    True... I don;t plan on using Unity Terrain because of the shader quality... the only issue I will have is trying to use grass and setting foliage... I will be creating my terrain using VUE and Zbrush... (Still trying to figure out how to get splatmaps out of VUE
     
  20. caldrin

    caldrin

    Joined:
    Dec 4, 2011
    Posts:
    127
    DId this ever make it onto the asset store ?
     
  21. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    1,782
    ok, that is gorgeous (the one that works on windows)!
     
  22. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    i have submitted it 5 days ago – but i haven’t recieved any answer yet…
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602

    thanks!
     
  24. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
  25. caldrin

    caldrin

    Joined:
    Dec 4, 2011
    Posts:
    127
    awesome will be picking this up tonight and start messing around with it :)
     
  26. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    Did you make that terrain with the terrain model by editor, by script or using a third party tool ?
     
  27. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    He has used World Machine, so its third party tool.
     
  28. Jum

    Jum

    Joined:
    Aug 20, 2011
    Posts:
    63
    its not working on unity4 preorder beta :(
     
  29. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,956
    Shaders need to be re-written to be compatible with Unity 4.
     
  30. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,486
    Is that only for terrain or any other shader too?
     
  31. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,956
    Nearly all shaders. The majority of them should only require small tweaks, though.
     
  32. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Excellent work !
    I have been experimenting with your package.
    It looks as though your package will fit nicely into my environment/terrain design pipeline.
    I have recreated a new terrain, matching normal map and Base map...
    You did a wonderful job creating the "Color map"...
    Any advise on a great way to build a new color map from my new grey-scale height map image/mask?
    And, do you identify anywhere which colors get which tiled textures?
    Thanks for your efforts.
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    thanks.
    but i am sorry not to be able to give any advice on how to create color or splat maps: modeling the demo terrain was the first time i ever worked with world machine. but there should be plenty of tutorials on the internet.
    may be this will help you: http://www.youtube.com/watch?v=p0o3bqoM0Qg

    btw. it would be nice to see your terrain: just post some pictures!

    lars
     
  34. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Lars,
    Thanks for the World Map Tutorial Link...
    That was very informational as now I see how you created your base textures....
    I have never used WM before but I see it can be very useful...
    That tutorial was really long... Whewwwww
    And, I see, it is only the first of eight.... Sigh....
    hahahhah

    Anyways...
    It is a little early for posting pics as this project is just experimental and not yet ready....
    The colors are all messed up and the satellite image is lousy...
    None the less... Here are a few....

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]

    [​IMG]
     
  35. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Hey Lars...
    Two things...

    1.) I bought 4 of your tree packages....
    Those are the best tree models I have come across.... Really nice work!
    I bought the Birches, Maples, Oaks and Scotch (Red) Pines....
    They are perfectly made... Work with "Wind Zones" and have collision...
    Very nice... Thanks.... :)

    2.) Question for you...
    Is it possible to use this terrain shader in a project that has more than one terrain?
    I took a shot at dividing the terrain using "Terrain Edge" and It seems to have worked... somewhat....
    So, I fixed up the textures etc.... but it seems when coming to the point where I "Apply the Spatmap"... that might be an issue...
    Any advise on this???
     
  36. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    hi terrasame,

    1) thanks for the flowers…

    2) not really: right know it does not work with several terrains at all.
    and as i haven’t found any way to get between the rendering of terrain x and terrain x+1 (OnWillRenderObject is not triggered) there is no way to change the global textures like terrain normal map, detail normal maps and color map…
    so the only solution i can think of is:
    - use the same four detail diffuse and normal maps on all terrains (which should not be any problem)
    - share the same colormap and terrain normal map on all terrains (which would mean that you adjust the shader):
    in case you have 4 terrains just create on big color map at max resolution (4096x4096). in the shader’s vertex function you calculate the vertex worldposition and and tweak the uv coordinates according to the worldposition like uv.x= * 0.5 or uv.x= 0.5 + uv.x * 0.5 (same with uv.y of course).
    you should be able to work with 2*2, 4*4, 5*5 or even 8*8 terrains.

    but please note: the colormap shader won’t look good when it falls back to the basemap unless your detail textures fit pretty well with your colormap!

    lars
     
  37. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Ohhhhhhhh Mannnnnnnn
    What a bummer.....
    Your shader rocks.....

    The solution you wrote of looks viable but you are right about the fall back....
    It would be a hack..... :(

    I am working on a couple of projects and one of them has over 200 Unity terrains and over 200 terrain meshes on the perimeter....
    I was thinking that your shader was the answer for texturing that whole thing......
    Dammmmmm.....
    hahahahahhahh
    Oh well.....

    With your permission I will have my Magical code guy look at your code...
    Maybe he can get creative.....
    Otherwise.... please let me know if any other thoughts come to mind....

    It really works great for one terrain anyways....
    Thanks
    And.... I do love the trees.....
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    hi TerraSame1,

    all you have to do is finding a solution to send new textures as globaltextures (or to set a special shader keyword) after one terrain has been rendered and the next one will be rendered.
    but as i have written before: OnWillRenderObject is not triggered at all.
    if you manage to get between the rendering of the different terrains i guess there will be a lot of people interested in your solution.

    good luck,

    lars



    and one more idea:

    in case you really could share 3 detail diffuse and 3 detail bump maps on all terrains – why don’t just pass those as globaltextures? they will just keep the same over all terrains and that is what globaltexture are made for.

    but each terrain usually comes with its own:
    - splatmap (perfect! we will use it)
    - diffuse detail map 1 (we don’t need it as it is passed via globaltexture, so we abuse it for the individual color map)
    - diffuse detail map 2 (we don’t need it as it is passed via globaltexture, so we abuse it for the individual terrain normal map)
    - diffuse detail map 3 (this is a special defuse detail map for each terrain)
    - diffuse detail map 4 (this is a special normal detail map for each terrain)

    this solution will completely corrupt the basemap – but anyway.
    in case you need correct basemap rendering due to performance reasons you can’t use the internal splatmap.
    just make sure it is set to black (may be red – i am not sure right now), then put the colormap to the first texture slot so it will be rendered as basemap.
    you will have to use diffuse detail map 3 or diffuse detail map 4 to store the "real" splatmap for each terrain so you might loose normal mapping on the fourth individual detail texture of each terrain.
     
    Last edited: Aug 30, 2012
  39. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    updated last post: some ideas how to support multiple terrians…
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    hi there,
    i have just tested the support of multiple terrains:
    http://bit.ly/N2TIvc

    right now the demo uses 4 terrains which edges are visible as i haven’t stitched them.
    it is a bit confusing to set up but works pretty well i think.

    lars
     
  41. Jum

    Jum

    Joined:
    Aug 20, 2011
    Posts:
    63
    hey lars its really amazing. Simple and efficient method. Are you going to upgrade the shaders for unity 4.0 ?
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    may be. but first the built in shaders of unity 4 have to be published, then i will need access to unity 4 free (which won’t come before the final release i guess).

    lars
     
  43. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Ok....
    I see you are totally on it.... Cool....
    And... I got your PM.... So... I am back....
    hahahahah

    Hey... so you got multiple terrains working... Sweet....
    And... I re-read the revised post....

    What... is the download demo revised too?
    And how did you split the first terrain? With "Terrain Edge"?
    You see... I now have my terrain ready with your shader and then I bust it up...
    So what then?

    And... I wonder how many times I could bust it up?
    Could I lay the first terrain out as originally detailed in your first demo then bust it into 4 terrains... then bust each of them into 4???

    This is getting a bit confusing for my old... feeble.... simple... mind....
    hahahah
    Thanks Lars....
    Yer da man....

    Hey.... BTW.... have you seen this thread???
    http://forum.unity3d.com/threads/14...-Realistic-Game-Worlds-Lite-Versions-RELEASED
    This guy is looking to make a fortune....
    And it looks pretty good....
     
  44. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602
    hi,

    in order to work with multiple terrains just export (from your terrain modeling software) /import (to unity) one unique heightmap, colormap, terrain normal map and splat map for each terrain. (the latest webplayer just shows my original terrain whose maps i have splitted up in photoshop…).
    it is always a bit confusing how to arrange the terrains properly in unity due to the fact that unity flips the heightmaps vertically but – anyway…

    create the number of terrains you need place them in your scene and start importing the different heightmaps.

    now you need terrain edge or any other tool and a "set terrain neighbor script" to stitch all terrains together.

    next would be to assign just 4 random textures to any terrain, so the apply splatmap script won’t through any errors.
    deactivate all terrains but one, select the appropriate splatmap (which has to be imported as "truecolor and must be read / write enabled) in the project tab and choose the apply splatmap script.
    do so for all terrains.

    now you can assign the colormaps and terrain normals to all terrains. the colormap has to be assigned to slot one (in the terrain inspector), terrain normal goes to slot 2.

    $slots.jpg

    color and terrain normal map are not sensitive to the tiling settings, but you control the tiling of detail texture 1 and 2 by their tiling values.
    the tiling settings of texture 3 (unused at the moment or: the forth detail texture, see below) control detail texture 3 (assigned by script), settings of texture 4 (which might be the normal map of the forth texture, see below) control texture 4.
    make sure that the tiling settings are the same on all terrains.

    take the "CustomMultiTerrainScriptColorMap" script and drag it onto the first terrain. assign all detail and detail normal textures (according to your splatmaps) and set up the average colors for the detail maps.

    hit play!

    right now shader and script only support 3 different detail textures, as i haven’t had a good idea and the time to figure out how to pass a fourth – for each terrain individual – average color value.

    but you can activate the support for four detail textures in the shader by just uncommenting the according lines (90, 96, 120, 121). the fourth detail textures could then be chosen individually for each terrain (yeah, at least a bit more variety!). it would go to texture slot 3 in the terrain inspector. it’s normal map would go to slot number 4.
    well, as far as the avarage color for these textures is concerned: you could pass just a whole array of colors (fitting the different 4th textures) to the shader and let it pick up the right one based on the worldposition in the vertex program (if, else if, else if…).
    or make sure that they share pretty much the same basecolor (hmmm, variety?) and just assign a global forth color in the script.

    get the modified shader and script: http://bit.ly/NBPwnE


    lars

    if anybody has an idea how to optimize the texture distribution or find a way to really keep the fourth texture individual to each terrain next to an appropriate average color value: please let me know!
     
    Last edited: Aug 31, 2012
  45. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    Hey..... That looks damed interesting....
    I have been away from this today. Been working on wrapping up my projects... Marketing crapola....
    Only days away from launching a new 3d web site....

    I will get into looking at that new split terrain system probably tomorrow...

    In the mean time I think you should look at this thread...
    http://forum.unity3d.com/threads/14...-Realistic-Game-Worlds-Lite-Versions-RELEASED
    I found that about the same day I found this thread....

    I just added a post to that thread telling people about this thread....
    And.... I added comments about the 4 tree packs that i bought on the Assets library....
    Thanks Lars...
     
  46. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,751
    I'm not sure if i'm doing something wrong, but i don't seem to get the awesome detail textures when i look at your demo, i just get a simple flat grass texture while your screenshot looks amazing, i'm on windows with a nvidia gt 540M
    [​IMG]
     
  47. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    I managed to get the detail working same as Lars demo....
    I think that maybe you didn't add the normal maps...
    Try opening the demo and look at how Lars added all the texture files...
    Take a print screen shot of his and then open yours and look to see the differences....
    :)
     
  48. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,751
    What i meant is that, it's not working in the web player he published, i didn't add or remove anything, i mean the screenshot is from his own web player
     
  49. TerraSame1

    TerraSame1

    Joined:
    Nov 12, 2010
    Posts:
    138
    He has made changes to his project demo to attempt to add a multiple terrain possibility...
    That may be affecting what you see....
    I will look at this later....
    But I imagine he will look at this too....
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    3,602

    Actually your scrennshoot shws the "awsome" detail texture – at least the detail texture.
    it looks a bit flat and blurry but you are really close to it (may be somewhat around 20cm…).
    also it might be that i haven’t adjusted texture tiling properly in the new demo.

    this is what i get:
    (first picture taken from the webplayer, second taken from editor, cube is standard unity cube)

    $details.jpg

    $details_editor.jpg


    lars