Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

CTS - Complete Terrain Shader

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

  1. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    I'm not sure if this is the most efficient way, but you can read the splatmap information via the terrainData object:

    https://docs.unity3d.com/ScriptReference/TerrainData.GetAlphamaps.html

    You would need to "translate" the players world position to relative terrain coordinates for this function, and you will get an 3-dimensional array in return, containing the splatmap pixels of each texture.
    If you are doing this while CTS is active on the terrain, note that the "Strip Textures" setting in the optimization settings needs to be disabled, otherwise there is no splatmap info left on the terrain during runtime to read from. If this was active while you were trying the other scripts, this might have been the reason why it was not working for you.
     
  2. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    It is a bit difficult to say without a comparison. Do you remember what was the thing that changed when the normals became darker? From your description it sounds like the normals on the terrain where ok with CTS being enabled, but then they changed at some point, it would be important to know what happened / what you were doing at the time the change happened. What could have a big impact on the amount of "normal darkness" being applied to a texture is the directional light rotation (or the sun position) of the directional light in the scene in combination with the ambient lighting in the scene - if those are being changed it can have a massive impact on how normals look on the textures.

    Here is a texture on a flat terrain where the directional light shines directly on it from the top:

    upload_2019-10-16_18-15-34.png

    Now at a 45 degree angle, notice how you can see the darker parts from the normal map now:

    upload_2019-10-16_18-16-24.png

    Still at 45 degrees, but now with different ambient lighting. Note how the darker parts of the normals are still there, but they are not drawn in full black anymore, which looks quite different:

    upload_2019-10-16_18-17-44.png
     
    Hawk0077 likes this.
  3. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    Thanks Peter.

    I think you gave me the answer as I have been adjusting the ambient light in enviro whilst editing and then testing etc. So that could be the cause. I will keep an eye on it and get back to you if I have further issues.

    There is a similar thing going on with tree shadows, they seem fake but could be related. Il keep you posted if it doesnt solve the problem.

    Thanks again. Much appreciated.
     
  4. Unityaware

    Unityaware

    Joined:
    Feb 14, 2014
    Posts:
    97
    I just installed the latest CTS and getting the following compiler error (Unity 18.4.9 HDRP):

    Assets/Procedural Worlds/CTS/Scripts/CTSDemoController.cs(637,39): error CS1061: 'HDAdditionalLightData' does not contain a definition for 'useVolumetric' and no accessible extension method 'useVolumetric' accepting a first argument of type 'HDAdditionalLightData' could be found (are you missing a using directive or an assembly reference?)

    What is to be done Please?
     
  5. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Hi, could you please tell me which HDRP version you are using? The HDRP versions that are compatible with CTS are:
    4.8 in Unity 2018.3 & 2018.4
    5.7.2 in Unity 2019.1
    6.9.1 in Unity 2019.2
     
  6. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,392
    Hi PWPeter,

    I am using the CTS Terrain Shader 2019 asset and I'm having an issue with "Decals" not showing up in the Editor's Game view for some reason when using HDRP (and they won't show up in Standalone builds either). The Decals show up in the Scene view just fine, but they do not show up in the Game view for some reason. I am using Unity's provided HDRP>Decal shader.

    I tested Unity's HDRP>Decal shader on the default Unity terrain and the decals work fine in the both the Scene View and Game view. But then when I switch to using CTS terrain shaders, the decals do not show up in the game (again only in the scene view for some reason).

    I am using Unity 2019.2.6f1 and HDRP package version 6.9.2 (although it did not work in 6.9.0 or 6.9.1 versions either).

    Do the shaders need to be modified for Decals to work or might there be a setting somewhere I can checkmark to try to fix it? Thanks for any help.

    *** EDIT: This is solved for now. It's not a CTS problem apparently.
     
    Last edited: Oct 29, 2019
  7. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,392
    Hi PWPeter,

    Please disregard my previous post asking for help with the Decals. I discovered the problem has something to do with me using 2 cameras in my HDRP project. Having both enabled at the same time causes the decals to disappear in the actual game.

    For now, this is not a CTS problem as far as I know.

    Thanks for your help though! I really like your terrain shaders by the way :)
     
    PWPeter likes this.
  8. jamesparksart

    jamesparksart

    Joined:
    Dec 1, 2017
    Posts:
    24
    Real quick, if you can.. I have a terrain that I have painted and sculpted. I used the terrain toolbox to "duplicate" the terrain. Which gives me a terrain clone and new terrain data. I have CTS on them both. My problem is this: When I paint on the clone. It does not effect the cloned terrain. I looked and it is using the splatmaps from the original. So, I changed them out for the new terrain's splatmaps and the paint appears. Yay.. but wait... I went to check on the original terrain and it look great. Just the way I left it.. but then when I flipped back to the new terrain... my splat maps got changed out again.. :| How do I keep both splatmaps on the correct terrain? CTS looks like it creates a procedural material that one can not just duplicate and place one material set on one terrain and a copy for the other terrain. Any help would be appreciated. Thank you. :)
     
  9. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    217
    Not sure if you have a GitLab private repo or something we can contribute small fixes for you so you can work on features. But small change in 2019.3 HDRP leaving Experimental now.
    Code (CSharp):
    1. #if HDPipeline
    2.         using UnityEngine.Rendering.HighDefinition;//.HDPipeline;
    3. #endif
     
  10. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Thanks for sending in this fix! We don't have any repo that is open to the users at the moment. We are aware that HDRP was moved out of experimental and we will adapt CTS accordingly when 2019.3 comes out of beta.(We officially don't support alpha / beta versions as they can still change often & introduce bugs on their own)
     
    Hawk0077 likes this.
  11. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    Hi Peter, nmot sure if your around but I wanted to ask. Whats Storm? Heard it on the gaia pro video and want to know more about it but cant finda anything? Thanks
     
  12. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Storm is a system that speeds up your scenes by leveraging techniques such as object, collider, and light culling, lodding, instanced indirect streaming, automated impostor generation, automated lod generation, automated mesh combines.
    It is currently still in development, therefore there is not that much official information out on it yet.
     
  13. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    Thanks Peter, any idea of an ETA, although I am working on optimization at present regardless. Thanks
     
    Last edited: Nov 16, 2019
  14. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    No ETA at the moment, sorry.
     
    Hawk0077 likes this.
  15. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    204
    When I try to reimport I got the following error. (I also tried to delete and redownload, but still got this error)
    Unity3d 2019.2.11

    Failed to import package with error: Couldn't decompress package
    UnityEditor.Web.JSProxyMgr:DoTasks()

    'CTS 2019 - Complete Terrain Shader' Import Failed with error message: 'Failed to unpack package contents'.
    UnityEngine.Debug:LogErrorFormat(String, Object[])
    PWCommon1.Prod:OnImportPackageFailed(String, String) (at Assets/Procedural Worlds/Frameworks/Common1/Editor/Prod.cs:74)
    UnityEditor.Web.JSProxyMgr:DoTasks() (at C:/buildslave/unity/build/Editor/Mono/JSProxy/JSProxyMgr.cs:225)
     
  16. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    That is unfortunately a very common error with the asset store downloads, this error can occur on any package that you download from the asset store. We have collected a few things you can try to fix this error in this support article:
    https://proceduralworlds.freshdesk....ackage-with-error-couldn-t-decompress-package
    If this does not help, you would need to contact Unity support to help you out with this, we have no control over this issue from the Code / publishing side.
     
  17. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    204
    Thanks, it was a memory problem, looks like it needs more than 8GB to import.
     
  18. Kandy_Man

    Kandy_Man

    Joined:
    Mar 8, 2014
    Posts:
    46
    Is CTS something that I am going to have to purchase every year? I am intending to use HDRP in a game and can see I must purchase CTS 2019 to get HDRP support, which is fine. However, in a couple of months time am I going to have to purchase CTS 2020 to get support for Unity’s 2020 cycle? Thanks
     
    Ne0mega and Jesper-Nielsen like this.
  19. Jesper-Nielsen

    Jesper-Nielsen

    Joined:
    Nov 14, 2013
    Posts:
    51
    Releasing paid new versions is fine if it's not too often, but it might be worth it to give some sort of roadmap for how long you will continue to support the existing latest version.
    PS - are you planning to support the rename from LWRP to URP in 2019.3? And does the support for up to 16 textures in one pass also for LWRP / URP?
    PPS - does plugin play nice with terrain detail plugins, like this one: https://assetstore.unity.com/packages/tools/terrain/advanced-terrain-grass-100014
     
  20. mattSydney

    mattSydney

    Joined:
    Nov 10, 2011
    Posts:
    168
    Hi I have tried running CTS 2019 AND Unity version 2019.2.14F1 using iOS (iphone 6s). I have added a lite profile and the terrain is black. This is only on the mobile build, it looks fine in the editor. If I change the shader to "unity" it renders fine. Any tips on this please? Xcode report that the shader is unsupported. Does CTS work on mobile please?
     
  21. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,682
    In a short the answer is yes, we do intend to roll out upgrade pricing to all our products, on an annual basis, usually at around 20% of the normal asset price.

    These upgrades are aligned with the major Unity versions they support, e.g. CTS 2019 for Unity 2019, CTS 2020 for Unity 2020 etc.

    The exception to this is for new purchases. We will waive this upgrade fee for anyone who purchases the assets up to 3 months before the upgrade goes live.

    The reason we do this is because Unity and the different graphics pipelines change throughout the year, and we need to both update the products to handle this and provide support for them. With CTS in particular this is a massive amount of work.

    All money from the upgrades is fed back to the team to ensure that we can continue update, grow and support our products and customers.

    Yes & Yes (if Unity URP supports this - HDRP only supports 8 terrain textures).

    It should work fine. From memory you will need to make sure that the CTS profile is set to handle an IOS supported texture format. We enabled this in CTS specifically for IOS. You will need to rebake your textures after you have changed this.
     
    Jesper-Nielsen likes this.
  22. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
  23. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,393
    Is there an API that can be called, or a setting that can be enabled, to bake textures for the current profile when splatmaps are updated on all terrains outside CTS 2019?
     
    magique likes this.
  24. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    There is no official API, but you need to have a reference to the CTS profile, and then you could call
    CTSTerrainManager.Instance.BroadcastShaderSetup(<Your Profile Reference Here>);
    anywhere in your code. Note that this call would only be necessary if you are adding or removing terrain layers, if you are just updating the distribution of the splatmaps this should be instantly as long as the CTS profile is still connected.
     
    sstrong likes this.
  25. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,393
    Can we get the CTS Profile reference from the CompleteTerrainShader component attached to the terrains?
     
  26. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    yes, that would work fine, the component lists the currently active profile on the terrain.
     
    Mark_01, magique and sstrong like this.
  27. thomas-weltenbauer

    thomas-weltenbauer

    Joined:
    Oct 23, 2013
    Posts:
    58
    Hello CTS Team!

    We are using CTS for a project which will run on multiple platforms including PS4.
    Currently we get this error multiple times:


    Warning: Shader "CTS/HDRP/CTS Terrain Shader Advanced" will use scratch memory as not enough registers are available for the entire program, this could cause poor performance so consider simplifying the shader.


    I saw some guys had this problem a while ago and I just wanted to know if there is a solution for this.

    Best regards and thank you for you awesome work!
     
  28. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,393
    Thanks @PWPeter for the fast response - that worked well.
     
    PWPeter likes this.
  29. Enverex

    Enverex

    Joined:
    Jul 6, 2019
    Posts:
    21
    I'm working on a project that needs to be as small as possible, while obviously trying to retain as much visual quality as possible. Historically I've been using standard Unity terrain with crunched textures, this worked well and got sizes down without an obvious loss of quality in most situations.

    Unfortunately CTS falls down in this area - it has an option to use crunched formats for terrain, but it causes the terrain to go black (and CTS itself shows a warning that it likely won't work). This basically means that crunched textures aren't viable when using CTS, due to crunched textures not being addressable from ".asset" files, if the error messages are correct.

    Is there any way around this? Or any way to not have CTS use asset files at runtime? I'd love to use CTS, but without the ability to crunch textures, the resulting project size is simply too large.
     
  30. YashSinha11

    YashSinha11

    Joined:
    Aug 25, 2019
    Posts:
    5
    I and my friend are working on a Unity project. He bought CTS v1.9 as well as Gaia v1.8. We are following the tutuorials but when we are trying to add the NatureManufacturers CTS profile in our terrain, we are getting an error

    NullReferenceException: Object reference not set to an instance of an object.
    CTS.CompleteTerrainShader.TerrainNeedsTextureUpdate ()(at Assets/Procedural Worlds/CTS/Scripts/CompleteTerrainShader.cs:1539)

    I tried restarting unity and reloading the scene but up to no avail. Please help
     
  31. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Do you get this error on all platforms? Or only on some of them?

    @NatureManufacture Have you seen this error before in CTS and can you advise if this can be prevented somehow?
     
  32. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Currently there is no way around this unfortunately, the way the texture arrays are being created for CTS does not work with crunch compression being enabled.
     
  33. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    507
    Could you please tell me the exact CTS version you are using at the moment? (visible on the CTS component for example). Did you modify the CTS sources by any chance?

    I had a look at the error, but am having the issue that for me the line 1539 in CompleteTerrainShader.cs points to a line only containing a comment, which makes it difficult to me to find out what is going on. You could also double click on the error and post the line of code it sends you to here, I should be able to tell a bit more then.
     
    YashSinha11 likes this.
  34. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    248
    Hi

    This problem is recurring and ... quite desperate. I've already put it on other occasions, and it's still happening.

    I attached two images. The difference between the two is that I modified some simple values (smoothness, brightness) and when pressing BAKE TEXTURE the textures went from photo 1 to photo 2.

    It is a recurring mistake that I cannot avoid and, in all sincerity, is desperate. Every time I use CTS I panic.

    I use the latest version of CTS 2019 and the 2019.2.9f1 version of Unity.
    I DO NOT HAVE THE SEASONAL TINT option marked in CTS Weather Manager

    Thank you


    Thank you
    textures_well.png textures_chof.png
     
  35. YashSinha11

    YashSinha11

    Joined:
    Aug 25, 2019
    Posts:
    5
    I am using CTS version v1.9.0
    I haven't modified the CTS source. I am just using the NatureManufacturers default CTS profile available in Gaia v1.8.0.

    Do you want me to send you the whole script?It is huge. Like VERY VERY huge.
     
  36. YashSinha11

    YashSinha11

    Joined:
    Aug 25, 2019
    Posts:
    5
    Hey and thanks for the speedy response
     
  37. NatureManufacture

    NatureManufacture

    Joined:
    May 20, 2014
    Posts:
    1,754
    Try to change all half precisions into floats.
     
  38. YashSinha11

    YashSinha11

    Joined:
    Aug 25, 2019
    Posts:
    5
    Hey Peter
    Hey Peter!
    My problem has been resolved. In Gaia i just imported a random CTS profile available in GX tab of Gaia Manager. It worked but it didn't look too good so I decided to try the NatureManufacturers CTS profile once more, and it worked!
    Thankyou for all the help. I am new to Unity and will surely contact you for other doubts.
    I couldn't believe that people are so helpful over here. You actually responded to my question within 2 days!
    Once again thanks a ton
     
    PWPeter likes this.
  39. andrew210

    andrew210

    Joined:
    Apr 23, 2014
    Posts:
    169
    Hi all!

    I've been struggling with CTS the past few days, I'm using:

    • LWRP
    • 2019.2.16f1
    • All CTS Shaders are included in the build under graphics: Always included shader.
    • Current build target - Android
    With the standard unity shader, we're happily getting 60fps on low end mobile devices (I've done the easy optimization things like increase pixel error etc in the terrain).

    However I'm having a great deal of trouble getting CTS to work on mobile devices at all. When running on android, the game will either render the terrain very far from the camera, or no terrain at all. When it's attempting to render the terrain it will do so at around 3 or 4 fps even when only using the "lite" shader rather than the basic. So my hope is that I'm just doing some very wrong in configuring the project as it seems way off in what it should be doing. Are there any other reports of the strange rendering of terrain going on for anyone else / steps to remedy it? Or what would be the best information I could pass on to help in debugging this issue. On desktop versions and in editor CTS looks wonderful, I'm excited to see how well we can make it work on android too. Thank you
     
  40. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90


    So just adjusting smoothness, and brightness you dont have to bake the textures again, baking textures is only required when you switched out textures and add textures to the terrain. It a bit difficult to tell from the pictures that you sent, it seems like that you are adjusting the textures and then re-baking them. the textures on the terrain and the textures in the cts profile seem to not be the same which could be causing the issues, because they are not synchronized.
     
    Barritico likes this.
  41. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90


    Hello, I would try to disconnect the CTS profile before the game is built, this will help with optimization, and also insure that the correct shaders are in the build. I would also run the build in debug mode to see if you are getting any console errors. This link if for mobile optimization and compression this should help as well, you can set this up in the Cts Profile. https://docs.unity3d.com/Manual/class-TextureImporterOverride.html. Let me know if this helps, and you have any further questions!
     
  42. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    248

    Thanks for your reply.

    I generated the profile again. All good. In one of the textures I incorporated the HEIGHT and AO textures. I did the BAKE because that's how the system asked me to.

    Once done, all textures were ruined.

    I repeat my gratitude. But I had to change to another system.
     
  43. Jeryl

    Jeryl

    Joined:
    Sep 18, 2015
    Posts:
    15
    It is a fair policy in my opinion. Quick related question :
    I have CTS currently and don't plan on buying CTS 2019 for now since no projects I am working on requires it. Let's say I need CTS again in 2021. Will I be able to update CTS to CTS 2021 directly or will I need to upgrade to 2019, 2020 and 2021?
    If it is CTS to CTS 2021 directly, will it cost the same (20%) as a normal upgrade or more?
    Thanks.
     
  44. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90


    Shouldn't be an issue at all we will work with you in any way we can! When you or ready to do an upgrade and this is the case then please message me or tag me and we will look into this! You can also join our discord and when the time comes ask us then too please! https://discord.gg/rtKn8rw
     
  45. Swindger

    Swindger

    Joined:
    Mar 18, 2019
    Posts:
    3
    First: I am fairly new to CTS, Gaia and Unity3D at all, so consider ma as an absolutely Newbie in creating Worlds. And I hope this is the right place for this question, and not the Gaia thread.

    My problem: After using Gaia Pro for a while, recently I purcased CTS 2019 (with the Mega Bundle)

    Following the introduction tutorial for Gaia Pro I created a Scene with four small terrain tiles, after spawning a biome I added a CTS profile with the Gaia Manager. It looked great, but all the rocky parts went green, CTS had put a grass texture on them. So I thoungt, I try it again, and used the Gaia biome spawner again. Everything spawned, except of the textures, on three of the terrains nothing changed, but on one terrain the textures vanished, and went black. Grass and Trees etc. spawnd normaly, but no textures came back. Tinkered arrond with Gaia and CTS till nothing worked at all ...
    I repeated this on another project and on a third project on another computer. Everytime, after spawning textures on a scene where CTS is allready added, one of the four terrains went black.

    So: What did I do wrong? How can I remove an added CTS profile, so I can spawn textures with Gaia Pro again? Or is there something completely wrong in my workflow? ... and by the way, why do allways (on and unmodified Gaia Pro biome and an unchanged CTS profile) my montains go green?
    Or, at last, am I just to stupid to use those great assets?

    Happy Christmas and thank you very much for you help!
     
  46. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90




    Ok so yes you can delete the CTS profile, you need to disconnect the profile and then delete it. If you spawn in a different Biome and still using the CTS every time you change textures you need to re bake them. What I would do in your case is wait to use CTS until the project is complete or you have to repeat this process over and over again. To save on performance you can use CTS, change the profiles as you wish. After getting the outcome you desire, disconnect the profile it will save. When you need to add a texture simply reapply the CTS that you were using and then re bake. Then you repeat the process. Hope this helps!
     
  47. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    420
    After updating CTS 2019 from 1.9.1 to the last version my fps reduced to 27 fps (From 35 fps) :confused: What's the difference?
     
    Last edited: Dec 30, 2019
  48. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    985
    Any new features or is the maintenance going forward is just maintaining the hdrp and urp?
     
  49. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90

    Can you please provide more information so I may better help you.
     
  50. BryanPW

    BryanPW

    Joined:
    Apr 20, 2017
    Posts:
    90
    Currently we are working on more features, please stay tuned. You can find out more information by subscribing to our website and or looking at our discord!
    https://shop.procedural-worlds.com/ website
    https://discord.gg/rtKn8rw Discord
     
unityunity