Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CTS - Complete Terrain Shader - Deprecated

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

  1. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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
     
  2. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    486
    Great suggestion for future. Thanks.
     
  3. Clyde_Coulter

    Clyde_Coulter

    Joined:
    Jul 14, 2014
    Posts:
    58
    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"?
     
  4. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
  5. 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)
     
  6. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  7. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
  8. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437

    Fantastic, thanks Peter. I've been looking forward to upgraded HDRP version support with CTS for awhile! :)
     
    PWPeter likes this.
  9. 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
     
  10. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  11. 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 :)
     
  12. jebediahh

    jebediahh

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

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  14. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    177
    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
  15. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
  16. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    177
    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
     
  17. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  18. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    177
    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
  19. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
  20. ArtisticSliz

    ArtisticSliz

    Joined:
    Jan 4, 2014
    Posts:
    40
    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.
     
  21. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  22. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    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?
     
  23. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.
     
  24. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    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:

  25. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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
     
    PrimusThe3rd and JBR-games like this.
  26. Deleted User

    Deleted User

    Guest

    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 :-(

     
  27. PrimusThe3rd

    PrimusThe3rd

    Joined:
    Jul 3, 2017
    Posts:
    69
    Hi,
    Yeah it happens to be a Noise power setting.. set to 0 solved the problem. Thanks. Color is indeed not white... probably something has to be done with a lighting settings.. :)
     
  28. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    I had a look at the CTS normals in CTS version 1.9.1 in Unity 2017.4.32 and did not find they come out black at reasonable normal values, I took some screenshots:

    For the test I took the Texture T_Ground_Sand_02_A_Sm and the related normal map T_Ground_Sand_02_N, which both come with CTS. I created a new blank terrain, added a cube so that there is some shadow as well and added this texture on the terrain in the unity shader:

    CTS01.PNG

    So far, so good. I turned this texture into a CTS profile via
    Window > Procedural Worlds > CTS > Add CTS to Terrains
    Window > Procedural Worlds > CTS > Create and apply profile.

    Then I adjusted the normal map power on the single sand texture:

    Normal Power = 0 comes out very flat (as expected):

    CTS02.PNG

    Normal Power = 1, almost a bit too tame for my taste:

    CTS03.PNG

    Normal Power = 2, getting in the area of "maybe a bit too much", but still not "all black":

    CTS04.PNG

    Normal Power = 3 too much for my taste, buts still not all black

    CTS05.PNG

    It then goes on gradually to become darker more and more until normal power = 10, where it then is justified to say it is all black then, but I think the area around 0-3 is enoght room for a reasonable normal setup.

    Could you please try to perform the same experiment with the same texture to see if you get the same results? I can tell from your supplied screenshot that you are not exactly a beginner ;), so I think there might be something wrong in the textures, CTS, or Unity that gives you bad results with your normals.
     
    AdamGoodrich likes this.
  29. Deleted User

    Deleted User

    Guest

    Followed your steps...and you were right, my settings were off....and I probably had to much contrast in beautify Camera FX.
    Thanks for the refresher!.

    p-

    Now were talking!! Normals that look (almost) like tessellation.






    Converted to LOD mesh Terrains, all under 100 Batch Calls.
    still just naked terrain...has to run fast , before I populate with more 'stuff'

     
    Last edited by a moderator: Oct 11, 2019
    AdamGoodrich and Bartolomeus755 like this.
  30. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
  31. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Well.. more than 4 textures it dropped from 120fps to 86fps in stand-alone.exe. This is unacceptable. What should I do then? I want to use 8 textures in my game
     
    Last edited: Sep 17, 2019
  32. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    I requested specific information from you in my last reply, could you please compare the performance across the different shader types in the swamp or landscape demo scene? Could you please run the profiler to compare unity vs CTS shading to find out which position creates the difference that results in the FPS drop?
    In your original post you stated the difference in FPS would be tied to comparing the built-in Unity shader vs. CTS, now you switched to the number of textures being the deciding factor. Could you please clarify which one it is?
     
  33. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Unity
     

    Attached Files:

  34. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    CTS
     

    Attached Files:

  35. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    What is your gmail, bro?
     
    matidzeramz likes this.
  36. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    support@proceduralworlds.freshdesk.com

    Looking at the FPS counters in the screenshots you provided, it does not look like you have the same problem in the demo scenes as in the scene where you originally encountered it. It would therefore be good to analyze what creates the performance difference in your original scene with the profiler.
     
  37. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    Hi, when I added the HDRenderPipelineAsset to the Scriptable Render Pipeline Settings under graphics settings, CTS told me it needed to update shaders. I clicked okay and did that, but then everything disappeared...

    I saw on your website that maybe a fix was to disable Draw Instanced under terrain settings, but that doesn't seem to do anything. Any other ideas?

    Edit: Unity version 2018.4.9

    Code (CSharp):
    1. Shader error in 'CTS/HDRP/CTS Terrain Shader Advanced LOD': 'GetNormalWS': no matching 3 parameter function at line 626 (on d3d11)
    2.  
    3. Compiling Vertex program
    4. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    5.  
    6.  
    7. Shader error in 'CTS/HDRP/CTS Terrain Shader Advanced': 'GetNormalWS': no matching 3 parameter function at line 829 (on d3d11)
    8.  
    9. Compiling Vertex program
    10. Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    11.  
    Edit #2: Nevermind, forget HDRP... It's too new and nothing works.
     
    Last edited: Sep 21, 2019
  38. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    Hi, which HDRP version did you install? In 2018.4 you would need to use HDRP version 4.8 for CTS to function, the error messages you were seeing look like you maybe used a different version.

    HDRP is still new and difficult to support, especially because even minor versions can not be compatible with each other, this is also why a lot of asset store assets are not compatible with it yet.
     
  39. Tarball

    Tarball

    Joined:
    Oct 16, 2016
    Posts:
    166
    2018.4.9 defaults to HDRP 4.10 now. I just installed it while upgrading a project.

    Yeah, I could get most things to work, eventually, but it was really too much trouble and felt like an uphill battle. I can see the potential there though for the future. Or, if I were starting something brand new.
     
  40. ArtisticSliz

    ArtisticSliz

    Joined:
    Jan 4, 2014
    Posts:
    40
    Hey, thanks, Peter! Glad to hear. I've often found the creator of the Lux suite, Lars, to be super helpful and very knowledgeable, if a little grumpy. lol He should be able to provide useful feedback. Honestly, I'd love to see some collaborative work from you, as you're all excellent programmers.

    Thanks, so much.
     
  41. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    100
    do this support LWRP?? i cant upgrade my materials ....and all my terrain is pink
    CTS2019Material material was not upgraded. There's no upgrader to convert CTS/CTS Terrain Shader Basic shader to selected pipeline
     
  42. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    CTS supports LWRP both instanced and non instanced in LWRP versions 4.8, 5.7, 6.9. Which Unity version and LWRP version are you using?
    In general you should be prompted with a popup that states your shaders are not fitting for the selected pipeline when you switch to LWRP, and it should ask you to run the shader installation from the Windows > Procedural Worlds > CTS menu. Could you please try to run the installation from there? There should be a check beforehand that tells you if CTS thinks it has the correct shaders for the rendering pipeline or not, and if not, will offer you to start the installation.
     
  43. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    wrong error report. deleted.
     
    Last edited: Sep 27, 2019
  44. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Hi, I am not sure where along the workflow this issue is occurring so thought I would begin by asking in this forum.

    The terrain tile textures are not aligning after generating splat maps.
    I am using Unity 2019.2, CTS (not upgraded to 2019) and VSPro and so changes in VSPro should be reflected in the CTS textures but I am getting the issue as below image clearly shows.

    Any ideas how to fix this? Thanks.

    2019-09-28.png

    Also if I upgrade to CTS 2019 will I have to completely remove current CTS version? and start setting up again?

    Thanks.
     
  45. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    The first thing you could check is: Do both terrains have the same textures in the same order on them, and do both textures utilize the same CTS profile? I could imagine that there is some kind of mixup happening, where there is one texture missing on the terrain, or the order of the textures is different.

    If both the profile and the order of textures is the same on both terrains, the next question would be which tool are you using to spawn the textures? I assume it is VsPro, you would then need to check why for some reason the splatmaps are not aligned across the terrains. I'm no expert on how VsPro does the texturing, but I could imagine that if there is noise (Perlin, etc.) involved and the noise is being calculated in terrain space only, this could lead to textures not aligning correctly at the borders.

    Are you running a CTS version that is already in installed in the
    Assets\Procedural Worlds\CTS
    folder? In that case you can just install over it, and you should be able to continue in CTS 2019 after If you are still using an older version that installs to
    Assets\CTS
    then it is recommended to delete the old CTS folder and do a new installation, however you can store your custom made profiles away in a different folder and continue to use them in CTS 2019.

    In both cases please make a backup of your project first to make sure you don't lose anything when upgrading.
     
    Hawk0077 likes this.
  46. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Thanks You Peter, I will look into this. Cheers.

    I checked and all textures are in same order and same profile on each terrain.
    I have posted in VSPro forum so waiting for Lennart.
    I will most likely update CTS after I solve the problem.
     
    Last edited: Sep 30, 2019
  47. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    1,647
    Was wondering if Procedural Worlds had a way of getting the visible terrain texture at a world position?
    I'm having a really hard time figuring out how to do it. Tried using a few scripts I found online with no success yet.
     
  48. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    Hi, I set CTS up and had minimal normals close and far but now the terrain mountains seem to have gone much darker in the places the normals were set. See image, when I first applied the normals there wasn't this much dark added to the textures. IS this a some kind of bug?

    Also, in play mode the textures flash as if z-fighting. Are there setting ssomewhere that could posibbly el;iminate this flashing of terrain textures?

    Thanks, much appreciated for any ideas to solve the issues.

    cts.PNG

    I sorted the flashing it was the near clipping plane
     
    Last edited: Oct 7, 2019
  49. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Hello,

    I am using: HDRP 6.9.0 with Unity version 2019.2.6f1.

    I was trying to use multiple directional lights in my scene (I currently have 3). Everything was working fine, but when I enable "Light Layers" in my HD Renderpipeline Asset (the one you plug into your graphics settings), the terrain starts flickering (like between shadowed and not shadowed or something similar). It flickers between dark and light.

    For example, I assign my main directionaI light to "Light Layer Default" on it's light layer. Then I assigned my two other directional lights to both be on "Light Layer 1" as their light layers. Then, assign my cloud particles/gameobjects to "Light Layer 1" on their renderers. Everything else I leave on "Light Layer Default". But the CTS terrain flickers the most. I don't see an option on the terrains to set the light layers for them, so I'm not sure how to even test that.

    What might cause this flickering? Or how can I assign the terrain to a specific light layer in HDRP? It seems to happen the most on the CTS terrain. Thanks for any help.
     
  50. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    555
    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.