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
    Awesome tutorial Patrick!!! :)
     
  2. shawnepdmartin

    shawnepdmartin

    Joined:
    Jul 27, 2015
    Posts:
    47
    I'm making a system to detect when my player wanders off the path. So far so good, got it detecting what texture is below (had to disable strip textures, although I wonder how I'd detect the texture if I leave this enabled...)

    Anyway, in the CTS profile I can slide the brightness up and down. I'd like to lerp a fade to black if my player veers too far away from the path on every texture but the path itself.

    How do I access the CTS profile in real time?
     
  3. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    CTS creates a custom material for your terrain according to your profile settings. You can access this material and change it accordingly during runtime. You only need to figure out which CTS profile setting translates to which terrain material setting. Here is how you can check:

    Select your terrain, switch to the terrain settings in the terrain component in the inspector. You should see that there is a custom material applied to the terrain. Double click on the material entry, so your inspector will display the material settings itself.
    Look at the list of settings here. You should see basically the same settings that you have available in your CTS profile editor, just not formatted as nicely. But you can still edit those and the changes will be applied to your terrain. Here it is important that you find the setting you want to edit, I think the brightness just influences the color value for the textures, so you probably need those.

    During runtime, you should be able to access this material with

    Code (CSharp):
    1. Material material = terrain.materialTemplate;
    (where "terrain" is a reference to your terrain of course) and then you should be able to change the settings on the material like

    Code (CSharp):
    1. material.SetFloat("_Terrain_Smoothness", 1);
    Changing the colors will need some extra work, since those are stored in Vector4 objects in the material. This should work in theory:

    Code (CSharp):
    1. material.SetVector(Shader.PropertyToID("_Texture_1_Color"), new Vector4(redValue, greenValue, blueValue, shinynessValue));
    (where "redValue" etc. are set to the corresponding color values that you want to set.)
    If I remember correctly, Unity will keep changes on a material as they are when you exit play mode, so you maybe need to reset those to the default values as well when the game stops, not 100% sure though.
     
    AdamGoodrich likes this.
  4. ajaxlex

    ajaxlex

    Joined:
    Jul 15, 2016
    Posts:
    33
    Hi @FrozenEmpire - I was going to fire up amplify tonight when I got home to achieve something similar - I'm proc-gen ing with Map Magic, and need to punch arbitrary holes in the terrain. Do you mind sharing details of your approach?
    Thanks in advance!
     
  5. FrozenEmpire

    FrozenEmpire

    Joined:
    Sep 10, 2016
    Posts:
    72
    No worries, I sent you a PM...
     
    ajaxlex likes this.
  6. kerrmedia

    kerrmedia

    Joined:
    Nov 4, 2015
    Posts:
    250
    Hi Adam,
    New user question: I have a terrain that I have shaped. I did not texture it, but added CTS. If I add a profile, do I automatically get a lot of textures? Just started trying it, but each profile seems to look the same, just rock. Maybe I'm not clicking an "apply" button?
     
  7. OneManBandGames

    OneManBandGames

    Joined:
    Dec 7, 2014
    Posts:
    207
    A CTS profile only contains settings for how the terrain textures will be rendered, but it does not contain any logic regarding where which one of these textures will appear on the terrain. In other words, you still need to texture the terrain manually or with another tool before or after you use CTS to benefit from the improved rendering.
     
    Mark_01 likes this.
  8. Atelier-Gear

    Atelier-Gear

    Joined:
    Apr 8, 2018
    Posts:
    2
    Hi,
    There is one question.
    When using Swamp, is there a way to determine if the foot is a water field?
     
  9. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,613
    You use water as snow or as simple terrain texture?
     
  10. Atelier-Gear

    Atelier-Gear

    Joined:
    Apr 8, 2018
    Posts:
    2
    Yes,
    I'm trying to make a puddle using Snow Settings.
     
  11. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Can I change the layers?
     
  12. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,613
    What do you mean by that?
     
  13. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    I mean like that you said that layers is inportant, small first then big.. What if I F***ed up and have it the other way around? Can i re order the splats?
     
  14. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    584
    Hi,

    Does CTS support Vulkan?
     
  15. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    No. Best way is to get your textures right first and then build your terrain / splats.

    There is no specific integration. If Vulcan supports use of Texture arrays then you should be fine, and i believe it does.
     
    mattis89 likes this.
  16. Tomza

    Tomza

    Joined:
    Aug 27, 2013
    Posts:
    584
    Thank you. I want to use Vulkan in my project and I seek a perfect shader for my terrain. I don't know what is best for Vulkan.
     
  17. AndreasO

    AndreasO

    Joined:
    Sep 25, 2012
    Posts:
    90
    Getting lots of errors in the console during compile-time.

    Code (CSharp):
    1. Menu Component/CTS/Set Linear Deffered can't be checked because doesn't exist
    2. Menu Component/CTS/Add CTS To Terrain can't be checked because doesn't exist
    3. Menu Component/CTS/Create And Apply Profile can't be checked because doesn't exist
    4. Menu Component/CTS/Add Weather Manager can't be checked because doesn't exist
    5. Menu Component/CTS/Add World API Integration can't be checked because doesn't exist
    6. Menu Component/CTS/Show Forum... can't be checked because doesn't exist
    7. Menu Component/CTS/Show Tutorials... can't be checked because doesn't exist
    8. Menu Component/CTS/Show Documentation... can't be checked because doesn't exist
    9. Menu Component/CTS/Please Review CTS... can't be checked because doesn't exist
    10. Menu Component/CTS/About/Nature Manufacture... can't be checked because doesn't exist
    11. Menu Component/CTS/About/Procedural Worlds... can't be checked because doesn't exist
    12. Menu Component/CTS/Set Linear Deffered can't be checked because doesn't exist
    13. Menu Component/CTS/Add CTS To Terrain can't be checked because doesn't exist
    14. Menu Component/CTS/Create And Apply Profile can't be checked because doesn't exist
    15. Menu Component/CTS/Add Weather Manager can't be checked because doesn't exist
    16. Menu Component/CTS/Add World API Integration can't be checked because doesn't exist
    17. Menu Component/CTS/Show Forum... can't be checked because doesn't exist
    18. Menu Component/CTS/Show Tutorials... can't be checked because doesn't exist
    19. Menu Component/CTS/Show Documentation... can't be checked because doesn't exist
    20. Menu Component/CTS/Please Review CTS... can't be checked because doesn't exist
    21. Menu Component/CTS/About/Nature Manufacture... can't be checked because doesn't exist
    22. Menu Component/CTS/About/Procedural Worlds... can't be checked because doesn't exist
    23.  
    I'm using Win10, Unity 2018.1.2f1, CTS 1.7.0.

    Any ideas?
     
  18. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    296
    AdamGoodrich likes this.
  19. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    37
    Hey guys. My project won't export to windows with CTS in use in unity 2017.3. I get shader compile errors. Any ideas?
     
  20. IIporpammep

    IIporpammep

    Joined:
    Aug 16, 2015
    Posts:
    29
    Hello. Is there any progress or may be estimated date for CTS update with LightWeight support?
     
  21. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Hello!! I have exported a mesh terrain with gaia.... How do I apply textures on it ? Using cts too :)
     
  22. Kimller

    Kimller

    Joined:
    Mar 5, 2018
    Posts:
    8
    hey guys, does anyone knows why when i push on play button i lose my textures and cts leave just with base material all over terrain ? do you know how to solve it ?
     
  23. Mark_01

    Mark_01

    Joined:
    Mar 31, 2016
    Posts:
    451
    mattis89 likes this.
  24. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Mark_01 likes this.
  25. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053

    Hello :) Im only using Gaia & CTS, i exported base map and normals with cts... is splatmaps to export with gaia? EDIT:

    NVM, I got it working =) Thanks for the tutorial!
     
    Last edited: Jul 2, 2018
    AdamGoodrich likes this.
  26. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    When do we get HD render pipeline support? I tried to export a mesh terrain with cts basic mesh shader and all the maps but its purple... When I changed to hdrender < lit .. And assigned the bas map and normals it looked like the terrain but without any detail.. just color..
     
  27. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,301
    I would not expect HDRP support for many assets that do stuff involving rendering at this point. Its a lot of work, Unity are still making quite a few changes to the way the pipeline works, and there is very little support for terrain with HDRP at all. Also, aside from some very basic support of terrain they might be providing in the interim, all sorts of Unity terrain system changes are planned for 2018.3, which is also the version of Unity that they hope to have HD pipeline a bit more finished for.

    So, whilst I will shower any asset store developers who provide early HDRP support with my thanks, I dont expect it or really ask for it at this stage. How true this is depends on the type of asset, but terrain & rendering/shader stuff sounds like the least likely combination to expect early compatibility with to me.
     
    Mark_01, chiapet1021 and mattis89 like this.
  28. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    LW and HD pipeline support is dependent on Amplify support, which is dependent on Unity support.

    Unity still has not stabilised the HD pipeline, so do not expect anything from us until this is stabilised, and Amplify has supported it.

    We have implemented support for the LW pipleine, and this has exposed some issues that need to be addressed by Amplify before we can release it. As soon as they update and we confirm that it works we will make a release. We are hoping that this will be relatively soon.

    And in other news - I have some code from Bart that should enable mesh blending - and I need to do an integration of this into the terrain - so all things going well - maybe we should get a release for that and the bogus U2018 error messages later this week.
     
    Olander, Mark_01 and mattis89 like this.
  29. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Sounds awesome =)
     
    P_Jong likes this.
  30. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    Yeap I can't wait :)
     
    Mark_01 likes this.
  31. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    105
    Finally,... can't wait
     
  32. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    575
    um..question.

    Is Unity's new Render pipeline dependent on a third party solution... Amplify?
     
  33. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,613
    No.
    It's pretty complicated. Unity now is developing srp which is pretty fluid. Huge amount of changes in short time. It's hard to support by everyone.

    We made our CTS at amplify shader editor with our and amplify boost (custom solutions). Unity is in contact with amplify guys during srp development, because they want to keep it stable during srp development. This means that Amplify always have fresh info about what will be changed and when. We met small problem during cts upgrade and we wait for fix. I hope it will takes only few days, shaders are already convered but they need small fix to become fully functional. They even render properly on srp atm when you hit play button.
     
    P_Jong, DragonmoN, Olander and 2 others like this.
  34. lazerdarts

    lazerdarts

    Joined:
    Sep 12, 2014
    Posts:
    5


    I have sort of the same issue. did you get a resolution for this?
     
  35. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    We have not seen this. Can you please lodge a support request with more details so that we can try and replicate it. Support URL is in my signature.
     
    Mark_01 likes this.
  36. swredcam

    swredcam

    Joined:
    Apr 16, 2017
    Posts:
    106
    I'm sorry these are basic questions but I have watched several of the CTS and Gaia videos and have not seen this covered. Where can I see an image or other representation of each of the textures in CTS? Is there an easy way to view/select these? The thumbnails in Unity are so small they are really not useful. This does not have to be within Unity, I'm just trying to understand what is in the CTS packaged textures.

    Also, I'd like to make a stone path with moss on some of the stones. It looks like that is two different textures. Is there a way combine these?

    Thank you.
     
  37. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    There is a small image preview inside of the CTS profile. Not enough really to get a great sense of what the texture looks like, done more as a simple way to visually validate that you have applied the right texture. As it is a simple thing to to look at a texture in the inspector, detailed views is not something we felt that needed to be implemented.

    If you want to make a stone path with moss then you can either create your own stone / moss path texture, or use features like height blending in CTS.
     
  38. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    We will be making an experiment with the next CTS that might help with the compilation times.

    Previously we were putting all the CTS shaders in the resources directory to ensure that you always have them all at run time... but as most people wont be using them all - just the one they selected - this is probably contributing to slow build times.

    So we will move them out of there with next release and perhaps this might make a difference.
     
    Mark_01 likes this.
  39. BrokenVector

    BrokenVector

    Joined:
    Feb 2, 2017
    Posts:
    32
    Is there anyway to use CTS to have a different texture render in the close field compared to far? For example, close it renders as dirt and far it would render as vegetation covered?
     
  40. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    Hmmm... you could perhaps use a color map and blend that in at a distance.
     
  41. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    843
    Any ETA on that fix?
     
  42. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    580
    Hi adam,

    I want to finaly use CTS to check texture weight to detect texture under my player's feet:). There is only a little post about that on procedural worlds.Am i missing something?
    Could you please briefly tell me how to start and how to manage my script?
    thx in advance

    Cheers
     
  43. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    Working on it at moment - plus a bunch more - hope to have out by end of weekend:

    * Material caching system, and general multi terrain speedups
    * Mesh blending
    * Improved normals exporter
    * U2018 bogus annoying error bug

    CTS does provide this capability - any old script that does this will work - if - you disable the strip textures optimisation in your profile.

    The downside of this is that CTS will no longer be a 1 pass shader, so there is a performance impact on terrains with more than 4 texture sets.

    Unfortunately there is no way around that - Unity hard codes the number of passes.
     
    Rowlan likes this.
  44. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    580
    I didn't know about that issue :( I have 8 textures so i will give a try without the strip texture option.
    Can u give me the syntax for refering to Cts textures. A little exemple of such a useful technique would be much appreciated by many people!:)

    quote from procedural wolrds forum: a bit mysterious for an amateur like me!:p
    float[] textureMix = GetTerrainTextureMix(position, terrainData, terrain.GetPosition());
    int textureIndex = GetTerrainTextureIndex(position, textureMix);


    Cool, thought it would never come because it was already a NatureM product!
    thanks guys!;)
     
  45. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    So... I have been experimenting with the MenuComponent error, and trying to find a work around that would allow CTS to stay where it is in the Component menu....

    The Unity bug is documented here : https://issuetracker.unity3d.com/is...be-checked-because-doesnt-exist-error-message

    Anyways, looks like its completely broken and I am going to have to move CTS so that it will now have its own menu - which is painful as now all of our tutorials will be out of date and that will confuse people.

    In the mean time, as has been commented previously - to fix remove "Component/" from every line that starts with [MenuItem] in CompleteTerrainShaderEditor.cs.

    The general structure is:

    From: [MenuItem("Component/CTS/Add Weather Manager", false, 43)]

    To: [MenuItem("CTS/Add Weather Manager", false, 43)]
     
  46. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    107
    Hi,

    I'm new to CTS and am just playing around with it in VR. I still have to play around with it a lot more but a couple of observations so far. I'm using the Steam plugin with VRTK on a one of demo terrains that come with NatureManufacturers Landscape pack.

    I add CTS to the scene and it works great. I've run Basic, Advanced and Tessellation. The first 2 with no issues but my VR doesn't like the Tessellation, it looks great and adds a really nice level of detail but the are flickering black bands across the headset (not on screen).

    I then added VRWorks from Nvidia running SLI and MRS.
    That's been fine pre CTS (well, MRS has some issues), but now has the flickering black bands with all 3 shader modes. I wondered if it has to do with the custom shaders and Single Pass Stereo - there is a note on the NVIDIA VRWorks page about it.
    If anyone has any experience and tips about running CTS with VR, I'd be interested to hear it.

    Cheers

    Chris
     
  47. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Oh man that sounds like alot of work for you ! I dont generally care so much about the errors but thanks for the fix, its still a bit annoying so :D.. Hows it going with Gaia II ?
     
  48. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,623
    There is some interesting stuff happening with Unity terrain at the moment. We will see how that pans out and what the impact will be.
     
    P_Jong likes this.
  49. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,053
    Okay, intersting stuff ay(?) Gotta go and check it out.
     
  50. Haristess

    Haristess

    Joined:
    Nov 3, 2017
    Posts:
    19
    Hi there.
    I recently just got this, and straight away im having issues.
    1.
    When applying the Unitypackage, into the Projects under Assets, You cannot move the CTS folder into another Sub folder to keep Your Game clean. (i have a Plugin Unity Package folder keeping all the unity packages together. (Cts no longer works with lots of errors)
    2. (most importantly)
    Ive been working on a project for a while now, and already have a Terrain made, but have been desperate to find a tessellation plugin to bring my textures to life.
    Having applied CTS too the terrain, and having created a profile. I cannot place the Profile into the Terrain's profiles slot. I get:
    "Base.mat' is not a valid asset file name."
    "Base.mat failed"

    anyone have any idea what is going on here?
    thanks xx