Search Unity

CTS - Complete Terrain Shader

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

  1. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    We currently are only tested with 5.7 on 2019.1.x. Not sure if it will work with later versions. They seem to change them every few weeks so we only update periodically.

    Yes.
     
    tcourbet likes this.
  2. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    Looks to me like your terrain is not even enabled.
     
  3. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    24
    I only enabled part of the terrain to improve response time.

    After I ask the question, and I did some other attempts, such as I closed the Draw Instanced option.These terrains can be seen.But it still displays the wrong shader.
    upload_2019-6-11_15-44-53.png
     
  4. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    24
    Thank you. I have another question.It's about ColorMap.If I have a lot of terrain, is there a quick way to set their ColorMap
     
  5. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Which HDRP version are you using? CTS requires HDRP version 4.8 in Unity 2018.3 to function. It can also be that you need to select one of the terrai s in the scene hierarchy so that CTS updates the material to the HDRP shader.
     
  6. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Sent you a direct message with a possible solution ;)
     
  7. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    24
    Thank you for your help. I have received your solution.
    I checked that my HDRP version is 4.10. I reinstalled version 4.8.Now the terrain can be rendered.I seem to have slipped up.Thanks for the tip.But now there is a problem. The distant terrain becomes blurred.The effect of the effect is similar to not open the Draw Instanced.Whether the current CTS can support the Draw Instanced?
     
  8. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    The CTS version you are using supports Draw Instanced, you can even switch it on and off via the optimization settings in the CTS profile. Can you please post a screenshot of the issue?
     
  9. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    24
    I used unity2018.3.0f2.I found that in CTS mode.The Draw Instanced option does not work.
    upload_2019-6-13_10-30-29.png

    upload_2019-6-13_10-38-18.png
     
  10. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    Hi, so I bought CTS and tried it with hdrp 5.16 and as expected it doesn't work. (works fine with 5.7)
    I know it's a pain for devs (for everyone really... :p) at the moment but I was just wondering how often / when you're planning on upgrading to the latest hdrp version?
    Thanks!
     
  11. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    Please fill in all the texture slots. CTS is a PBR shader and the textures are there for a reason. @NatureManufacture - any comments from you?

    @NatureManufacture i reckon it must be getting time for another CTS update :)
     
    Mark_01 likes this.
  12. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Ah, now I see the issue, it looks like the Global Normal map is not displayed the same way unity does it when "Draw Instanced" is enabled.
    Can you please click the "Bake NormalMap" button on the CTS component? This will create a global normal map for the entire terrain which will improve the look of the terrain with higher pixel error settings as well. You can fine tune the strength of the Global Normal Map on top of the CTS Profile.
    Also in the CTS Profile you can find a setting for a Global Detail map, by activating an appropiate far distance strength and scale you can add additional detail / sharpness to the far away portions of the terrain.
    Last but not least you can also decrease the Pixel Error in the Terrain settings to get more precise rendering in the distance, however this also costs performance

    When I reproduced your issue, we noticed that the Terrain Normal map of the unity shader seems to have better quality than the Terrain normal map of CTS, we are currently looking into this as this should normally not be the case.
     
    Mark_01, AdamGoodrich and wumn like this.
  13. wumn

    wumn

    Joined:
    Jan 11, 2018
    Posts:
    24

    Thank you!
    I did what you said, and tested it. The details on the distant terrain were indeed improved, but it didn't seem to be good enough. I looked up some information, and it seems that there is really no Shader that supports Draw Instanced. This seems to be a problem with unity new terrain systems. I look forward to your ability to solve this problem.
     
  14. tcourbet

    tcourbet

    Joined:
    Oct 5, 2017
    Posts:
    46
    :eek: :eek:
    That would be great!

    While I'm at it, it's not possible to change the intensity of the global map per texture, is it? (in the same way you can change the Detail Power or the Geological Power)
     
  15. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,611
    I will test this today
     
    Mark_01 and AdamGoodrich like this.
  16. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    No, that is a per-profile / per-terrain setting only unfortunately.
     
    tcourbet likes this.
  17. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    77
    hi im try ussing CTS with Mapmagic in Unity 2019.1 and 2018.3 what i get is black textures in every unity version that usses texture layers...is there anyfix for this?i cant get it work...
     
  18. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Hi, in general black textures mean that the texture on the terrain is not part of the internal texture array of CTS yet. You can normally fix this by opening the CTS profile and click on "Bake Textures" at the bottom to update the CTS Profile with the textures from the terrain.
    If that alone does not help, can you please check if you can still see the terrain texture layers as prototypes in the terrain inspector, and if yes, if these textures are the same as the list of textures in the CTS profile?
     
  19. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    77
    Ok I make some screenshots : one is all complete black and other i can see textures but grass texture becomes black ...its by clicking tick box in MM Custom shader node "Optimize Empty Map" <---that makes some textures become visible and some black
     

    Attached Files:

  20. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Can you please try the following to see if the CTS profile that is being used is working on its own in general:
    1. Open a new scene
    2. Create a new terrain via the Scene Hierarchy Create menu
    3. Select Window > Procedural Worlds > CTS > Add CTS To Terrain
    4. Locate the CTS profile that you were using with Map Magic In the Asset hierarchy.
    5. Select the CTS Profile and click "Apply Profile" at the bottom in the inspector

    Now please test if the terrain has the same amount of textures in its terrain layers as it should have in map magic, and also if you can paint them on manually with the unity tools and if they are all visible. If they are black, select the CTS profile again and click "Bake Textures" at the bottom, if that is the case this should most likely fix the Map Magic issue as well then when you open the Map Magic scene again.
     
  21. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    77
    Yes textures the same ...In screenshoot i even painted all of them and there seems like all working but only grass textures is going black...when i zoom out in scene view i start see all grass texture but when zoom close its become black...same is with mapmagic if i enable Optimize Empty Map (in MM Custom Shader Node - CTS) all textures is black even when u zoom in or out in scene view (and in playmode) but if i disable Optimize Empty Map then grass only has that black effect when zoom in (and in playmode) in scene view......

    EDIT: OK i was trying to change diffeent grass textures and all was black ..then i bake textures and now they are good dont know why bake was not helping first time...cuz i was bake them in unity 2019.1 and also in 2018.3 ..Ok if i will get some more problems will ask..also duno how important is Optimize Empty Map in MM...cuz now i going without it..
     

    Attached Files:

    Last edited: Jun 15, 2019
    PWPeter likes this.
  22. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Glad to hear it is working for you now! It is difficult to tell why this was happening without sitting in front of the project myself, but normally if the textures are displayed correctly on this terrain after they are baked they should stay this way now. I can't tell what the "Optimize Empty Map" setting in MM does, I tried to check in the MM documentation / wiki but did not find it there, that is something you would need to ask the MM dev if you want to use that setting.
     
  23. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    968
    Is there a new workflow for accessing the texture spawners in 2018.3+? I'm adding the CTS component to an existing terrain with textures, then creating and applying a profile. I don't see an option to add a scene manager. Thanks.
     
  24. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Hmm, I think you might be mixing up CTS and Gaia (or another texturing tool)? CTS has no texture spawner built in, it renders the textures on the terrain depending on the existing terrain data splatmap, but it does not create or alter this splatmap by itself.
     
  25. topofsteel

    topofsteel

    Joined:
    Dec 2, 2011
    Posts:
    968
    My bad! Yes, I've always used them together and it's been a while. Sorry, thanks.
     
    PWPeter likes this.
  26. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    No problem at all, in Gaia you can create the texture spawner from the Gaia Manager window with the "Create Spawners" button.
     
  27. barbodshahrabadi

    barbodshahrabadi

    Joined:
    Jun 24, 2018
    Posts:
    2
    i have a problem here, when i use CTS i cant fill the terrain with details(niether grass texture nor detail mesh)
    when i use CTS and i try to fill my terrain with detail,in the game i see that just some parallel lines on my terrain are filled with detail and the rest is empty but in the scene the whole place is filled with detail and when i remove the CTS from my terrain and change the terrain material to built in standard, the problem solves and i see that in the game the wholeplace is filled with detail!
     
  28. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Are you using a Unity version below 2018.3? If yes, can you please select your terrain, open the terrain settings (cogwheel button in the inspector) and look for the value "Detail Resolution Per Patch".

    DRPP.JPG

    Take note of that value, then open the CTS profile that you are using on the terrain and look for the "Detail Resolution Per Patch" value in the optimization settings of the profile. Make sure the both values match, the profile needs to have the same setting from the terrain.
    If you are running a higher unity version, or if that did not solve the problem, can you please tell your Unity and CTS version (visible in the component or CTS profile) and provide a screenshot of the issue? If you are seeing any error messages in the console, that would be important to know too.
     
  29. barbodshahrabadi

    barbodshahrabadi

    Joined:
    Jun 24, 2018
    Posts:
    2
    Thank you sir, I changed the Detail Resolution Per Patch value and now everything is OK!
     
  30. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    81
    I am trying to move a terrain from one project to another. I am able to move the terrain mesh however I can't get CTS to display the texture from the old project in the new project correctly. I have transferd the profile from the old project into the new project. Is there a process that I should be using or data that I'm missing in the transfer?
     
    Last edited: Jun 21, 2019
  31. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    This sounds like you are most likely missing the texture array files of the profile - these are larger files that contain all the textures and the information of the additional maps (smoothness map, heightmap, etc.) of the profile. You can find those under Procedural Worlds\CTS\Profiles\Arrays
    You can either export and import these, or you could also re-create them in the target project by clicking "Bake Textures" at the bottom of the profile. This would require however that the target terrain has the same texture configuration as the original terrain from which the profile was created from.

    I recently had to export a CTS terrain for a test as well, here is a screenshot from the export settings for the unitypackage. In the window on the righthand side of the screenshot you can see all files that are relevant for exporting a terrain into another project together with the CTS profile:

    export1.jpg

    Basically you need
    • the CTS profile
    • the scene file containing the terrain
    • The terrain data asset
    • All Terrain Layer assets
    • The textures used in the terrain layers
    • The CTS array files for the profile
     
  32. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Hi guys,

    Just trying to understand the HDRP support of CTS 2019. I am trying to use CTS along with Map Magic in Unity 2019.2b6.

    At first I was getting everything pink. I then downgraded the SRP packages to 5.7.2 and things were still pink, but I determined that CTS was not updating through Map Magic, so I explicitly added a CTS component to the terrain then selected a profile, and then it appeared CTS did update as expected. The pink went away and I did have textures, but I also had some errors in the console including:

    CTS could not find a valid shader for this configuration: -- Render Pipeline: HighDefinition2018x - Shader Type: Tesselation - Shader Feature Set: None

    So I'm curious if this is an issue of HDRP support being not complete? Are the tesselation shaders not supported yet, or is this something else?
     
  33. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Yes, the tessellation shader type is not supported yet in HDRP due to technical limitations, but we will support it in the future when it becomes more accessible.
     
  34. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Excellent. Thank you.
     
    PWPeter likes this.
  35. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Does CTS support multiple terrain tiles? I have 4 tiles with the same CTS profile set on each, but all but the first terrain show black.

    EDIT: I'm getting this error when clicking "Apply Profile" on the profile inspector, yet I have textures on them all as far as I know. Clicking on paint terrain shows the correct layers on each, and they are all neighboring terrains so Unity mirrors that over.

    Code (CSharp):
    1. Missing splat textures - add some textures to your terrain
    2. UnityEngine.Debug:LogError(Object)
    3. CTS.CompleteTerrainShader:UpdateShader() (at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:1058)
    4. CTS.CompleteTerrainShader:ApplyMaterialAndUpdateShader() (at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:980)
    5. CTS.CompleteTerrainShader:set_Profile(CTSProfile) (at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:83)
    6. CTS.CTSTerrainManager:BroadcastProfileSelect(CTSProfile) (at Assets/Procedural Worlds/CTS/Scripts/CTSTerrainManager.cs:169)
    7. CTS.CTSProfileEditor:OnInspectorGUI() (at Assets/Procedural Worlds/CTS/Scripts/Editor/CTSProfileEditor.cs:1073)
    8. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
    Last edited: Jun 30, 2019
  36. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Yes, it should support multiple terrain tiles normally. What is important though is that all terrains use the same terrain texture layer files (in the same order) in the moment you apply the profile - if they are using different layer files or the order is different, it can give different results.
    However I'm not 100% sure if that was the case here: The error message you were seeing should normally only appear if CTS could not find any terrain layer files at all on the black terrains.
    Could you please post a screenshot of the terrain layers of the working vs. the nonworking terrains, it would also be good if you could compare the filenames of the terrain layers to see if there is any difference between them.
     
    JBR-games likes this.
  37. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    What is causing this stippling of the snow texture? I can't figure out what setting is controlling it. It isn't in the base texture itself.



    EDIT: Figured this out. It was the Noise settings.
     
    Last edited: Jul 2, 2019
    PWPeter likes this.
  38. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Ok still fighting with this :(

    Here is my workflow.

    1. Create a new scene
    2. Right click, 3D Object, Terrain
    3. Select terrain, Component, Add CTS to Terrain
    4. Add my profile to CTS component.

    This works as expected. Next, additional terrains

    1. Select terrain
    2. Go to Create Neighbor Terrains option
    3. Add neighboring terrains around the original terrain.

    Add CTS to the neighbor terrains

    1. Select each terrain
    2. Component, Add CTS to Terrain

    At this point the terrain changes, and I see the profile layers added to the Terrain, but the terrain goes black and the console shows the previously reported errors:

    Code (CSharp):
    1. Missing splat textures - add some textures to your terrain
    2. UnityEngine.Debug:LogError(Object)
    3. CTS.CompleteTerrainShader:UpdateShader() (at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:1056)
    4. CTS.CompleteTerrainShader:ApplyMaterialAndUpdateShader() (at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:980)
    5. CTS.CompleteTerrainShaderEditor:OnInspectorGUI() (at Assets/Procedural Worlds/CTS/Scripts/Editor/CompleteTerrainShaderEditor.cs:599)
    6. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    7.  

    Side note here, there doesn't seem to be an easy way to add CTS and the profile to multiple terrain tiles at once. I don't know if this is intended so that you can have mixed terrain shaders, or to allow different profiles per terrain? With lots of tiles adding the component to each and then assigning the profile to each is a pain. A bulk option would be nice.

    cts1.png cts2.png
     
  39. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Thanks for the detailed description, I followed your workflow and used the CTS profile "G4_Basic" that comes with CTS, however I can't reproduce your issue, here is how it went down for me:

    The initial terrain after the CTS profile has been applied:
    CTS1.JPG

    After creating the neighboring terrains, I noticed the neighboring terrains are being created with 1 texture only vs. the 4 in the profile, this should not matter in this constellation though:

    CTS2.JPG

    After adding CTS and the profile to the rest of the terrain, CTS is running on all the terrains and I can paint on the other textures as well:

    CTS3.JPG

    So I'm not sure why it is not working in your constellation. The error message that is thrown by CTS should only appear when there are no textures at all on the terrain - and this should never be the case since the way you create them as neighboring terrain they should at least have 1 texture.

    Could you please check the material settings on one of the black terrains by doing the following: Open the terrain settings, then double click on the material that is referenced there. This should display a long list of settings for the CTS shader on this terrain. Can you please check if the black terrain has the correct splatmap info for the terrain associated in the material? This would mean that you see splatmap textures in the fields "Texture_splat_1-4", here is an example how this would look like for a correct terrain:
    CTS4.JPG

    You should be able to see a splatmap whose color pattern matches the actual texture distribution on the terrain. For your black / broken terrains I assume those fields might be empty. If that is the case, could you try to open your CTS profile and click on "Bake Textures" on the bottom to see if that fixes it?
     
  40. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    There are bulk options but they are hidden a bit:
    Window > Procedural Worlds > CTS > Add CTS To Terrains
    will add the CTS component to all active terrains in the scene.

    When you select a profile in the inspector and press "Apply Profile" at the bottom, this will also apply the profile to all active terrains in the scene (as long as they also have a CTS component on them).

    With these two options you can bulk process terrains.
     
  41. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Thanks for the detailed reply. I will check this out in a few hours.

    If it makes a difference this is in CTS 2019 with a terrain advanced based profile.
     
  42. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Ok so digging into this:

    Double clicking the material on the GOOD terrain shows a solid red image in the first Splat entry (texture_splat_1). Double clicking on a black terrain opens up the same details but all of the splat entires, including texture_splat_1 are empty. They don't have any textures assigned.

    Clicking Bake Textures in the profile doesn't change anything. I had tried that previously, but just did it again with no effect.
     
  43. wangjiangang

    wangjiangang

    Joined:
    May 5, 2015
    Posts:
    13
    hi Adam~can cts snow support mobile?
     
  44. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Ok, this is bad and good news: bad news since it is still a mystery why those fields are empty, good news is that if they are empty it is correct / normal that the terrain is rendered in black then.
    I made a small script to hopefully fix this issue, it goes over the terrains and it should put the correct splatmap from each terrain into the corresponding material field. Can you please put the attached file in the folder
    Assets\Procedural Worlds\CTS\Scripts\Editor
    This should give you a new menu entry in the CTS menu to start the fixing process:
    CTS5.JPG
     

    Attached Files:

  45. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Yes, this should work if the device supports at least Shader model 3.5. However the snow is only supported in the basic and advanced shader types, the lite shader type does not support snow.
     
  46. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Ok so strangely when this runs it seems to fill in splat maps for 2, 3 and 4 but not 1. After running it and then trying to apply profile the same error occurs.

    Looking at the code I don't see an immediate obvious mistake but I got the same results on 4 terrain tiles. No splat map in the first slot, maps in the rest.

    Stepping in, there does appear to be valid data in the array you are pulling from, so it doesn't look like something as clear as "Texture 1 is None because the source is missing".

    terrainData.png
     
  47. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    Actually no I'm wrong. That was only for the original terrain tile. Indeed all the other tiles have no entry in slot 0!

    terrainData.png
     
  48. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    The problem seems to be specifically with neighbor terrains. If I create a new standalone terrain in the same scene (3D Object -> Terrain) that one will work correctly. I made 3 of them with no problem. They all work. But when I try to then add neighbour tiles, by using the button in the inspector then clicking on the tile highlights in the scene, all those neighbour terrains are broken.
     
  49. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    383
    Thanks for testing & reporting back! Looks like bad and good news again, bad that is not working, but good that you were able to debug and find out that the first alphamap slot in the array is empty, even though it should be filled...I fear this might be an unity bug, could you please tell me which version you are using? (I was testing in 2018.4.0 and 2019.1.0)
    I double checked how the alphamap arrays look like for me, they are both filled in slot 0 but what is suspicious is that on the original terrain that splatmap texture is also named "Splatmap 0":
    CTS1.JPG
    While on the new neighbor terrains it is called "Splatmap 1" even though it sits at index 0:
    CTS2.JPG

    Another thing that could play into this is that my scenario uses a CTS profile with only 4 textures while you use 15, maybe the issue with alphamap slot 0 being empty stems from there. If you could tell me your unity version I would try to replicate in that version with a profile with 15 textures.
     
  50. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    535
    This is using CTS 2019 and Unity 2019.2b6, however not currently using HDRP. Using CTS2019 for the instanced support.