Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

ats color map ULTRA shader [RELEASED]

Discussion in 'Assets and Asset Store' started by larsbertram1, Oct 17, 2012.

  1. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    292
    This is amazing... Sorry if this is already answered, but is it possible to alter the splatmap or colormap in realtime with Unity 4 version of the shader (assuming I modify the shader accordingly)?

    Here are some screenshots of a Crater terrain I made with the free version of the shader for our upcoming game, Recyx:



     
    Last edited: Nov 6, 2012
  2. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    wow, that looks great!

    as far as accessing the color or splat map during runtime: this should already by possible in unity 3.x.
    but accessing the color map might be a little bit easier as it is a regular texture and not part of the terrain asset.

    i guess you want to add destruction the the terrain?
    so have a look here: http://www.youtube.com/watch?v=2W3Vm1_QGf0

    lars
     
  3. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Lars do you have an answer to the shader model 2 question or was it a silly question
     
  4. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi lazygun,
    idon’t remember your question but neither the ultra version nor even the the free version of the color map will ever support sm 2 – they just use too many texture samples.
    ok?

    lars
     
  5. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Looks really cool! Does it take place on Mars?
     
  6. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Certainly compared to Jesta's excellent work this comes short but just as this shader was released i quickly decided to make a little er 'thingy' to see how it looked during a nice mountain drives, its scrappy in parts but i think it shows the colourmap giving really lush shading to distant land so if you can excuse the crappy bits i hope this shows the shader in a nice light

     
  7. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I'm currently Rolling my own DX11 shader, however i couldn't seem to get my own tangent calculation working so i used yours. I would have to change this to go commercial (planning a comercial project, not just a shader but something much larger and DX11 only), do you have any good ressources for shader tangeant generation?
     
  8. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    No problem, looking back i think i was just plain being silly, i do need to think about my terrain needs for mobile things but this is def overkill, yet! Still perfect for the sm3+ stuff, especially with your collaborations with that other fellow on ideas, although it seems ill be buying yet more assets
     
  9. jesta

    jesta

    Joined:
    Jun 19, 2010
    Posts:
    292
    More terrains made with the basic shader:





    Also, I modified the basic shader to be more easily used with Unity4 and to include specular reflection on the detail textures. The reason I'm not using the ultra shader is that it takes too much time combining the normals and preparing the textures for my workflow. So expect some new and improved screens soon!
     
  10. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    nice!
    and it seems that 4 detail textures for that kind of landscape are absolutely enough…

    lars
     
  11. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
    I have purchased the package. How are you painting the vertex color map? How are you determining where you want the textures to go with this map without having the textures in there for painting? Sorry if this is noobish as this is the one step I am missing, hopefully I didn't miss it in the thread. Right now my plan is to take my existing terrain, export it as an .obj and then bring that into Mudbox 2013 and do the sculpting, painting, but missing how you generate that splat map.

    Thanks for your time.

    Gary Haus
     
  12. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi gary,
    welcome to the club.

    let’s get some things clear: with "vertex color map" you mean "color map"?
    usually you create the color map using both your terrain creation tool (like world machine) and photoshop, using the basic color map, some flow maps, the slope masks and whatever else you can get out of your app.
    see: http://www.youtube.com/watch?v=p0o3bqoM0Qg for a good tutorial to create color maps with world machine, mudbox and photoshop.

    with textures you mean the detail textures? their distribution is controlled by the splat maps. you either can create them using unity built in painting tools (painful) or take your color map / slope mask / flow map and create at least the lower splat map (for the first 4 detail maps) in photoshop using rbga for each of the four detail maps. make sure the the sum of rgba always is 1.0 – which is a bit tricky at least for the alpha channel.

    i do not know anything about mubox but i would not do the painting there. in case you really want to paint the distribution of the detail maps just do it inside unity.

    lars
     
  13. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
    Sorry yeah not clear on my part. I actually meant the customs splatmap.psd. It is red green and blue. Looking forward to understanding the setup.

    Thanks.

    Gary
     
  14. Dad

    Dad

    Joined:
    Sep 29, 2010
    Posts:
    10
    Is this too too heavy-weight for mobile? (iPad2 and up).
     
  15. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi gary,

    just like unity’s built in terrain splat maps the custom splat map uses rgba where red defines where the 1st detail textures shows up, green represents the 2nd, blue the 3rd and alpha the fourth.

    let’s say we have dirt, grass, rock and sand

    red – dirt
    you can start with a flat psd just containing 100% red which will flood the whole terrain with the first detail texture (dirt).

    green – grass
    add a new layer which will become the green channel = grass.
    now we need a mask to only fill those parts of the layer where there shall be grass. in case you have a color map you can simply pick up the average green in the color map and make a "color selection". copy this selection / mask to your 2nd layer of the splat map and fill it with 100% green.

    blue – rock
    add a 2nd layer which will hold the blue channel = rock.
    in order to get a proper mask for this layer you can again go to the color map and pick up the average rock color and create a "color selection" or – in case you have created a slope mask within world machine – take this as mask. copy the mask to the 2nd layer and fill it with 100% blue.

    now you have 3 layers each filled with a different color. there are parts where you have all 3 colors on top of each other. but switching to the channel palette you will see that there is no red or green where there is 100% blue which is just fine.
    so photoshops does all the job that has to be done automatically – at least for the 3 color channels.
    unfortunately it does not work the same with our fourth channel which is the alpha channel.

    alpha – sand
    add an alpha channel and copy and paint your sand mask to the alpha channel (white=sand / black= no sand).
    as you have seen before red + green + blue always equals 1.0 but when adding the alpha channel overlaps will not be handled automatically so we will get red + green + blue + alpha = 2.0 at those parts where there is 100% sand which does not fit the needs of any splat map. so we will have to subtract the alpha value from all color channels.
    simply do so by copying the whole alpha channel, and paste it as new layer on top of all other color layers. inverse it and siwtch the layer blending mode to "multiply" so you get 100% black in the color channels where there shall be sand.

    this way you will get a correct splat map.


    lars
     
  16. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    absolutely. it needs shader model 3.

    lars
     
  17. Dad

    Dad

    Joined:
    Sep 29, 2010
    Posts:
    10
    Thanks for the reply.

    Interesting. In my test shader it said I was using too many variables for shader model 2 so I changed it to shader model 3 and it then would compile (and runs fine on iPad 2). But I guess that doesn't mean it has shader model 3.

    Bummer because your terrains look _really_ nice :)

    A good looking mobile-capable terrain shader is very much needed. Can be iPad2 and greater (for my needs). Probably iPhone 4 and later for iPhone apps.

    Just in case you feel like writing another shader package. :)

    peace.
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
  19. Dad

    Dad

    Joined:
    Sep 29, 2010
    Posts:
    10
    I didn't disbelieve your statement, but thanks for the reference. Back to writing my own… :)


    Will likely buy yours as a reference to understand how to hook into the unity terrain engine properly. First pass shader is easy to hook into (in Unity 4), but not sure what else it's using for drawing further away views or how to hook that. My first attempt is ok, but the unity basemap (or something) draws over mine when the camera gets too far from the terrain and looks terrible. I haven't figured out how to override that yet. I guess the Unity terrain engine is generating that based on the splatmap edited in the terrain editor in unity (?).

    I'm thinking that I just need to (somehow) get the terrain engine to use my shader to draw onto the basemap (it seems to make that dynamically).

    Your textures look much nicer than the built in ones so even those might be an improvement.
     
  20. Dad

    Dad

    Joined:
    Sep 29, 2010
    Posts:
    10
    The documentation on your free ATS Terrains supporting Colormaps shader package has some good information.
     
  21. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Hehe that made me laugh:D

    Lars do you believe that it would be possible to add support for 4 maps with mesh blending shader? Also by support of only 1 normal mapped map did you mean that you can still use 4 non-normal mapped maps but only 1 normal mapped, or by general only 1 texture? Oh and also where can we get that mesh blending shader?
     
  22. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    601
    Lars,

    Thanks. I was asking because I do not have/use WM. On a Mac. Bigger issue is I have existing terrain that I cannot really change at this point in the project(as far as generalized shape). I really want to use the shader to enhance the look of what I already have. My plan was to export the terrain mesh(from Unity) bring that into Modo(make sure its all good) then get it into Mudbox for sculpting(normal map generation), AO and hopefully the big color map. I do understand how it works in Unity for painting(its just handled internally so I never see the splatmap)

    I am hoping all of this works. Thanks for your time.

    Gary
     
  23. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Hey fellow, i've been wanting something similar myself, if you make any inroads can you make it known? its not uneasonable to put something on the asset store even
     
  24. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,645
  25. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    bottom line: you pretty much need world machine if you want good splatmaps. You wouldn't need to modify your terrain at all, you would just use the selectors in world machine to make selections like slope, height, convexity, and erosion flows, and then combine them into an RGBA bitmap.

    If you're on a mac, use a virtual machine or bootcamp or something.
     
  26. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    I'm a bit confused by this. Can you distribute a decal over the terrain based on a greyscale distribution map?
     
  27. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Garyhaus you can use l3dt too for splatmaps, its more robust than WM and much easier to operate with, i think also cheaper too. You can also use only Mudbox to create splatmap with vector displacement map, all you have to do is extract vector displacement map and then use color adjustment feature of Mudbox 2013 to saturate into proper colors (by default you will have green and red in vector texture but third color somethimes seems to vary very much).
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi janpec,
    i am currently very busy with my day time job and do not find the time to finish the mesh blending script/shader.
    and personally i think i will not do more than a simple shader supporting just one diffuse/normal terrain detail texture (plus color map and terrain normal of course).
    sorry about that,

    lars
     
  29. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Lars would it be possible to not use color map and instead just use 4 detail textures for mesh-blending shader? If this wouldnt take you a lot of time i would really appretiate this over color map since i have some specific terrain ready for setup.
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi primederektive,

    the distribution of decals (and detail textures) alway is controlled by a simple greyscale map as each channel in the rgba splatmaps stands for one texture and is exactly a simple greyscale distribution map.

    the special thing about snow as decal is not the distribution (i simply painted it using the built in tools) but its blending.
    the regular decals blend with the underlaying terrain textures according to their own heightmap making "higher" parts of a rock textures beeing visible at even very low opacity whereas the "deeper" parts of the texture will only be visible if you set the opacity to nearly 1.0.
    the snow decal doesn’t look up its own heightmap but takes the underlaying terrain textures into account and simply generates some kind of heightmap according to the textures luminance.
    that’s what the 2 pictures show: the left on shows snow accumulating/blending on heigh parts of the underlaying textures (bright), the right one shows snow accumulating on deep parts of the terrain (dark).

    but of course you could use any texture or color input to control even the distribution of decals like looking up the terrain normal map.

    that is more or less what my snow suit does.

    lars
     
  31. Dad

    Dad

    Joined:
    Sep 29, 2010
    Posts:
    10
    Sure thing!
     
  32. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    Finally started working on the sci-fi island I've been meaning to use the colormap shader for:

     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
     
  34. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Very nice PrimeDetective. Especially this little "cliff" where grass ends and lowers to water is very good looking. One thing maybe you should consider changing is sand normal texture, fliping it for 90 degrees would make much more sense, since sand waves would be aligned with beach-water level.
     
  35. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    Yeah, I think I'm just goin to give up on using a dune-y texture, because if I rotate it it'll have the same problem on the east/ west coasts of the island (they currently look right, with the dunes aligned with the shore).
     
  36. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,645
    Isn't it possible to create a shader / script that aligns the sand texture along the coastline? how hard would that be?
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    one could write a shader that rotates the texture according to a special rotation map (greyscale - 8bit).
    the ats color map ultra shader has one free channel that could be used for this but how would you paint or create the rotation map?

    lars
     
  38. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    597
    Shouldn't it be possible to achieve just that with a tri-planar mapping shader? Like that one: http://forum.unity3d.com/threads/11...nius-triplanar-projection-on-built-in-terrain

    Edit: On a second thought, probably not. That rotation map you mentioned should be the way to go.
    Perhaps it could look something like this to determine which section of the terrain should get what rotation:
    $rotationMap.png
    While not exactly following the coastline this could at least reduce the most obvious texture mapping issue.
    Authoring a fully functional coastline rotation map is a tricky business - an automated workflow would require image processing techniques I guess (rendering the terrain plus water from top orthographically, determining water-terrain-intersection, edge detection, analysing where neighbouring edge pixels tend to be... give it to a student at university :D)
    If everything else fails you could still handpaint it in your favorite image editing software.
     
    Last edited: Nov 20, 2012
  39. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,073
    Yeah, I'm just using a different beach detail map lol.
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi marco,

    using a mask like you proposed should be quite simple to implement. but what’s about flipped normal maps?

    lars
     
  41. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Lars i got one quick question regarding detail mesh placement (plants for that matter with your shader) on terrain. No matter what i do when placing my detail mesh objects they all get placed on random rotation, some are facing up and some down. What am i doing wrong, since from 3d package model is exported facing up.
     
  42. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    hi janpec,

    sorry, but the color map ultra shader has nothing to do with detail mesh placement…

    lars
     
  43. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    597
    Yes, haven't thought about this one. They should match the diffuse but should not lose the correct surface normal - else we'd get bumps where there are holes and vice versa.
    Swizzling or inverting the chanel information might do the trick, not sure which one...
     
  44. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Oh yes i know that, sorry if i wasnt clear. I was just asking in this topic since its active instead of your vegetation shader topic. I needed this information for your vegetation shader, do you know whats the problem why are my meshes not facing in correct way on terrain?

    Oh nevermind, seems like i needed to rotate mesh accordingly, its just wierd becouse actually it is rotated Y down in 3ds max graphically (with arrow) but on numerical it says positive rotation (90) so thats why it was all confusion.
     
    Last edited: Nov 21, 2012
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    which vegetation shader do you mean?
    and do you have any screenshoots?
    right away i would say that is has to do something with your meshes. check the pivot position and rotation.

    lars
     
  46. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    857
    i just bought this. any tutorials on how to use it properly? I am a bit stumped, but I am quite intrigued on how this can improve my scenes. let me know. thanx.
     
  47. Helkus

    Helkus

    Joined:
    Dec 20, 2012
    Posts:
    7
    I just bought this and am definitely having some major concerns with it.

    Is it not possible to use the built in unity tools to modify the splats after they have been applied? - If that is the case it needs to be in the product description as I will immediately require a refund. So far no matter what I do I can't use the unity tools to actually modify it, or add paths or anything like that

    I cannot get any of my materials to show up other than what is in slot 4, The documentation seems rushed and doesn't explain that problem very well. The alpha channel I am using is almost entirely black so I shouldn't be seeing anything

    Why do I need to specify a color map from WM (or whatever)? Why can't it use the basemap unity generates as the colormap if one is not specified ? It's funny, when you first load it and it uses the basemap from unity it looks great, but then it bugs out and you can't see your detail maps and eventually are forced to add a color map override and unless you import your materials from unity into something like WM to generate the color map to simply look like what you have in unity it doesn't look very good and is also really counter intuitive


    Very difficult to get started to say the least, not at all intuitive or user friendly, and judging from the lack of responses in this thread for 4 weeks I somehow doubt there will be much follow-up support.
     
  48. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    i am sorry to read this.

    of course you can use the built in tools to modify and paint the splatmaps, so please stay tuned. the documentation describes this process in depth.

    which problem should be covered be the documentation?
    where do you want to show up your materials (textures i guess)?
    on the terrain? --> they do!
    in the terrain inspector? --> they won’t as they have an alpha channel which holds the specular information.
    alpha = 0 makes a texture nearly disappear in the inspector as unity interprets it as fully transparent,

    the whole shader is about using a color map. you can create it with any program you want. you don’t have to use wm at all.
    using unity basemap does not make any sense at all: even if we had access to it (but we don’t) it would not enhance the look of any terrain at all as it is computed from the detail maps…

    sorry if i had missed any question before. but i am not aware of any…
    and i haven’t answered to this thread as there haven’t been any questions i could answer. so there should be a lot of people out there getting along with the shader pretty well…

    as far as the shader is concerned: it is not user friendly and i haven’t claimed it to be. it is pretty complex to setup, but when you have done it once and got the whole idea behind it you might find out that this shader gives you the possibility to really push the look of your terrains.

    lars
     
  49. Helkus

    Helkus

    Joined:
    Dec 20, 2012
    Posts:
    7
    Thanks for the quick reply!

    You're right I should have said textures not materials. and I cannot see them on the Terrain. The only one I can see is whatever texture is in slot 4 I'm not referring to the inspector, I'm talking about on the actual terrain mesh itself I cannot see any detail textures except what is in slot 4, and the alpha channel used in my splatmap is pure black

    Also the popup dialoge for using splatmaps says it must be 'RGBA' but in actuality it requires ARGB?



    When I try and use the terrain painting tools I cannot modify the splatmaps, nothing changes. I looked over the documentation many times, I looked at the example project and my terrain is set up exactly the same, I'm not sure how to progress from here. If you could provide assistance it would be greatly appreciated, Judging from the colormap I did get working with normals the terrain fidelity at a distance is much higher than I even expected, however I really am having issues getting any of the detail textures to work :(
     
    Last edited: Dec 20, 2012
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    5,775
    that sounds rather strange.
    have you hit "play"?
    have you adjusted the col tex 1 - col tex 6 values?


    you are right: the splatmap must be compressed as ARGB 32bit.

    when using the color map shader painting detail textures is not really the way to decorate your terrain: usually the distribution of detail textures is somehow linked to the colormap ( e.g. green ---> grass, brown --> mud, ... ). so i would always suggest to create your base splatmap outside of unity.
    but of course you can use the built in painting tools to change or adjust the splatmap and add decals.
    that works pretty well for me following the way described in the documentation but i have to say that the package contains just a shader and not a complete terrain painting solution.
    when using the built in painting tool you will change the splatmap (standard function of the built in tool) but NOT the colormap.
    so painting bright sand on top of a green part of the colormap will give you green sand. you won’t see the changes from far away but if you look closer you will. can you confirm this?

    but how could you add a path to the terrain then? add it to the colormap first using e.g. photoshop...

    in case you want to add it manually within unity i would suggest the following solution:
    - make sure that the texture you want to use for the path is in slot number 5 or 6.
    - deactivate the "main" terrain
    - switch to the "paint" terrain
    - start painting the path: you should be able to "see" it on the second terrain.
    - when finished, export the second splatmap of the "terrain paint".
    - open the colormap and the exported splatmap in photoshop
    - copy the channel you have painted on to the colormap and use it as a mask to make changes to the colormap like filling it with a proper color.
    - save the colormap

    not very user friendly, i admit.

    lars
     
unityunity