Search Unity

  1. Unity 2019.2 is now released.
    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:
    436
    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:
    436
    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:
    520
    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:
    436
    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,316
    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,316
    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:
    13
    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:
    195
    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:
    436
    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:
    520
    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:
    436
    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:
    520
    Thanks Peter, any idea of an ETA, although I am working on optimization at present regardless. Thanks
     
    Last edited: Nov 16, 2019 at 3:05 PM
  14. PWPeter

    PWPeter

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

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    108
    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:
    436
    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:
    108
    Thanks, it was a memory problem, looks like it needs more than 8GB to import.