Search Unity

CTS - Complete Terrain Shader

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

  1. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    284
    Thanks for that. I figured it was using PPS in 2 namespaces just didn't know what I could do about. Figured CTS needed its own references.
     
  2. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    I think you might have 2 different versions of Post Processing installed in your project, I assume one from the package manager, and probably another one (maybe as part of another asset?) directly in the asset hierarchy. The tip from Velo222 is good in so far as it will fix the problem with little effort and you usually don't need the CTSDemoController script, however if you have any other asset that wants to access the "PostProcessLayer" type you might run into the same problem again. You could try to look for "PostProcessLayer" in your asset hierarchy, and then switch for the search result between "In Assets" and "In Packages" to see if you get a result in both - if yes, I would recommend to hunt down the asset version and keep the package manager version:

    upload_2019-8-14_15-12-27.png
     
  3. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    284
    Great suggestion for future. Thanks.
     
  4. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    57
    I have CTS Weather Manager "Minimum Snow Height" set to 50 so that snow is not generated below the Aquas water level, but it is generated there anyhow. Is there some "falloff" that I need to "sharpen"?
     
  5. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Yes, please check the "Height Blend Range" in the CTS profile. This "Range" is a falloff area where the snow becomes weaker and weaker until 0 strength. This falloff is taking place below the minimum snow height, so you would either need to set the Height Blend Range to 0 for a very sharp, cut off snow border, or consider the falloff when setting the minimum snow height (e.g. "My water level is at 50, my falloff needs 5 units, So let's put minimum snow height at 55 so the snow will be at 0 around water level.")
     
    Clyde_Coulter likes this.
  6. Frosty-DCFC

    Frosty-DCFC

    Joined:
    Jun 12, 2019
    Posts:
    6
    Got a question regarding custom splatmaps (RGBA) to save me painting on each terrain texture layer.
    What is the process to enable this so that, for example, terrain layer 1 is only applied where the Red channel has data in the splatmap png and so on with B,G and A for the other layers?
    Main aim is to use a World Machine splatmap to distribute my Substance textures. (I have both GAIA and CTS and using Unity 2019.2)
     
  7. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    I'm not 100% sure if I understand your question correctly, but the default setup for CTS is that it will read the splatmap information from the terrain data object's splatmaps. When doing so, it is already associating the textures as you described
    Red channel = 1st layer
    Green channel = 2nd layer
    Blue channel = 3rd layer
    Alpha channel = 4th layer
    and then comes the next splatmap image. When you are disconnecting the CTS profile, it will read the splatmap information not from the terrain anymore, but from a .png texture, but the way the information is encoded (red=layer1, etc.) is still exactly the same.
    So coming from world machine, you would either need to import the splatmap in the unity terrain, or exchange the splatmap .png file with the splatmap from world machine and you should be good to go.
     
  8. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    An update for CTS has been released on the asset store:

    v2019.1.4 August 2019

    - Support for HDRP / LWRP 6.9.1 in Unity 2019.2 added.
    - Improved shader installation: CTS will now install only the shaders of the rendering pipeline that is currently in use, and will prompt you before doing so.
    - Added window menu entry for manual shader installation at will.
    - CTS now uses per-pixel normals on "Draw Instanced" terrains to improve visual quality on distant terrains.
    - The weather manager has now a list of texture IDs to exclude from seasonal tinting.
    - Added options to bake normal maps and color maps for all terrains in one go in the CTS Window menu.
    - Fixed various Unity 2019.2 related warnings and issues
    - Fixed a bug where activating the "use cutout" checkbox would not automatically update the CTS shader
    - Fixed a rare bug where the Ambient Skies window would not open properly when installed together with CTS and multiple rendering pipelines being installed.

    When you install this version ,it is pre-configured to run in the built-in pipeline, if you are running a different pipeline a popup window will appear asking you to run the shader installation once from the window > procedural worlds > cts menu to switch out the shaders for the correct pipeline.
     
    Velo222 and Mark_01 like this.
  9. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,291

    Fantastic, thanks Peter. I've been looking forward to upgraded HDRP version support with CTS for awhile! :)
     
    PWPeter likes this.
  10. Frosty-DCFC

    Frosty-DCFC

    Joined:
    Jun 12, 2019
    Posts:
    6
    Thanks for the last reply to my query.
    I have just split my terrain using the Terrain Toolbox into smaller tiles from one large terrain square.
    Can CTS auto divide the colormap as it becomes tiled to fit each new smaller terrain split tile?
    I need to retain the one larger color map and have this split to each new tile relative to its position in the overall terrain.
    Thanks
     
  11. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Does your colormap contain any additional info (e.g. hand painted coloring, color info from another 3rd party tool) that you added, or is it just a colormap baked with CTS from the original large terrain? If it is just the latter, you could just re-bake the colormap on the smaller terrain tiles. There is a new function n the newest CTS release (see above) that allows you to bake the color map on all the existing terrains automatically.
    Otherwise it is not possible I'm afraid, CTS has no chance to "know" that you originally had one larger terrain and then cut it down into smaller pieces. You would need to cut the file down yourself in photoshop or gimp.
     
  12. Frosty-DCFC

    Frosty-DCFC

    Joined:
    Jun 12, 2019
    Posts:
    6
    Yes - there are some handpainted elements on the colormap so it looks like a manual cut and place. Thank you again :)
     
  13. jebediahh

    jebediahh

    Joined:
    Feb 20, 2017
    Posts:
    19
    Hello - Is there a way to control the tinting and snow levels from within code - for example, to change seasons at runtime in code?
     
  14. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Yes, there is already a weather manager component that allows you to adjust snow, rain and seasonal tint at runtime, to use it, do the following:

    1. Make sure that CTS has been added to your terrain and that a profile has been applied to your terrain.
    2. Click Window -> Procedural Worlds-> CTS -> Add Weather Manager. This will add a CTS Weather Manager object to your scene. It will also iterate through every terrain and add a CTS Weather Controller to it. The Weather Manager is the central point that sends weather updates to the weather controllers on each terrain.
    3. Run your game and change the weather with the sliders on the Weather Manager. It should affect the smoothness and the snow on the terrain and the seasonal tint (if enabled).

    You could then control the weather manager from your code, or, if you need more control, you can check the code in the function ProcessWeatherUpdate in CTSWeatherController.cs for an example on how to update the properties of the CTS materials. In principle you can edit all properties that you find in the profile by altering the associated material property from code.
     
  15. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    78
    Hello,

    Any news on adding Rain Droplet / Puddles effect to CTS ?

    Other question : I want my user to choose between different texture quality on the "Options" section of my game. There is any way to "change texture compression let say from 1024 to 2k or 4k" and bake textures again on runtime ?

    thanks
     
    Last edited: Aug 29, 2019
  16. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    You can display puddles already by either using a texture as designated "empty" water texture with high smoothness, or by changing the snow textures of the snow feature so that it displays as water instead. See the Swamp demo scene for how to set this up:
    upload_2019-8-30_2-27-44.png


    Baking during runtime is difficult, as it requires us top access features from the Editor namespace, which are not available in a build. But it should work if you either create separate quality preset CTS profiles and switch between them at runtime (you can also see in the demo scenes how it is done that you can switch between different profiles).

    Or you can bake the textures at a certain resolution, then locate the texture array files in the asset hierarchy, and copy them away under a new name so that they won't be overwritten.
    upload_2019-8-30_2-32-21.png

    When you have baked those arrays in the desired resolutions and distribute them with your game, you should be able to switch them out in the CTS material on the terrain on the fly for the different resolution settings. Here is one CTS material on the terrain:

    upload_2019-8-30_2-33-42.png

    And inside this material, these would be the fields where you would need to switch the albedo / normal in the different resolutions when the player changes settings:

    upload_2019-8-30_2-35-56.png
     
    Mark_01 likes this.
  17. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    78
    Hi peter,
    Thank you for your quick answer.

    About texture quality I think the best/easy way will be to switch between different CTS profil.

    About puddle, sorry for the misunderstanding, I mean rain collision on the terrain (I'm using enviro) I was using RTP before switching to CTS (Wich is by far better and easier to use), in RTP I have a nice rain effect on the terrain (kind of splashs..) I was wondering if it is possible to acheive the same effect with CTS ?

    Thank you so much
     
  18. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Currently not, you can increase the smoothness on the terrain with the weather manager component to make it appear wet, but it does not display any raindrop / ripple effect on it.
     
  19. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    78
    Hi,

    I'm using CTS 2019 (last version) and Unity 2019.2.3f1 + Standard/BuiltIn render pipline. Everything works fine in editor.

    When i build the game, my terrain dissapear. look like a shader issue..

    I'm using CTS Advanced Shader. Based on this post, I tried all of this workaround :

    1. Adding shaders to always included - Not Helped
    2. Clearing shader variants - Not Helped
    3. Recording new shader variants - Not Helped
    4. Instancing Shader variants Keep All => Not recommanded ?
    5. Adding dummy scene - Not Helped
    6. Disconnect and reconnect feature - Not Helped

    EDIT: i found the issue => my Instancing Shader variants was set to Strip All. When changed to Strip Unused it worked.

    Second question : There is any performance benefit from enabling GPU Instancing on CTS material? if yes how i can enable it for all my terrains materials ? (i can't disconnect CTS profil from terrain cause i do some profil switching on runtime).

    Thanks
     
    Last edited: Sep 7, 2019
  20. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Hi, Glad you were able to figure it out right away & thanks for posting the solution as well!


    No, there should be no advantage - GPU Instancing should only bring an advantage if the same mesh is used between the same shader, which is normally not the case for the terrains in the scene. Please also see https://docs.unity3d.com/Manual/GPUInstancing.html.
     
    amynox likes this.
  21. ArtisticSliz

    ArtisticSliz

    Joined:
    Jan 4, 2014
    Posts:
    29
    Hey @AdamGoodrich , any chance we'll see integration between CTS and Lux Water's gerstner waves, to show wetness on the terrain? I know it may be low-priority. It's a little complicated, too.

    Needs to make ground above water shiny, without making ground underwater shiny. Needs to get wet and then slowly get dry. RTS even has water run downhill.
     
  22. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Hi and thanks for the suggestion! I have just added it to our backlog. We will need to see if it is doable with CTS, and how much effort it would be and if it influences performance as well.
     
  23. unity_c1ndWE1Nn46iPg

    unity_c1ndWE1Nn46iPg

    Joined:
    Jan 13, 2019
    Posts:
    143
    When using CTS frame rate dropped from 120 fps to 85fps in stand-alone.exe even using Graphic Job Experimental. That's not very small loss. Is there any performance setting?
     
  24. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    That sounds indeed like a bit much: Normally you can expect to have roughly the same performance with the Lite and Basic Shader Types, and worse performance (in return for mor shading features) with the advanced and tesselation shader types.
    Could you please try to compare the performance in the swamp or landscape demo scenes that come with CTS? (When running the demos you can switch between unity shading & the different shader types with 1-5 on your keyboard) Another interesting thing to check would be the unity profiler to see if there is anything out of the order that you can attribute the loss of performance to (in other words: Does there suddenly show something up in the unity profiler that has not been there under unity shading as well?)
    In case you are not familiar with the profiler, this post has some directions on how to investigate the difference between two test scenarios.

    EDIT: What I forgot to answer: The biggest "performance setting" would normally be to use the lighter "Basic" or "Lite" shader types (can be switched on top of the CTS profile), switching on "Draw instanced" in the optimization settings and using lower texture resolutions, but I would check first if you can see something in the profiler.
     
  25. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    15
    Hi, can someone guide me how to setup snow properly.. I followed video tutorial though... on a clean new project...there is no full mountain covered snow at all...see attached screenshot. Snow settings are on max... Textures have snow power to max as well...

    Thanks in advance!
    Primus
     

    Attached Files:

  26. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Try to reduce the noise setting to 0 please, that should help with the random patches of missing snow. Your snow looks a bit grey as well, I think this might be the high specularity setting.
    If you have the CTS demo scenes installed you could take a look at the advanced profile in the landscape demo - this profile should have the proper snow settings for snowy mountains that you can copy. For 100% full snow coverage please try these settings:

    upload_2019-9-15_22-3-42.png
     
    JBR-games likes this.
  27. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    574
    I wanted to pose a question.

    CTS is my Default Terrain Shader, it is the best!

    I just have one major issue..normals!

    Why would the same normal map look great at 1.0 in the Unity Standard PBR, but Black in all variants of CTS.

    I can NOT use a normal value above .33 in CTS otherwise it turns black (all are marked as normals, all smooth and rough as non color(linear)..

    I am running 2017, linear forward....Can you think of anything that might mess with my CTS normals?

    Patrick

    This capture has all normal map values at .33 or below :-(