Search Unity

CTS - Complete Terrain Shader - Deprecated

Discussion in 'Assets and Asset Store' started by AdamGoodrich, Jun 19, 2017.

  1. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    yea thats what I said. ignore collision for tag player
     
  2. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Not sure why this is so hard to find - its clearly labelled.

    2018-03-28_21-21-28.jpg

    You apply the color map to the terrain object itself. You can even bake your own from the terrain itself, and use the color of the grass to influence the color of the color map that is generated - so that there is less of a jarring visual break when your detail distance is exceeded.

    2018-03-28_21-22-31.jpg

    And you control its power in the profile. You wont see the transparency value as that's a rather cool feature in the next release. It will allow you to mask where the color map is drawn on your terrain.
     
    Mark_01 likes this.
  3. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Consider exporting your terrain as a mesh (Gaia has this feature, and there are open source scripts that do it), then cut the way you want in your favourite mesh editor, add a mesh collider to it and turn off the renderer.

    You could probably do something with this combination of methods to sort your issue out. This is how I saw it demonstrated by an AAA studio that was showing me their work.
     
    AndersMalmgren and mattis89 like this.
  4. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    thats the right way to do it. I have used CTS to make a whole and then use some script to go in and out. In my next game I might consider a terrain mesh but its a few downsides and my player falls thrue mesh terrain (dont know why) and also if I want to have a big open world a mesh terrain is not the answers.
     
  5. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I wonder what's the performance impact of a terrain collider vs Mesh collider is.
    I think my level designer will design the map in a way that mesh rocks can be used above instead so we dont need to solve this with terrain at all. But its nice to have a viable solution for the future :D
     
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Are you doing a capsule or sphere cast to ground the player? We do this and what happens with mesh colliers is this,
    Green is mesh collider, red is sphere radius

    upload_2018-3-28_12-56-57.png
    The player clips the mesh colider for one frame, you do the sphere cast and it will be shot from inside the mesh collider, this will count as the mesh will not be included in cast at all and the ray will miss mesh collider all together. We fixed it by casting a extra RayCast from center of player if we detected a decent from the first cast.
     
  7. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Using a sphere. Okaay I see :) Thanks!
     
  8. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    After long break could go back to CTS, VS etc. :)

    The terrain inside the WC2





    Unity






    Textures







     
    Last edited: Mar 29, 2018
    eaque, Gametyme and AdamGoodrich like this.
  9. fairchild670

    fairchild670

    Joined:
    Dec 3, 2012
    Posts:
    69
    Hello there! I recently purchased CTS and was curious if it's possible to pull off texture blending similar to these two screenshots:




    I've gotten closer with CTS (I think) but it still doesn't look quite right:




    Any tips on how to get the blending to look more natural? Btw the top two screenshots were with RTS which is awesome in its own right, but we decided to abandon due to technical issues. Loving CTS so far and those previous screenshots look amazing!

    Any help would be greatly appreciated!

    Larry
     
  10. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Are you using the advanced version of the shader?

    You can tweak height blending settings quite a bit there.

    Note: Texture order is important - bigger structures should be in later layers, smaller structures in earlier layers.

    Also explore the per texture settings as these influence how the blending is done.

    2018-03-31_9-40-10.jpg
     
    Last edited: Mar 30, 2018
    fairchild670 and Mark_01 like this.
  11. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Another try, well not the best from me, but still :)

    There is no performance in this scene since i cranked up the foliage and shadow range to ridicuolous values, just for the screenshots, but as i do not work on any game atm and just stick to the hobby, i dont give a damn about performance :)

    The terrain was made in World Creator 2 as usual, CTS, Vegetation Studio, Enviro, Mountain/Foliage pack and realistic grass pack from NatureManufacture and my single tree i did in speedtree :). Couldn't find proper textures for the rocks formations so i am not 100% happy with it :)







     
    eaque, Mark_01, AdamGoodrich and 3 others like this.
  12. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Hey everyone, the new CTS release is live.

    New features include:
    * New lite shader, strips features in return for speed
    * New snow glitter module
    * New colour map masking options
    * Temporary removal of Substance support in U2018.x and above (and related compile time fixes)
    * Ability to disconnect profiles and reduce memory overhead
    * De registering cts on destroy to remove memory references
    * Various amplify and cts bug fixes
    * Renamed cts shaders for neatness
    * Improved WebGL support
    * Much faster shader updates
     
  13. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    As ever. Please backup your project before installing!

    I will do a bunch of tutorials over the next few days.
     
  14. ForgedChaos

    ForgedChaos

    Joined:
    Jan 31, 2014
    Posts:
    49
    Were you able to get the paintable terrain cutout in this iteration?
     
  15. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Another day another fun.

    Today planned to learn more about SapUi5, but heck it, terrains are more addictive :)

    WC2, CTS, VS, Mountain / Advanced foliage / Realistic Folaige by NatureManufacture, Realistic environment by Piotr Zatylny and ofc Enviro :)



















     
  16. seanybaby2

    seanybaby2

    Joined:
    May 17, 2013
    Posts:
    120
    #Bump for this question. I'm doing the same exact thing atm but having trouble getting it to work with CTS. I'm assuming CTS does some sort of confusion and uses there own splatmap. Not sure how to look that up and use it with c#. thanks!
     
  17. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    CTS strips textures / splats from terrains by default in order to enable true single pass terrain rendering - and this delivers a substantial reduction in drawcalls.

    We don't have a routine for this in CTS, but if you disable strip textures under Optimization Settings in your profile, then the terrain will render as normal, and any code you used in past will work as normal.

    No.
     
  18. ForgedChaos

    ForgedChaos

    Joined:
    Jan 31, 2014
    Posts:
    49
    Lovely. Ok, so any plans to implement it like you mentioned months ago, have you changed directions, do you not ever plan to support the feature or ...? Setting proper expectations can go a long way.
     
  19. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    I do not recall promising this as a feature although I do remember it being discussed some time ago. Bart and I discussed it at the time and decided we were not prepared to lose a texture slot in order to support it. If this fell through the cracks then my apologies.

    The other way of doing this is to create a painting system, and while that would certainly be convenient it's also a fair bit of work for something that could also be done with your favorite image editor, and so we put the effort into adding new features that cant be done in another way e.g. snow glitter etc.

    One thing to note : we changed the way color maps and cutouts worked in this release. We separated the two textures to be completely independent of each other, and in both cases the alpha channel is now used to control their respective transparency. This should make it much easier for you to use your favorite tool to change it.

    Bart has a cool painting tool in some of his other products that we have talked about bringing to CTS when we add mesh blending. The ball is currently in his court and if we decide to do this then adding the feature you want would be much easier.

    In the mean time we hope you enjoy the free update to CTS. Quite a bit of work went into it.
     
    Last edited: Apr 6, 2018
  20. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    He dosent need to do it. Its really easy to make it yourself. I have made a black splatmap cutout so wherever Inpaint with it i get ”holes”
     
    Mark_01 and AdamGoodrich like this.
  21. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Thanks a lot for the long awaited update Bart and Adam!
    The Weather Controller gives me an error when compiling:

    Assets/CTS/Scripts/CTSWeatherController.cs(2,19): error CS0234: The type or namespace name `Apple' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?

    Really hoping to see following Features in the next version:
    • POM Feature
    • Rain Droplet / Puddles effect
    • Material Drag and Drop Support now that substance is obsolete

    Cheers
    Ronny
     
    Last edited: Apr 6, 2018
  22. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Hey,

    Did you enable the snow/glitter in one of the demo? (I didn’t see it)
     
  23. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Thanks for the weather manager heads up - my dev environment has a nasty habit of adding irrelevant references sometimes, and maybe it slipped this one in. I will check it.

    @NatureManufacture and I discussed POM recently - he can comment on adding it as in some scenarios i think it definitely adds value. He will need to comment on rain as well - both of these features require shader support.

    Not really sure what you mean by material drag and drop support?

    I have not updated the demo's yet. Am busy updating and expanding on all of the tutorials as the product has evolved a lot since it was first launched. Demos will come soon.
     
    RonnyDance, blitzvb and Mark_01 like this.
  24. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    I can even help you edit the shader.. show you what to change
     
  25. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151

    • Modified cutout masking now moved to a separate texture - what does it mean?
     
  26. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    In last release terrain cutout mask was baked into alpha of color map. Now its not. Put your mask into the alpha channel of the cutout mask texture.
     
    mattis89 likes this.
  27. RonnyDance

    RonnyDance

    Joined:
    Aug 17, 2015
    Posts:
    557
    Yeah I already PMed him some time ago. He was thinking about the best aprouch for it :)


    I posted this idea some time ago and Bart found it interesting, you thought that it will add to much overhead or a feature which will destroy the easyness and usability of CTS. But here again the main idea:
    It would be more than great to just being able to import a material to the texture slots (not only a substance). So CTS can get all necessary Textures with the right values (Smoothness value, Metallic Alpha or Specular Alpha etc) immediately. This saves a lot of time and you can get the right results like the author defined when creating and offering this materials instead of adding always 3-4 textures for every material to CTS and getting values right. Lot of Texture / Surface Packs come with materials included. Lot of users use materials instead of Substance because they are offered much more in the Asset Store (See Barts Packs for example) and are cheaper.

    Thanks for the fast response Adam. Hope you can fix the "Apple" problem ;)
    Cheers
    Ronny
     
    Mark_01 and mattis89 like this.
  28. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Delete the following two lines (line 2 & 3) - that should sort the issue out:

    using UnityEngine.Apple.ReplayKit;
    using UnityEngine.VR;

    Unity just decided to give weird licence error, so I cant test.
     
  29. EHG_Unity

    EHG_Unity

    Joined:
    May 21, 2017
    Posts:
    20
    For some reason this asset has tremendously slowed down the branch it exists on inside of our Git repo. Does anyone have any ideas why this asset causes this to happen? When we branch off right before it it goes back to normal speed for pulling, pushing, staging, committing, etc.
     
  30. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Can not imagine how CTS could slow git down... once its committed then its done.

    Only potential caveat is that by default CTS will update the material on the terrain when the scene loads. We had to do this to get around a weird Unity bug that can cause Unity to crash.

    To get around that - just dont sync the terrain object when you update your scene.
     
  31. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    I actually like this idea. Theres alot of material editors too that make a material look super real :)
     
  32. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    We had a customer report a critical issue with CTS today, which could cause Unity to crash.

    The issue is Unity i believe, and it was a workaround that I removed in the latest release. When I put it back in again, all was good again.

    We will push an update to CTS in the next few days which will solve the issue. In mean time - if you are getting Unity crashes then please contact me directly.

    For the coders who need it now, replace the Awake() function in CompleteTerrainShader.cs with the following code:

    Code (CSharp):
    1.         /// <summary>
    2.         /// Called when scene loads
    3.         /// </summary>
    4.         void Awake()
    5.         {
    6.             //Make sure the ID's are initialized
    7.             if (!m_IDsInitialized)
    8.             {
    9.                 InitializeIDs();
    10.             }
    11.  
    12.             if (m_terrain == null)
    13.             {
    14.                 m_terrain = transform.GetComponent<Terrain>();
    15.                 if (m_terrain == null)
    16.                 {
    17.                     Debug.LogWarning("CTS needs a terrain, exiting!");
    18.                     return;
    19.                 }
    20.             }
    21.  
    22.             //Work around for a nasty unity bug
    23.             if (m_profile != null)
    24.             {
    25.                 m_terrain.materialType = Terrain.MaterialType.BuiltInStandard;
    26.                 m_terrain.materialTemplate = null;
    27.                 m_material = null;
    28.                 m_terrain.Flush();
    29.             }
    30.         }
    31.  
     
    daisySa, Mark_01 and mattis89 like this.
  33. hooraypublic

    hooraypublic

    Joined:
    Feb 8, 2014
    Posts:
    13
    Been having unity crashing on startup in the past two days and narrowed it down to CTS, so I'm glad to see this posted and worked. Thanks!
     
  34. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Glad I put the fix straight up then!
     
  35. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    589
    Another day another play :D

    This time i used Fantasy Environment...You will notce which one is it :D

    WC2 + CTS + VS + Enviro + Advanced Folaige Shader for foliage shaders since the pack shaders does not work properly :)

    Textures Alone



    Full glory :)

     
    Game-Armada and Quique-Martinez like this.
  36. Game-Armada

    Game-Armada

    Joined:
    Apr 29, 2013
    Posts:
    66
    Nice pictures, but I'd like to see something photoreal with CTS and/or other assets...
     
  37. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Then go create something ;)

    Grab 20171011185101 w1920h1029 x-47y65z-134r333.jpg

    Grab 20180307145847 w1920h1029 x619y67z815r86.jpg

    Grab 20180315132051 w1920h1029 x-21y48z1184r184.jpg

    Grab 20170619081234 w1920h1029 x-272y111z242r299.jpg

    These are environments I have created and rendered in CTS.

    Tutorials for the latest version of CTS are now well advanced and will start coming online in the next day.
     
  38. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    And for those wondering about how to do cutout's - here is a pre-release snippet of one of the new tutorials:

     
  39. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    perfect thank you! This made my day!
     
    AdamGoodrich likes this.
  40. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Here is an introduction to the latest CTS v 1.6:

     
  41. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    how do I create the cutout mask (texture)?
     
  42. Game-Armada

    Game-Armada

    Joined:
    Apr 29, 2013
    Posts:
    66
    Hey,

    I have just downloaded the new version of CTS.
    Questions:
    - is there a way to tweak the shader to utilize the roughness linear maps similar to other PBR packages?
    (right now I have to add brightness and contrast to the roughness map to achieve roughness, while usually 220 gray value should do the trick)
    - on the first image, on the left is the CTS terrain shader, and on the right is the quixesl shader. From this view the CTS looks okay to me (a bit brighter then it should be, but okay)
    Roughness map modified to 255 white, to make the sand look really rough, without any specular effect.
    - on the second image we are looking in the opposite direction, the quixel shader still looks fine, but CTS looks strange with very dark areas..
    - on the third image there are strange artifacts if I look close!
    - on the last, the profile settings

    Please help to solve these issues!
    (Unity 2017.3.1f1, linear, deferred)

    upload_2018-4-11_14-34-23.png
    upload_2018-4-11_14-35-6.png
    upload_2018-4-11_14-36-3.png
    upload_2018-4-11_14-38-43.png
     
  43. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    AdamGoodrich and Mark_01 like this.
  44. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    Hi I just bought CTS and the demos look fantastic with above 60fps. The settings are really easy to learn and well documented, but I have some questions about how it should be used in a final build.
    Firstly if we just want a static terrain can we remove the CTS component from the terrain and delete the profiles while keeping the arrays?
    Secondly if we want to change the CTS profile on a terrain can we do this in runtime?
    And thirdly what files are necessary for the final build I guess editor scripts, demo and performance prefabs can be deleted?
     
  45. seanybaby2

    seanybaby2

    Joined:
    May 17, 2013
    Posts:
    120
    Okay gotcha thanks. Yeah I need the draw call performance benefits so this isn't an option. I'm sure there is a way to reference the CTS textures instead of the terrain textures and get an available texture from that instead. I'll dig into the code base a bit and see if I can figure it out.
     
    Mark_01 likes this.
  46. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Interesting questions :)

    Firstly if we just want a static terrain can we remove the CTS component from the terrain and delete the profiles while keeping the arrays?

    Just physically disconnect the profile from the script on the terrain itself - Unity wont copy it to the final build.

    Secondly if we want to change the CTS profile on a terrain can we do this in runtime?

    Sort of polar opposite of above - but yes - you can look at our demo controllers to see how to do this.

    And thirdly what files are necessary for the final build I guess editor scripts, demo and performance prefabs can be deleted?

    Unity will inherently exclude unused assets from the build, and the code itself would be so small as to be irrelevant.
     
  47. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    The underpinning is just a standard splat map. We make an in-memory copy of it when strip textures is set, and we pass that copy to the terrain.

    A splatmap is just an uncompressed RGBA texture, so you could translate your location and do GetPixels on it to get the relative texture strengths at that location.

    One little caveat to consider is that internally Unity flips x & z when it comes to terrain, so bear that in mind.
     
    Mark_01 likes this.
  48. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,026
    https://gyazo.com/2b73c3fc87eca99b015555d490dadc32 are you sure that normal have "is normal" in engine import settings? This could broke smoothness/roughness, specular and all reflections. This small icon should be blue.
     
    Mark_01 likes this.
  49. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,783
    Mark_01 likes this.
  50. Game-Armada

    Game-Armada

    Joined:
    Apr 29, 2013
    Posts:
    66
    upload_2018-4-12_14-37-59.png