Search Unity

ats color map ULTRA shader [RELEASED]

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

  1. Jenkaro

    Jenkaro

    Joined:
    Nov 12, 2014
    Posts:
    5
    Hi Lars, I aim to do the canyon, but the texture of the stones stretches. Will there be implemented triplanar mapping for the 3rd channel splat maps? This would be great for landscapes with dramatic elevation changes and breakages
     
  2. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    Hello, I have 2 questions, if you could help me I would be really happy, yesterday I bought this great tool. Thank you :) But still have some problems, maybe with understanding, or it is something else...

    Mainly this one. How can I manage more layers on multiUV mixing, and why only texture 3 is supported, when almost all textures are tilled with artefacts. http://ctrlv.cz/en/ec69 as you can see that, i would need it on every texture, so how you personally manage it with only this one layer? (fixed I added some code for other textures)


    And the last one, as if I use 2 splatmaps, for what is texture 7 and 8, when decals are from 3 and 4?

    Thank you for your time. I am sorry, I am quite newbie, I read your documentation, but did not found anything related to theese... So thank you for your time.
     
    Last edited: Jul 31, 2015
  3. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi there,
    adding multi uv mixing to all layers would be quite expensive.
    so i limited it to layer 3 which i suggest to place your main rock texture to.
    tiling on lower frequency textures like grass might easily be hidden by:
    - using better textures which got less visual tiling
    - mixing 2 grass textures on your terrain
    - using a high frequency color map

    you lack at least the last one according to your screen shoot.

    textures 7 and 8 are not sampled by the shader but needed by the terrain engine to work correctly.
    the shader will always apply texture 3 and for as decal when the splatmap tells it to draw 7 and 8.

    lars
     
  4. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    Okay thank you Lars, that screenshot is forgotten I had more questions but i found answers myself by testing. But what i found now is that if i build the project I have an issue that all objects are visible through terrain (e.g. on screenshot you can see other tiles of terrain. and some blocks placed on the top of the hill). What I found on unity answers, is this: http://answers.unity3d.com/questions/924520/objects-are-visible-through-terrain.html . It is exactly what happens to me, and they say, that if they change terrain material to legacy, the problem is solved. So... maybe unity 5...

    well also i fight with a lighting. terrain is too bright, I know that mjenny82 asked on you on the same question, but smoothness/gloss seems to only change distribution of reflections. Even if i put gloss/smoothness on 0 it is still so glossy, that it looks really unrealistic. It is like too much based on the angle of sun. I think it should be more stable global lightened regardless on the angle of the view or sun, but dont know what is this function what I am looking for. Just know it is not glossiness or smoothness and others are not so accessible in unity to try out, what fix this problem. Enclosing second screen of the worst overlightened side of the hill. Gloss multiplier is 0.035 and smoothness 0.15 textures has your default values or darker, but as I said even 0 multiplier did not help.

    Thank you for your time.
     

    Attached Files:

  5. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi kusras,
    which rendering path and color space do you use?
    dx11, dx9 or opengl?
     
  6. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    Hi, Well good point.
    I changed render settings from forward to deffered and it seems like solved that problem with visibility through terrain. Btw other settings are dx11, colorspace:gamma.
     
  7. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    hi kusras,
    i did a test on windows/dx11 using forward and gamma and i do NOT get any visibility problems on the terrain…
    may be not all shaders get included in the built?
    but if deferred solves your problem it might be good to use it – especially if there are more lights than just the directional sun.

    lars
     
  8. ConjureScape

    ConjureScape

    Joined:
    Feb 14, 2013
    Posts:
    445
  9. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    more infos, please.
     
  10. ConjureScape

    ConjureScape

    Joined:
    Feb 14, 2013
    Posts:
    445
    If I use the standard Unity terrain shader the grass and gravel textures are drawn according to the splatmap as in this screenshot: http://gyazo.com/b385a65623249892c00fae0bfcfeda3c

    But if I use your shader the gravel is drawn over the entire terrain: http://gyazo.com/bcec38b074408adcd73c90305925de7b

    I did apply the custom splatmap by pressing the "Apply Splat Map(s)" button on your script, but it only applies the first texture of the 4.
     
  11. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    i have never heard ofg this problem before – so i guess you are missing something.
    please follow the instructions step by step.
     
  12. fairchild670

    fairchild670

    Joined:
    Dec 3, 2012
    Posts:
    69
    Hi 3d_Game_Ready - I think I may have run into a similar issue. I noticed that clicking the "Apply Splat Map(s)" button in the editor does not assign the splat map to the terrain's actual material. For instance in my case I've added these 3 maps:



    But after clicking the "Apply Splat Map(s)" button the actual material still does not have a splat map assigned:



    If I manually assign the splat map to the material it seems to fix this issue. Note I've only tried this with 4 textures. In any case after getting this far, I'm not able to manually paint the terrain using Unity's terrain tools.
     
  13. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Hey @larsbertram1 I just imported your asset into Unity 5.1.2f1 and getting these warnings...

    Shader warning in 'ColorMapUltra/MeshTerrain Blend': use of potentially uninitialized variable (finalCol) at line 392 (on d3d11)
    Compiling Fragment program with USE_BLENDMULTIUV USE_STANDARDNORMALBLENDING USE_PARALLAX USE_COLORMAP

    Shader warning in 'ColorMapUltra/MeshTerrain Blend': use of potentially uninitialized variable (nearnormal) use of potentially uninitialized variable (finalCol) at line 392 (on d3d11)
    Compiling Fragment program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF USE_BLENDMULTIUV USE_STANDARDNORMALBLENDING USE_PARALLAX USE_COLORMAP
     
  14. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    @fairchild670, @3d_Game_Ready,

    sorry guys, you were right about the splat map.
    i haven’t checked this with unity > 5.01 and things have changed in unity 5.02.

    to fix this
    - open "CustomTerrainScriptColorMapUltraEditor.cs"
    - find line 1354
    - replace it with:
    const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public;

    note: BindingFlags.NonPublic has to be changed to: BindingFlags.Public

    thanks for pointing this out!

    lars
     
  15. fairchild670

    fairchild670

    Joined:
    Dec 3, 2012
    Posts:
    69
  16. Kusras

    Kusras

    Joined:
    Jul 9, 2015
    Posts:
    134
    Ah sorry, that patch, what you wrote works also on my problem :) but still would be nice if it is feasible to somehow overwrite textures. e.g. using other than first 8 automaticly overlay the splatmaps... or so.
     
  17. joeee19

    joeee19

    Joined:
    Jul 14, 2012
    Posts:
    56
    hi.

    I wanted to buy this for some time very very beautifully.

    However, is this the thing which moves lightly in iOS(METAL API)?
    I'm developing mobile app.
     
  18. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    well, the shader compiles for metal. but i have never tested it on mobile.
    it is a quite heavy shader – may be too heavy for most of the mobile devices out there.
    you would have to try your own, sorry.

    lars
     
  19. joeee19

    joeee19

    Joined:
    Jul 14, 2012
    Posts:
    56
    OK. Thank you for answer.
     
  20. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    hello Lars,

    does atc shader support PBR texture workflow? (takes advantage of roughness/smoothness/metallic/AO maps)?

    best regards!
     
  21. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    the shader reaches the limit of available textures…
    so it supports smoothness and uses a single color value for specular (unreal does this for ALL dielectric materials as far as i know).
    ambient occlusion is not supported.
    lighting is standardspecular.
     
  22. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    so - what do you mean with "smoothness"? (exactly)
    is it the map, that refers to "roughness" aka microsurface in terms of PBR?
    or is it "glossieness", like the map one would use in toolbag2 for example (so an inverted roughness map)

    for specular, ATS does use the "old lighting model specular", so it has nothing to do with PBR specularity?

    please clarify it a bit, because PBR is a not written in stone standard, as you may know - and terms could differ but mean the same thing (or maybe not)!
     
  23. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    yes
    no.
    it uses unity’s built in physically based lighting. but it won’t let you define specular color per pixel – which is not really needed for dielectric materials anyway.
     
  24. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Hi Lars,
    Thanks for a great product!

    We are still on 1.6c since a lot of time has been spent on other aspects of the project. Now we are taking the major plunge to U5 and will then upgrade the ats ultra asset to the latest version.

    However, to suit our realtime terrain generation we added a new class that handles realtime assigning of maps to a new terrain generated at runtime. It and its corresponding editor is based on your editor scripts.

    My question is whether much has changed between 1.6->2.x regarding map and parameter naming? Ie. have you reworked the architecture or is it basically the same with a few additional features and improved performance? I am trying to judge how much time we are looking at to get up to speed.

    Thanks in advance!
     
  25. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    to be honest: i do not remember.
    but as i am a lazy guy i think i did not change that much…
     
  26. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Sounds perfect for our situation. Sometimes less is more. :) Thanks!
     
  27. Poxican

    Poxican

    Joined:
    Oct 17, 2012
    Posts:
    37
    Hi Lars,

    Forgive me for what might be a stupid question.... I've read through the manual and most of the thread and seen people hinting at using your tool on .fbx terrains, but I'm not able to figure out if it's actually possible.

    Essentially, I am using .fbx meshes built in Blender rather than the Unity terrain system. What I'd like to be able to do is paint the vertex color in Blender, import the model, and then use your shaders to apply the appropriate textures and maps. Is that possible?
     
  28. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    you will have to tweak the shader…
    currently it use splat maps to distribute the detail maps onto the terrain.
    and as it supports 6 detial textures and 2 decals you would need 8 vertex colors!
    so i guess you will have to use vertex colors too :)
     
  29. ConjureScape

    ConjureScape

    Joined:
    Feb 14, 2013
    Posts:
    445
    We're getting the same problem as Kusras with objects appearing from beneath the terrain.

    Occasionally when launching the executable, the terrain will not display any shadows (lightmapped or dynamic), and one can actually see meshes through the terrain such as in the images below:
    1.) Tree trunks that are actually below ground and should be hidden:
    https://gyazo.com/297b06c97f7df7578bafeda6a6a82bf5
    2.) A cube of which the majority is beneath the terrain:
    https://gyazo.com/2d703fbd351d3a33f0a22d49b4b842bc
     
  30. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    like kusras: switch to deferred :)
    what are your render settings? and which version of unity do you use?
     
  31. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    Is there a way or a plan to implement (global) horizontal-texturing? Or even tri-planar?
    It would really helpful, when texturing canyon-like landscapes - would be a great benefit :)

    As for the roughness/glossiness/smoothness = from what I get, it has to be stored in the alpha channel of the detail textures only, is this right?

    Is whit= rough and black = smooth?

    kind regards!
     
  32. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    oh - and is there a way to blend in/out the detail textures? I mean, there is a slider to control the blending with the color map distance-wise, which is good. But what, when one needs to control opacity of detial textures? Is there a way, other than editing the textures in a specific way?

    (like maybe make the textures more grey-ish and pale?)

    I´d like to have the detail textures faded more subtile into the global color map...
     
  33. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    currently i do not plan to add triplanar texturing as it is super expensive. and in case you have a canyon or cliff you will most likely add some extra geometry as a hightfield based terrain won’t let you model interesting slopes anyway.
    and as far as you slopes do not get too steep the color map already lets you add "horizontal" texturing.

    smoothness is stored in the alpha channel, yes. 0 = rough, 1 = smooth.

    blending between details and color map: if you want to have it more subtile you will have to make sure that your detail maps do not have high color contrast and are centered around the average color = color of the color map.
     
  34. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    yes, you are right - slopes and caves will be done via detail meshes. but the whole height map is a canyon, so having a way to have "horizontal rock layers" would be much appreciated.

    Triplanar is expensive, right - but having such an option could be awesome.

    for the detail textures, would it also work, when fading them to grey-ish (like when you use detail textures for the Untiy5 standard metallic shader?
     
  35. ConjureScape

    ConjureScape

    Joined:
    Feb 14, 2013
    Posts:
    445
    It looks like we're not getting a performance punishment by switching to deferred. I will keep you posted..
     
  36. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    so 0 = black 1= white?
     
  37. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    screen shoot?

    that would make them look pretty boring.
     
  38. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    yes
     
  39. Elowan

    Elowan

    Joined:
    Aug 14, 2013
    Posts:
    106
    Ok, great !

    One last question: would it be much work to add a tri-planar option for just one detail-texture? (let´s say the one in slot 3)
    could this be done by hand, like adding some formulars to the code? (sorry, I am not a programer, by no means)

    thanks for support!
     
  40. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    it would be quite some work...
     
  41. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Hi,
    Quick question, we have converted our project to U5. Everything runs well including our runtime hooks into ATS. However, the terrain in U5 is not receiving shadows. It was receiving shadows in U4 and other objects in the scene both cast and receive shadows properly - it is only the terrain that is ignoring them.
    Any ideas on where to look, as I assume the v2.5 version supports shadows in U5? Thanks in avdance!
     
  42. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Solved it by adding the pragma instruction that was missing (addshadow). However, why was it missing? Is there a problem with shadows at the moment?
     
  43. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    never heard of any problems with shadows.
    and the shader does not need any addshadow pragma as it has a proper fallback which defines the shadow caster pass.
     
  44. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Ok, well then this is the first report. The shader will not produce shadows unless the pragma "addshadow" is added.
    This is in forward rendering in Unity 5.2.1f1 Pro on OSX. Unless you have suggestions regarding what in the setup might be causing the issue I am pointing the finger squarely at the shader.

    Again, we did have shadows with the exact same setup in 4.6.8 and the 2.0.x version of the shader. Also, I found a mention from a few months ago regarding missing shadows without the pragma instruction.

    Would be very thankful if you would look into this. Thanks!
     
  45. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    just tested it with unity 5.2.0p1, os x, forward: i do not need to change the shader as i just get the shadows.
     
  46. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    And 2.5a is the current version? What should we be looking at that might cause the fallback to fail? I glanced through the shader but cannot see a fallback other than the specified shader fallback to the standard terrain/diffuse shader?

    Edit: BTW, I am assuing the terrainreplacementshadercolormapultra is the correct shader to use? (We do not use your setup script, we simply add the shader to a material that is assigned runtime and we update that material at runtime as well)
     
  47. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    same with unity 5.2.1F1 – so maybe there is something wrong with your "Nature/Terrain/Diffuse" shader?
     
  48. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    There may well be. However, please enlighten me; Do you mean to imply that the shader fallback kicks in for aspects that the shader does not take into account, ie. your shader does not implement shadows but the renderer falls back to diffuse for the shadow "solution"? Sorry for the shader pipeline ignorance. Also sorry if I sounded terse, had some terrible news in the family today.
     
  49. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Yep, that was it. An old OculusVR demo scene left in the project had an improperly named shader that replaced the built in terrain/diffuse shader.
    Many thanks for your quick help!
     
  50. larsbertram1

    larsbertram1

    Joined:
    Oct 7, 2008
    Posts:
    6,900
    the fallback shader jumps in when it comes to casting shadows which is also responsible for writing correct depth which is needed to receive shadows. you do not need a fallback shader in case you use addshadows but that might be a bit more expensive than needed.
    and i am glad that you have solved the problem and hope you will get better news from your family within the next days.