Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

CTS - Complete Terrain Shader - Deprecated

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

  1. tork12

    tork12

    Joined:
    Dec 16, 2017
    Posts:
    42
  2. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634

    no it does ONLY the Streaming.... The splitting, is NOT World Streamer.... Its another tool, he suggests in his documents and its FREE.... Not part of World Streamer.
     
  3. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    ya, I had to again, think he was still confused hehe. no worries though, it happens.
     
    Mark_01 likes this.
  4. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    606
    This is free not part of World Streamer, sorry if I confused you..
    this is the link for the free terrain chopping, course if you have huge worlds then yes some type of
    streaming too .. but this is free http://kostiantyn-dvornik.blogspot.de/2013/12/unity-split-terrain-script.html
     
  5. tork12

    tork12

    Joined:
    Dec 16, 2017
    Posts:
    42
    Watched the video just now, all is understood thanks!
     
  6. tork12

    tork12

    Joined:
    Dec 16, 2017
    Posts:
    42
    Watched the video so I understand now, thanks for the links and hand-holding lol... kind of new at this.
     
    Mark_01 likes this.
  7. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    606
    we were all new at a time, me still new i'd say. Glad all is okay and you found everything :)
     
  8. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    735
    can someone explain a step by step process to put cts on a mesh??
    thx
     
  9. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    606
    Wish I could be of more help, I did a search for mesh blending in this forum .. I know this is not the same as CTS on a mesh but I found these two posts here ..

    https://forum.unity.com/threads/cts-complete-terrain-shader.477615/page-17#post-3170100

    https://forum.unity.com/threads/cts-complete-terrain-shader.477615/page-17#post-3170367

    Adam and Bart are knee deep in a new asset or two they are releasing, plus finishing upgrades to
    R.A.M and the next version of CTS coming very soon I think.

    Unless some others can answer you, I'd suggest just go here and put in a support question ..
    For support go to https://proceduralworlds.freshdesk.com/support/home
     
    eaque likes this.
  10. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    735
    Many thanks @Mark_01 :) i thought it would be quite easy but i didn't success so i thought it would have been done by many users...seems it's not the case. I will go on Procedural forums

    i didn't know they were close to some new releases! can't wait to see that!

    thanks again;) i really appreciate !
     
    Mark_01 likes this.
  11. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    735
    Finally i found out! Most of you might already know but if ever someone is lost like me:

    "Optimisation settings" check the box "persist material" it will write a material for each terrain using CTS
    you will find all this in CTS file "Terrain" BEcause of the Caution i didn't want to try...Don't forget to uncheck the box after
    upload_2018-3-3_22-27-10.png
     
  12. ramos123

    ramos123

    Joined:
    May 29, 2013
    Posts:
    7
    Hello everyone, I love this tool I am looking forward to the update that Mesh combiner will bring, will you have any approximate date?

    Thanks for this great tool.
     
  13. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Helloo! Where did I read about someone that have the issue that when you use tess it becomes black spots like ex in the mountains where the tess blend is made.. ? and it flickers like black when you move the scene camera around?
     
  14. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,777
    Tess should be used sparingly like normals. From memory you need to adjust the bias on your camera to get rid of the black shadow spots.
     
    mattis89 likes this.
  15. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    hi guys
    i have CTS 1.1.0 and i'm using unity 2017.1.1f1. i'm also using gaia and tenkoku.
    at first, cts works perfectly, but now when i try to modify any settings on cts or just modifying the profile settings or weather controller, unity crashes. here are the logs.
    can someone help?
     

    Attached Files:

  16. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hi im using cts for multiple terrains being streamed using world streamer, but it adds a cts manager to each scene and when playing i get 0 fps its trying to destroy the managers
    How can I set this up? Thanx
     
  17. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    I use cts & world streamer as well. I only have 1 CTS manager in my "main" scene that also contains the streamer Game Objects from world streamer. The terrain scenes that are loaded in do not contain any additional mangers, they only have the "Complete Terrain Shader" component attached on the terrain.

    How do you prepare your terrain for streaming, or at which point do you currently add CTS to the streaming terrains? If you use a script to split a larger terrain into the smaller streaming terrains, it should work if you add CTS to the streaming terrains BEFORE you do the scene generation with the world streamer scene splitter. In this way the smaller terrains in the streaming scenes should all only have the CTS component with the correct profile, The cts manager object should be left out then and should not be part of each streaming scene.
     
    llJIMBOBll and AdamGoodrich like this.
  18. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,777
    Upgrade to the latest CTS. There is some weird bug in unity terrain that forces us to re-create the material at run time otherwise you get these random crashes. The crashes never gave a reason that I could understand, and I spent a lot of time reworking the startup process to get around it.
     
    Mark_01 likes this.
  19. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    Hey sorry, what was happening was world streamer deloaded terrains and it came up with a red error to say it cant delete as the manager is using it. I fixed this by increasing deloading range so they are always shown, but this pretty much defeats the object lol so now im just gonna use 1 terrain as my scenes will be small / medium

    :D Jim
     
  20. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,777
    Hmmm... the culprit is CTSTerrainManager.

    This is a singleton object that maintains a list of terrains so that it can efficiently route messages to all of them at once and it never occurred to me that they would ever get deleted.

    Here is a new method for you to call before the terrain is deleted... please note i am typing this into this web page so there may be bugs:

    public void RemoveTerrain(Terrain terrain)
    {
    CompleteTerrainShader cts = terrain.gameObject.GetComponent<CompleteTerrainShader>();
    if (cts != null)
    {
    m_shaderList.Remove(cts);
    }
    }


    You would call this something like:

    CTSTerrainManager.Instance.RemoveTerrain(yourTerrain);

    I don't know how world streamer works, so i have no idea what you would need to do to get this called. @NatureManufacture could offer some insights.
     
    BrokenVector and llJIMBOBll like this.
  21. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    Thrre is nothing special behind this. We remove scene, call unload scene and from time to time we call gc to clean memory. If you have list this could be problem.
     
  22. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,777
    Yes we have list. Not possible to change this without a complete re-write of the CTS messaging system.

    I actually made a far better messaging system for WAPI... I will consider implementing it in next CTS release.
     
    llJIMBOBll likes this.
  23. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    Maybe cts manager per scene and terrain?
     
    llJIMBOBll likes this.
  24. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,218
    Did you ever find out what this is? I am having issue with it as well but I don't know where it's from.
     
  25. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    How big your terrains are?
     
  26. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    only 8x8 km
     
  27. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    nope not at all. but yesterday I didnt suffer so much from it.. and my game works smooth in build
     
  28. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    Resolution? (heightmap)
     
  29. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    aaa hmm... I used the power of 2
     
  30. Game-Armada

    Game-Armada

    Joined:
    Apr 29, 2013
    Posts:
    66
    a quick test

     
  31. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,218
    Mine are 512x512, 256 resolution.
     
  32. emrys90

    emrys90

    Joined:
    Oct 14, 2013
    Posts:
    752
    How would I go about looking up what texture name is being used on a terrain at a particular world point? Here's the code I'm currently using which worked well with the normal Unity terrain, but with this asset its telling me a dirt texture is being used at spots which looks like its mainly the grass texture. I'm guessing it's because of blending multiple textures together.

    Code (CSharp):
    1.     private string GetUnityTerrainGetTextureName(Vector3 position)
    2.     {
    3.         Terrain terrain = Terrain.activeTerrain;
    4.  
    5.         // Convert the position to be local coordinates of the terrain
    6.         position -= terrain.transform.position;
    7.         TerrainData data = terrain.terrainData;
    8.         Vector3 size = data.size;
    9.  
    10.         // Convert the position to be a normalized value of the terrain size
    11.         float x = position.x / size.x,
    12.             y = position.z / size.z;
    13.  
    14.         // Get the textures at the coordinate
    15.         var maps = data.GetAlphamaps((int)(x * data.alphamapWidth), (int)(y * data.alphamapHeight), 1, 1);
    16.         var prototypes = data.splatPrototypes;
    17.         int length = prototypes.Length;
    18.         int index = 0;
    19.         float maxBlend = 0;
    20.         for (int i = 0; i < length; i++)
    21.         {
    22.             // More than one texture can be present in an area.
    23.             // Looking for the texture that is most visible.
    24.             if (maxBlend < maps[0, 0, i])
    25.             {
    26.                 maxBlend = maps[0, 0, i];
    27.                 index = i;
    28.             }
    29.         }
    30.        
    31.         string textureName = prototypes[index].texture.name;
    32.         return textureName;
    33.     }
     
  33. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    I am dealing with a crash in the built game.

    In the editor, everything runs smoothly: cts, weather manager and tenkoku function as expected.

    But when i build the game, everything is ok until i try to load the scene where i use the weather manager. I made some troubleshooting and it turned out that weather manager is the culprit.
    Does anyone have any idea on ow to fix it?

    using CTS 1.1.0, TENKOKU Dynamic Sky 1.1.7 on Unity 2017.3.1p2 (64-bit)
     
  34. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    I made more troubleshooting and the cause of the problem is these two lines in the CTSWeatherConroller.cs script:

    material.SetFloat("_Snow_Amount", manager.SnowPower*2f);
    material.SetFloat("_Snow_Min_Height", manager.SnowMinHeight);

    does anyone know what happened?

    PS: when loading the scene that has the terrain directly, it works properly. the crash only appear when i load it as the third scene.

    Here is the crash:
    UnityPlayer.dll caused an Access Violation (0xc0000005)
    in module UnityPlayer.dll at 0033:5485274c.
     
  35. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    999
    CTS - WebGL 2.0
    Unity version 2017.2.0f3

    What is the current status of using CTS when building for WebGL 2.0? I saw a few post regarding attempts or possible demos. Thanks.
     
  36. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    This is a wild guess only, but a couple of posts above an error was discussed when unloading terrains with CTS, see here for Adam's reply. I could imagine that the error / crash is caused by the new terrain not being "known" by CTS which then leads to a crash somewhere down the line when the terrain material is altered.
    The post I linked mentions a "m_shaderList" in the CTSTerrainManager that keeps track of all the CompleteTerrainShader-components of the current terrains. Can you maybe check if the CompleteTerrainShader-component from your loaded in terrain is contained in the m_shaderList before Unity crashes?

    I load in terrains during runtime as well and I remember having an issue with the weather manager as well, but iirc it did not crash, but just did not apply the terrain smoothness correctly on newly loaded terrains. Unfortunately I don't remember anymore what I did to resolve this :confused:
     
  37. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    hey! hows the update coming? is there gonna be some performance optimizations?
     
  38. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    thank you for the help
    i checked and it is loaded, still the crash happens when material.setFloat() is called :/
     
  39. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    Hmm, the only idea I have left then is to try to replicate the issue in a "bare minimum" scenario: Do you still get the crash / error when you create 3 new, empty scenes with 3 "empty" terrains (with CTS attached) in combination with the weather manager?
    If no, you could try to compare between your actual game scenes and your test scenario, in the hope you might find out what it is in your actual scenes that causes the crash.
    If it still happens it would seem more like a bug in CTS than a problem with your game. I would open a support ticket on the Procedural Worlds support page and maybe provide a link to download your "bare minimum" test scenario so they can easily replicate the issue.
     
    Mark_01 likes this.
  40. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    my 2 first scenes are just a Multiplayer connection scene and a lobby scene, they don't contain anything related to cts in anyway so i'm not changing shaders at runtime which would cause problems

    I've made more tests and came to another conclusion:
    changing the weather manager value at runtime is the problem.
    i'm using tenkoku's CTS weather integration and this time around, when i disable it, the scen works fine even when loading it as th 3rd scene
     
  41. Wacimo1996

    Wacimo1996

    Joined:
    May 20, 2017
    Posts:
    12
    This IS AWESOME! it has fixed my issue :) i also added the profile and checked "Keep Loaded Shaders Alive"
    Thank you for sharing this! and thank you OneManBandGames for the support :)
     
  42. greyforest

    greyforest

    Joined:
    Jun 25, 2015
    Posts:
    16
    Hi,Adam.Unity2018 removes buildin substance support,CTS seem likely base on it.Allegorithmic said the new pugin will avialable when the official 2018.1 launch , no ETA verison. Will you update ASAP when 2018.1 release?
     
  43. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    does that mean that I cant use my models painted with substance painter? this is stupid!!! substance makes it all-
     
  44. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    They separating it from the main build, allegoritmic will release plugin and handle substance support for unity on their side.
     
    Mark_01 and mattis89 like this.
  45. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    thank god!
     
  46. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    Updated shaders are basically done but.. They need some test and attention. As both of us Adam and I, we had to prepare things before gdc we was pretty overloaded but update should appear soon after GDC. Anyway soon new NatureManufacture epic asset will apear and im sure that you never seen such thing before:D ofc it will work with CTS too:)
     
    TeagansDad, eaque and Mark_01 like this.
  47. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    735
    you are teasing us!! a clue to guess what it is? :p
    :)
     
  48. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    2,009
    Like always something fresh :p btw you could meet us at gdc. My team mate will be in unity gear - he is the only eastern europe unity trainer. He have some clues about new asset :p Ofc he is sick atm like half of the team ( me too) but im sure he will come.
     
    Last edited: Mar 13, 2018
    eaque and Mark_01 like this.
  49. Kimller

    Kimller

    Joined:
    Mar 5, 2018
    Posts:
    8
    hey guys, i already have cts and tenkoku dynamic sky, do you know guys how can i use cts and cover all my landscape with snow when tenkoku is snowing ? Im ussing map magic too
     
  50. unity_cwjdyNWLKcKTAg

    unity_cwjdyNWLKcKTAg

    Joined:
    Dec 18, 2017
    Posts:
    4
    Hello I'm having some issues with the shader at the moment,
    Picture says a thousand words so.

    Basic shader I get this:



    Advanced shader I get this:



    I really want to use basic however for performance reasons.
    Terrain has 16 textures applied...

    I can manually paint over it and it's fine but that's not doable for the scale I'm working on right now. There should be full coverage of basic grass underneath everything so it's not like it should break there I think.
     
    Last edited: Mar 14, 2018