Search Unity

InTerra ~ Terrain Features

Discussion in 'Assets and Asset Store' started by IneffabilisArcanum, Jun 17, 2021.

  1. Lipoly

    Lipoly

    Joined:
    Feb 11, 2014
    Posts:
    42
    Hello, I was looking into this asset earlier this year for a project we're working on. I had to shelve the task for the time being, but now I'm back looking into it. I downloaded the latest version (1.3.0), and I am getting a shader compiler error:

    Shader error in 'Hidden/InTerra/InTerra-Base': invalid subscript 'fogCoord' at Assets/InTerra/Data/Shader/InTerra_Mixing.cginc(554) (on d3d11)

    Screenshot 2021-11-09 090441.jpg

    The compile error impacts the basemap rendering (seen here). I am using Unity 2020.3.19f1 and the built-in pipeline.

    To get around the error, I moved the definition of UNITY_FOG_COORDS outside the #ifndef TERRAIN_BASE_PASS (InTerra_InputsAndFunctions.cginc : line 26).

    That "fixes" the compiler error, but I don't know if it's actually working properly, or just suppressed the compile error.

    Screenshot 2021-11-09 085644.jpg


    FYI: The InTerra demo scene doesn't have the problem b/c that scene doesn't have Fog enabled...enabling Fog makes the issue appear there as well.
    Screenshot 2021-11-09 111631.jpg

    Thanks!
     
    Last edited: Nov 9, 2021
    IneffabilisArcanum likes this.
  2. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Thank you very much for mentioning it. Yes, your solution is correct. I’m just preparing for uploading 2.0.0 version, so it will be fixed there.
     
    Lipoly likes this.
  3. Lipoly

    Lipoly

    Joined:
    Feb 11, 2014
    Posts:
    42
    Thanks!

    Also, it doesn't appear that Triplanar Mapping impacts the basemap, which is similar to this comment about the Hide Tiling feature.

    Here is a demonstration. There are 3 parts to the video...
    1. Without any InTerra features on, the basemap is very similar to the splatmapped terrain, as it should be...just at a lower "resolution".
    2. With triplanar enabled, the basemap does not include the impacts of the triplanar mapping when generating the basemap, so they look very different.
    3. Enabling/disabling triplar mapping has no effect on the basemap.
    Ideally, the basemap generation would include everything the spatmap does, so the basemap is as close to the splatmap as possible. Does that seem doable?

    Thanks for all of your help
     
  4. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    This is actually on purpose... it is described in Documentation or Technical detail on Asset Store.
    "Triplanar features will be applied on Terrain Base map only if you do not have more than four Layers and you are using "First Layer Only" - otherwise the calculation would be too heavy and the Base map would become pointless."

    I tried to find some better solution for quite a while, but all are too heavy and at the best just very slightly lighter than not having the base map at all...
     
  5. Lipoly

    Lipoly

    Joined:
    Feb 11, 2014
    Posts:
    42
    Ok, thanks. I had assumed the basemap was generated a single time when the terrain is first displayed, and then just read from like a normal texture where the basemap is required. Is that not how it works? It needs to "generate" the basemap every frame?
     
  6. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Yes, the Base Map is generated single time and then is sampled once per frame (instead of sampling multiple times for each Terrain Layer texture), but if you are using the triplanar mapping you need to do the sampling also for the side and front and you cannot use the generated Base Map for it because the Base Map is basically the picture of how you see the Terrain from top-down and not from side or front...
     
    Last edited: Nov 10, 2021
  7. Lipoly

    Lipoly

    Joined:
    Feb 11, 2014
    Posts:
    42
    I guess I don't understand why you cannot bake the triplanar changes into the base map when it is generated. I would think you could then do a single basemap sample, and no-longer have to worry about whether the underlying textures were triplanar or not.

    For instance, here is a top-down orthographic view of a tall terrain feature, rendered with no triplanar/anti-tiling/etc.

    01_NoTriplanar.jpg

    It looks good from top-down, but from the side, the textures look stretched (as expected).

    02_NoTriplanar.jpg

    In the third image, we have a top-down ortho view of the same terrain feature, except it has triplanar applied. This time, it looks kinda weird from directly top-down...

    03_Triplanar.jpg

    ...but, when it is stretched vertically down, it looks good.

    04_Triplanar.jpg

    My question is that when generating the base map, why can we not do the expensive triplanar samples then, and store the resulting pixel color in the base map for that location (so that the base map looks similar to image 3). That way you can do a single texture sample into the base map, and have it look pretty decent.

    I understand it won't look as good as full multi-sample triplanar would look, but that's ok for a base map.
     
  8. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    I was thinking about that too, but then what about some perpendicular cliffs? :)
     
    Last edited: Nov 10, 2021
  9. Lipoly

    Lipoly

    Joined:
    Feb 11, 2014
    Posts:
    42
    Valid question. I think it's safe to say that nearly perfectly vertical terrain sections are always going to look bad with a basemap. However, the biggest issue with using basemaps is not actually them looking low quality/resolution. After all, we have options to combat poor quality by cranking up the basemap resolution, or adjusting the distance. The biggest problem (imo) is if a basemap changes color when transitioning between it and the spaltmap. If the splatmap has a "green star" in a particular area, then it ideally shouldn't change to a "red box" when the basemap transitions in. When the basemap doesn't take triplanar into account, color/shape changes are much more likely to occur. The resulting texture may end up looking just as poor as it would've otherwise, but it will still look better b/c the colors match.

    In the end (like you mentioned earlier), the whole point of the basemap feature is for performance reasons, so I think it's pretty important that the basemap shader only do one sample per pixel. Imo, we want the basemap to look as good as possible as long as it doesn't come at the expense of performance.

    Thanks for all the prompt answers
     
  10. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Well, on the very height and steep slopes the color changes would be here anyway if there would be only top-dow mapping... but maybe I will try it some day....
     
  11. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    By the way, the 2.0.0 version with URP support is already waiting for Unity Asset Store approval...
     
    FlaimSystems likes this.
  12. FlaimSystems

    FlaimSystems

    Joined:
    Sep 15, 2021
    Posts:
    2
    Nice one! HDRP soon after?
     
    Ryan-Hayle likes this.
  13. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    HDRP would take more time, I'm now working on adding parallax occlusion and considering a few other things... after that, if I will have more time, I could do HDRP next year...
     
  14. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Update 2.0.0 is finally available!
     
    Last edited: Nov 17, 2021
  15. PeterBalso

    PeterBalso

    Joined:
    Oct 23, 2021
    Posts:
    7
    This looks great, I'm really impressed! I was wondering, does the shader you're using for terrain blending rely on the underlying terrain using your terrain shader? Would it work with other shaders (specifically MicroSplat)?

    I'm pretty invested in MicroSplat for my actual terrain, but feel a little limited by MS's terrain blending, and am thinking of using this in its place.

    Would also be interested to hear a little more about performance. Does this shader work with the SRP batcher? Does it require drawing the object twice (as MicroSplat's mesh blending does)?
     
  16. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    It would not work with MicroSplat terrain properly... in built-in the blending also works with the Unity Terrain Standard or Diffuse shader, but MicroSplat is different for sure...

    SRP batcher works just like for Lit shader and there is only one draw - the shader for objects blending just samples also the Terrain Layers textures and you can choose the Layer or two specifically to avoid not necessary sampling. The basic stats did not show much difference between Lit shader and InTerra blending shader, but I want to look into URP profiling a little more as it was originally designed for built-in.
     
  17. Radivarig

    Radivarig

    Joined:
    May 15, 2013
    Posts:
    121
    It would be amazing if you could look into supporting MicroSplat!
     
  18. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    Would it be any quicker if you could create just the integration of Objects shader for HDRP, rather than any terrain shader, as that is the reason for buying the asset?
     
  19. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Well, I’m very afraid it would be too complicated.
     
  20. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    It would be for sure quicker…I'm actually thinking about creating a smaller/cheaper Asset only for the Object blending that could be also for the HDRP, but still, I doubt it will be sooner than in the first quarter of next year…
     
  21. Ryan-Hayle

    Ryan-Hayle

    Joined:
    Feb 16, 2014
    Posts:
    142
    "The folders in version for Unity 2021.2.0f1 were rearranged so you can deselect the Built-in or URP folder before the import if you don't need it."

    There is no URP folder in the latest release?
     
  22. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    There is, but now I noticed one unfortunate thing. To be sure everything is ok, I tried to download and import it and as there are two version, one from 2019.3 and the other 2021.2, Unity downloaded the package depending on your current project version, but once it is downloaded and you want to import into another version project, it do not download the needed version and instead it is importing the downloaded one, so if you were first downloaded it for the older version than 2021.2 then it is needed in the Package Manager to Update the package (there should be a button for it), but sadly, once it is updated, the import for the 2019.3 will not be ok as there doesn't seem to be the possibility to switch to the previous version package and the only way how to have the package for older version is to delete the package in C:\Users\accountName\AppData\Roaming\Unity\Asset Store-5.x and download it again in needed version project.
     
  23. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    By the way, InTerra is now on New Year Sale, 50% off :)
     
  24. FlaimSystems

    FlaimSystems

    Joined:
    Sep 15, 2021
    Posts:
    2
    I'll pay 500% on if I can get a sneaky HDRP version
     
  25. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    What is the latest 2021 URP version this works on? Tried on latest 2021 and got pink but could be user error as I never tried this asset before.
     
  26. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    It should work from 2021.2.0f1, but I did not try the latest yet, so I'm downloading it now to test it.
    Did you set the Shader Variant Limit (in Edit/Preferences/Shader Graph) to at least to 576?
     
    Last edited: Dec 25, 2021
  27. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Yes - I set it to 600. I am going to try in older 2021.2.3f1 instead of 2021.2.7f1 and see if it works

    Failed: will install and try on Unity 2021.2.0f1
     
    Last edited: Dec 25, 2021
  28. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Ok, I'm gonna test the latest 2021 to see if there are some problems...
     
  29. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Thanks - Its working fine in Unity 2021.2.0f1
     
  30. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Thanks for letting me know..... I found the problem. I'm really sorry, I did not have much time to test the new versions lately.... and as I was used to mainly working with Build-in I underestimated how quickly things can change....

    I will upload the update today, but not sure when the Unity store will approve it. It usually takes from one to three business days... but who knows how they have the business days now.

    If you want to quickly make it work for the newer versions by yourself, then just find the shader file InTerra/URP/Shaders/InTerra_TerrainLit and change the line 62 to

    PackageRequirements { "com.unity.render-pipelines.universal":"[12.1,12.2.0]" }

    If you want also the Terrain Base map to work, the same needs to be done in files
    InTerra_TerrainLitBase (line 21)
    InTerra_TerrainLitBasemapGen (line 53)

    And if you are using more than four Terrain Layers, then also in the file InTerra_TerrainLitAdd, line 56
     
  31. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    196
    Thanks for looking into it so quickly. Really nice blending.
     
    IneffabilisArcanum likes this.
  32. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    No problem, I'm just surprised nobody (including me) noticed it sooner...
    I just uploaded the updated version, so I hope next week it will be available on the Asset Store.
    And thanks, I'm glad you like it.
     
    Last edited: Dec 25, 2021
  33. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Sorry for the late reply, I was thinking about it and it actually would be nice if someone would try it before the official release, I don't think paying so much more is necessary, but I would appreciate some feedback... so, as soon as I will have some usable version, I will PM you and maybe we can make some deal :)
     
  34. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    The update 2.0.2 is available, so everything should be ok in newer URP versions.
     
  35. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    I already bought it, but I'd gladly sign up for this too if you're looking for more!
     
  36. TropicalVoxel

    TropicalVoxel

    Joined:
    Mar 26, 2021
    Posts:
    5
    Hey I'm getting the pink glitch- I'm using Unity 2021.2.2f1, and my shader limit is at 576. Should I just upgrade to a newer version?

    upload_2021-12-31_11-34-55.png
     
  37. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Yes, definitely try to update to the latest version.

    EDIT: It is also better when you are importing into URP to uncheck the folder Built-in.
    I just tried to test InTerra 2.0.2 on a different PC and everything seems to work fine, but InTerra 2.0.1 works just up to 2021.2.1f1.
     
    Last edited: Jan 1, 2022
  38. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Nice, thank you for purchasing! ... I will let you know then, but before I will start working on HDRP I want to do the Parallax occlusion mapping update first.
     
  39. bvonline

    bvonline

    Joined:
    Feb 27, 2021
    Posts:
    85
    I am not into that technical thing. I am interested in the asset. My question is:

    Can I use InTerra together with "Better Lit Shader"? Or doesn't that make sense at all...? Is it possible to combine these both - or if not, then why?
     
  40. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    If you would want the Better Lit Shader to blend with the Terrain it would not work, there are lots of calculations for the Object and Terrain that have to match to make it seamless and so the Object is using a specific shader…
     
  41. Arkorim

    Arkorim

    Joined:
    Jan 22, 2014
    Posts:
    11
    Hi! I still have the pink material problem, in the Object Into Terrain Integration shader:

    1- created a new project with the Unity URP template, version 2021.2.4f1.
    2- downloaded InTerra 2.0.2, imported unchecking Built In folder.
    3- opened the DemoScene URP, the stones with that shader Object Into Terrain Integration are pink.

    What can I do to fix this? Thanks! :)
     
  42. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109

    Did you set the Shader Variant Limit (in Edit/Preferences/Shader Graph) to at least to 576? ...and if yes, is it showing any errors?
     
  43. Arkorim

    Arkorim

    Joined:
    Jan 22, 2014
    Posts:
    11
    Hi, yes Shader Variant Limit set to 600. I'm getting this error:

    Shader error in 'InTerra/URP/Terrain (Lit with Features)': undeclared identifier '_SplatUV0' at Assets/InTerra/URP/Shaders/InTerra_Functions.hlsl(430) (on d3d11)

    Compiling Fragment program with _NORMALMAP _TERRAIN_NORMAL_IN_MASK
    Platform defines: SHADER_API_DESKTOP UNITY_ENABLE_DETAIL_NORMALMAP UNITY_ENABLE_REFLECTION_BUFFERS UNITY_LIGHTMAP_FULL_HDR UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BLENDING UNITY_SPECCUBE_BOX_PROJECTION UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS
    Disabled keywords: INSTANCING_ON SHADER_API_GLES30 UNITY_ASTC_NORMALMAP_ENCODING UNITY_COLORSPACE_GAMMA UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_DXT5nm UNITY_NO_FULL_STANDARD_SHADER UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_UNIFIED_SHADER_PRECISION_MODEL UNITY_VIRTUAL_TEXTURING _ALPHATEST_ON

    Also, when going to Object into Terrain Integration file, I get another error, as seen in the attached image.
     

    Attached Files:

  44. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Unfortunately, I'm unable to reproduce the error right now and everything seems to work with 2021.2.4f1... for now you might just try to right click the URP/Shaders folder and click on Reimport, or try a different Unity version... I will look into it more during the day, I'm really sorry for the problems.
     
    Last edited: Jan 14, 2022
  45. Arkorim

    Arkorim

    Joined:
    Jan 22, 2014
    Posts:
    11
    Reimporting URP/Shaders did the trick, thanks a lot!
     
  46. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    You’re welcome! I'm really happy it worked :)
     
  47. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    106
    Hello,

    does InTerra work in VR SPS?
     
  48. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Hi,
    I do not have the possibility to test it right now, but I would say there should not be any problem... although I cannot be sure... maybe the parallax occlusion mapping (which will be added in the next update) will not work properly, but the parallax would be probably too heavy for VR anyway...
     
    DrInternet likes this.
  49. Quique-Martinez

    Quique-Martinez

    Joined:
    Oct 1, 2013
    Posts:
    141
    Hi, my project is taking one hour to compile shader variants labelled as "in terra". Is there any hint to avoid this? I'm not an expert on shaders.

    Thanks
     
  50. IneffabilisArcanum

    IneffabilisArcanum

    Joined:
    Jun 1, 2020
    Posts:
    109
    Hi,
    So I guess you are using URP?
    Because in Built-In it is far quicker… but either way, it takes far longer for the first time, so if you do not change anything in shaders, it should take less time afterwards.

    The thing is that in shader code it is best for performance to avoid branching and therefore there are the Keywords which you can use and instead of code with branch, two separate shader variants are generated… but with each Keyword the number of variants is multiplying…
    If it is still a problem for you, then you can PM me, it is possible that you do not need all the Keywords, for example the “_NORMALMAP” Keyword can be deleted or defined depending on whether you are using normalmap textures or not.