Search Unity

Relief Terrain Pack (RTP) v3 on AssetStore

Discussion in 'Assets and Asset Store' started by tomaszek, Oct 22, 2013.

  1. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi, snow is controlled by global shader variable. It's done with Shader.SetGlobalFloat() (look at ReliefTerrain.cs and ReliefTerrainGlobalSettingsHolder.cs). All of them will receive snow, no matter which parent they are assigned to. Terraing grouping (by placing them in different parents) allows for having separate instance of GlobalSettingsHolder (reliefTerrainInstance.globalSettingsHolder) which stores snow level. This means if you set snow level to some value at one group it would set snow level globally at all other groups. So, grouping gives you chance to configure terrains different way (different textures), but with snow. Using different snow levels at different terrains would cause interference. If you need to turn off snow for some instances:

    1. Set snow level at the same value for all terrains (in all groups)
    2. Set snow level per layer to 0 for terrains which you don't like to receive snow. Also - snow level cnotrolled by world y position (to have snow starting at certain height) works locally which means that you can remove snow from a terrain having very high snow height treshold.

    RTP uses scripting, but the way it does is only to manager terrain material. RTP works in deferred (with 8 layers use "8 layers mode" to render it in one pass).

    Tom
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    When you don't use tessellation - the terrain geometry you see is exactly what Physics engine use as an terrain collider. With tessellation it's not the case anymore. RTP takes height&normal texture to form mesh while terrain collider is separate thing. In my tess. YT video there is a button in tess. tab section that takes texture data (which is used for display) and adjusts height values for terrain. At this point they will match better. It doesn't means they will fit perfectly - it's impossible when we use bicubic filtering (collider works linearily). Try such workflow:

    1. Make terrain height data and grab height&normal texture (let's say 1k resolution)
    2. Configure RTP to use tessellation
    3. To have better colliding later, increase heightmap resolution in Unity terrain settings (to let's say 2k)
    4. Use "match terrain heightmap to tess texture data" button. Now your terrain data (used for collider) has better matching values.
    5. Make a copy of terrain data asset (we will need it in a moment)
    6. Reduce heightmap resolution of terrain to reduce CPU load (to 128 or 256) and use again "match terrain heightmap to tess texture data" button - it will prevent culling problems where terrain parts might disappear.

    With properly adjusted tessellation factors (RTP tessellation section in RTP global maps tab) your terrain should look detailed and smooth both upclose and far away and still work efficient. Now terrain looks fine, doesn't push CPU too much (and we still can increase pixel error), but reduced low-res height data used by Unity terrain collider doesn't match what we see on screen. So:

    7. Disable terrain collider (or remove it)
    8. Add terrain copy you made before and align with displayed terrain. Disable terrain draw for this object (we display terrain with RTP tessellation already). So - this "proxy" terrain acts as:
    - hi res collider (your objects shouldn't sink that deep now)
    - grass, detail, trees renderer

    RTP terrain using tess. is for displaying terrain surface itself.

    Tom
     
  3. pagnotmf

    pagnotmf

    Joined:
    May 20, 2016
    Posts:
    26
    Thanks for the reply. Does this mean you could remove the terrain manager after completion of terrain changes and changes would stay? Are all of RTP changes stored into Unity values such as global colormap?
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Don't remove. Still RTP setup some parameters that are not pure terrain material based.

    Tom
     
  5. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Hey!!

    I just updated to 5.4.1f1 and Im trying to use 8 layers in firts pass, So I had some weird error compilation in first pass (all pink), I tryed to delete my ReliefTerrain folder, download the latest version (3.3d) and try again, but its the same error :
    Shader error in 'Relief Pack/ReliefTerrain-FirstPass': maximum ps_4_0 sampler register index (16) exceeded at Assets/ReliefPack/Shaders/ReliefTerrain/RTP_Base.cginc(661) (on d3d11)

    Compiling Fragment program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF RTP_PM_SHADING
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    I tryed everything but its the same, I search for this error and it seems to be fixed on 5.4, this is any kind of regression?

    This is my LOD Manager configuration:
    rtp_configuration.jpg

    Its something wrong?
    Its working without 8 layers in first pass, So I though its a problem related to a maximum features so I removed glitter & animated droplets and it works again, but there was no error alert of maximum number of features
    its a bug of no alert of maximum number of features in the editor or its other kind of problem? Please, Can you explain it to me?

    Thanks in advance.
     
  6. joe_ftg

    joe_ftg

    Joined:
    Nov 9, 2015
    Posts:
    50
    I figured it out, I'd disabled the global colormap (ie passed null to the shader) but the shader still had RTP_HIDE_EDGE_HARD_CROSSPASS defined. As you suggest, DX9 must have resolved it in a different way that was less noticeable than DX11. Thanks for the help.
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    In every new Unity they introduce more and more lighting toys which consume texture resources... It's esp. critical in forward lighting (2 reflection cubemaps + new to Unity5.4 proxy texture3D which makes not much sense to light probe such a big object terrain is). With this RTP exceeds texture samplers limit (16). You would need to render in deferred (and remove forward variant using exclude_path:forward in #pragma surface line in RTP shaders). Or remove a feature like animated droplets. Then it should be fine to compile it.

    For newer targets (like DX11) it's possible to solve it by reusing sampler between similar textures. I think I need to introduce it in next RTP update because 16 sampler limit error gets nasty...

    With hard cross pass (no blend between layers 0-3 and 4-7) we can use global colormap. You disabled it so white color was used.

    Tom
     
  8. JustZht

    JustZht

    Joined:
    Apr 5, 2015
    Posts:
    16
    Hey,
    I have a question. If I turn on HDR & Tone mapping on Camera, with a scene only having a point light I found the terrain renders in black color. I have read the manual and unchecked the "No forward add" option on RTP_LODmanager.cs and this still happens, on Unity 5.4.0f3 / forward rendering / targeting iOS / RTP3.3d. Is this behavior normal? or I shouldn't use HDR this way. :(
    These are the screenshots : http://imgur.com/a/gvw5K
     
  9. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Apparently in HDR RTP outputs something wrong to the color buffer. Does it happen w/o tonemapping ? Does it happen only when we have no directional light ? Having no directional light is generally bad idea for RTP as it relies on such light direction in some places (might be esp. wrong in deferred). I'd advise to not go below 0.01 directional light strength. It's low enough to have "night" still base pass in forward is performed, point light is rendered on the top of this using "forward add" pass. So - you gain no performance turning off directional light completely (you should turn off shadow casting for this light though). Does it solve your problem with RTP ?

    Tom
     
  10. JustZht

    JustZht

    Joined:
    Apr 5, 2015
    Posts:
    16
    Terrain is not black without tonemapping and I guess unity itself will not use HDR if no image effects were enabled. And yes, it happen only with no directional light.
    I added a directional light with 0.01 strength and it solves the problem, thanks. :)
     
    hopeful likes this.
  11. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    There is an error with Unity 5.5 b3 and RTP,

     
    Last edited: Sep 25, 2016
  12. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm aware of it.

    http://forum.unity3d.com/threads/re...v3-on-assetstore.206516/page-105#post-2789315

    I'm going to catch with 5.5 when it's more "mature" beta. Core lighting files in Unity are subject to frequent changes between minor verions. I wouldn't be even able to follow beta cycle due to lag between submitting package and and its approval on Asset Store.

    For your other concerns. I realize that RTP in current state is not perfect tool in some aaplications (tessellation is meant to be used at the very end of your level production cycle to avoid redoing height&normal textures).

    It's always a dilema for me - how to invest my time resources. Should I improve RTP3 or work on new approaches for next major RTP releases ? Should I focus on fixing issues and feature requests or rather technical research ? More over this - should I spent more time with my child, or ... ? That's always tough to answer. That's why I'm often a bit temperate with my reaction to feature requests. Anyway, RTP is still under production and will be constantly maintained.

    Tom
     
    Crossway likes this.
  13. TLMultimedia

    TLMultimedia

    Joined:
    Feb 19, 2014
    Posts:
    61
    I'm trying to improve the general look of a coastal terrain with a certain amount of scientific accuracy.
    The snow feature could work as a great tool for dry coast rock lichen. I've experimented and it seems good so long as I disable frost. However I'd like a little more control over where it appears.
    • Is it possible to have both 'min height' and 'max height' for snow?
    • Alternatively can snow be set to be excluded with a mask or something?
    • OR can snow be excluded from specific layers or is it pretty much global and follows the basic rules for snow.
    See attached for a photograph of a real spot of rocks with lichen. Two colours (the light grey lichen and the orange one) would be perfect but one is better than none.
     

    Attached Files:

  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    There is a switch in RTP_Base.cginc with wetness mask routing to snow coverage. You can exclude snow on specific layers (it's set per layer when snow feature is present).

    Tom
     
  15. TLMultimedia

    TLMultimedia

    Joined:
    Feb 19, 2014
    Posts:
    61
    Ah yes. I don't think I will need the mask. Just one layer with same material but with/one without snow set 'on'.

    Thanks.
     
  16. skullofaplesiosaurus

    skullofaplesiosaurus

    Joined:
    Jun 16, 2014
    Posts:
    14
    Hi tom
    I've loaded 25 RAW height maps using Terrain Composer. However, after generating, I see no affect on my terrain. In this pic, the first 3 tiles are generated, but I see no detail on my surface

    http://i.imgur.com/G4qZV5H.png

    Any advice would be very helpful. Thank you.
     
  17. andersOutsiders

    andersOutsiders

    Joined:
    Oct 7, 2015
    Posts:
    2
    Hi,

    We are using Unity 5.4.0f3 and are now experiencing some strange behaviour with terrains. We have a relief terrain in one scene and on artists machine it works fine. however when anyone else syncs the terrain is either all white or all black.

    Pressing "Refresh all" makes the terrain appear again, there does not seem to be any building happening as this is instant. But "refresh all" and saving the scene does not flag the scene as modified. So I'm wondering what happens when Refresh All is pressed, somewhere it seems references to the textures are not resolved? Where is this data stored if not in the scene, and if I have a white terrain, press refresh all to make the terrain appear, how can I save these changes so that the terrain will work for the rest of our team?

    Any help greatly appreciated.

    Cheers
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Check tessellation in LOD manager - for tessellation you need to prepare height&normal textures for all terrain tiles. Refer to my tessellation video on YT. In future RTP releases I'd like to make this process more automatic.

    Everything should be stored in scene, but I'm not sure if it's automatically updated with version control solutions. I mean - your scene could have everything needed, but it's RTP script which initializes things for rendering:

    1. setup shader parameters stored in material
    2. setup global shader parameters (like snow level)

    Material assigned to terrain tile is scene object and I guess it might be lost. You can always make it an asset. Create a material (which will be version controlled), assign ReliefTerrain-FristPass.shader to it and use this material in Unity terrain settings (shader type set to Custom).

    The same for some textures they are done by script and saved with scene unless you save them explicitly to assets - look at Combined textures tab in RTP script inspector. Special perlin, atlases, combined normals and heights can be saved to assets which can be also version controlled. I hope this could solve your refreshing and synchronization issues.

    Tom
     
  19. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    You could even try to not utilize snow at all (which is additional feature thus it's not free for GPU). Prepare fine detail heightmap thich - due to heightblending - might pop out of underlying one with fractional coverage used. With full coverage we see only lichen, but when its coverage decreases it would start disapearring, but not like classical alpha blended, rather with separate lichen spots visible.

    Tom
     
  20. skullofaplesiosaurus

    skullofaplesiosaurus

    Joined:
    Jun 16, 2014
    Posts:
    14
    Thank you for your advice, however I'm having trouble understanding the tessellation video. These are my current settings in the LOD_Manager, but my terrain is now solid black.
    http://i.imgur.com/yYIvsK3.jpg
    I've also tried generating Splat maps and detailed textures, but nothing changes.
    If I have to use the "Prepare HeightNormal Texture for Tessellation" tool, how do i use it for multiple tile assets?
     
  21. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    First check what causes your terrain to be black. Turn off tessellation. With 8 layers and 2 passes (if you have 8 layers on your terrains) don't use "displace details". If youplan to displace details with tessellation use "8 layers mode". Your problem might be realted to lighting path - in deferred you're supposed to have script attached to main directional light (compare with my example scene). Also - having no directional light cause problems (you can set its strength to 0.01 value which won't affect performance adversely).

    For each tile of your terrain you need to preapre texture separately. Each tile is one terrain asset which is input for my tool.

    Tom
     
  22. TLMultimedia

    TLMultimedia

    Joined:
    Feb 19, 2014
    Posts:
    61
    I might give that a try. That said, I feel the snow results in a near ideal result. Is there an advantage for performance or other reasons to try the way you described here.
     
  23. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Basing on available RTP features simply try what works best for you.

    Tom
     
    TLMultimedia likes this.
  24. ReignOfDave

    ReignOfDave

    Joined:
    Oct 22, 2015
    Posts:
    51
    @tomaszek Why am i getting these weird dark spots when i use rtp. they only show up when i put a height map in the heightmap section of the script. (Looks fine with default material)


     
  25. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I guess they are related to detail AO which is approximated suing detail heightmap and normalmap. You can reduce it in RTP/Settings/Main - Approximated occlusion slider.

    Tom
     
  26. TZYalcin

    TZYalcin

    Joined:
    Nov 14, 2013
    Posts:
    10
    I couldn't find where to ask it, you have a 105 pages of forum now :) . I saw you mentioned RTP 4 in the asset store user reviews . Very exciting news. Do you have an approximate time for the release ? I will be very happy to hear any product you will release .
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm doing some research which goes quite optimistic about what can be done due to new features introduced in Unity. Unfortunately for time estimation - it's out of control for 1 person developement team like I'm here. Anyway I'm progressing.

    Even if RTP4 will bring new possibilities, still RTP3 is great solution for terrains.

    Tom
     
    Crossway, docsavage and TZYalcin like this.
  28. FalconCGN

    FalconCGN

    Joined:
    Jan 18, 2014
    Posts:
    33
    Hi,

    today a new error showed up:
    Shader error in 'Hidden/Relief Pack/ReliefTerrain-AddPass': maximum temp register index exceeded at Assets/ReliefPack/Shaders/ReliefTerrain/RTP_AddBase.cginc(4434) (on d3d9)

    Compiling Fragment program with DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP2 RTP_PM_SHADING
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    Shader error in 'Hidden/Relief Pack/ReliefTerrain-AddPass': Program 'frag_surf', error X4510: maximum number of samplers exceeded. ps_3_0 target can have a maximum of 16 samplers (on d3d9)

    Compiling Fragment program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP2 RTP_PM_SHADING
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    Shader error in 'Hidden/Relief Pack/ReliefTerrain-AddPass': maximum ps_4_0 sampler register index (16) exceeded at Assets/ReliefPack/Shaders/ReliefTerrain/RTP_AddBase.cginc(604) (on d3d11)

    Compiling Fragment program with DIRECTIONAL SHADOWS_SCREEN LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF FOG_EXP RTP_PM_SHADING
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING

    etc.

    Any idea, why this happens?

    We are currently loading about 16 terrain chunks at one time with color and normal map into memory...

    Regards,
    Sebastian
     
  29. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi,

    It's about exceeded number of texture resources in shader. You need to reduce some of them in add pass (like vertical texture for example). Try to disable lightmaps in LOD manager if you don't use them or use texture atlas (will save 3 textures).

    Tom
     
  30. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    So hard to search through stuff on the forums =o=
    I'm having everything past my basemap distance go super dark... I forget why/how to fix XD
    edit: I'm using the new patch for MapMagic.. I think it is conflicting with what RTP wants to set for basemap... if I just turn it off everything is super dark and needs 2-3 brightness which destroys the quality.
     
    Last edited: Oct 7, 2016
  31. FalconCGN

    FalconCGN

    Joined:
    Jan 18, 2014
    Posts:
    33
    Hi,

    vertical texture is not activated. Lightmaps are already disabled.

    upload_2016-10-7_20-31-18.png

    upload_2016-10-7_20-31-56.png

    Any other ideas?

    Another question: Would it make sense, to use Uber Shaders instead? Are there any performance issues with Uber for large multiplayer open world games?

    Regards
    Sebastian
     
  32. buronix

    buronix

    Joined:
    Dec 11, 2013
    Posts:
    111
    Hey!

    You can try to disable Glitter, Global Normal Map, Enable Holes Cut, Dynamic Snow. those consume each one a texture resource if I remembered correctly.
     
  33. KarloE

    KarloE

    Joined:
    Aug 26, 2013
    Posts:
    175
    I am using RTP3.2i.

    2 questions :

    1. is there any reason why self shadowing wouldnt work? I am varying the settings and nothing happens. Can it be disabled somewhere? What should I check?

    2. When I want to bake MIP gloss data for 1 layer, it wont work and it says:

    Code (CSharp):
    1. IndexOutOfRangeException: Array index is out of range.
    2. RTPGlossBaked.BakeGlossinessVsVariance (Single texelPosX, Single texelPosY, Int32 mipLevel, Single glossiness, UnityEngine.Color32[] NormalMap, Int32 nSize) (at Assets/ReliefPack/Scripts/Common/RTPGlossBaked.cs:300)
    3. RTPGlossBaked.PrepareMIPGlossMap (UnityEngine.Texture2D DiffuseSpecTexture, UnityEngine.Texture2D NormalMap, Single gloss_mult, Single gloss_shaping, Int32 layerNumForAtlas) (at Assets/ReliefPack/Scripts/Common/RTPGlossBaked.cs:249)
    4. ReliefTerrainEditor.OnInspectorGUI () (at Assets/ReliefPack/Editor/ReliefTerrain/ReliefTerrainEditor.cs:1060)
    5. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1231)
    6. UnityEditor.DockArea:OnGUI()
    7.  
    Any help?
     
  34. zmaxz

    zmaxz

    Joined:
    Sep 26, 2012
    Posts:
    143
    Hi !!
    How to fix this ?
    ( Rendering Path is Deferred. )
    RTP_Error.jpg
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Use4 8 layer mode (rendering terrain in one pass). 4+4 mode doesn't work well in deferred.

    Tom
     
  36. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    For addpass you probably need snow to be present. Normalmap is also desired option when you change sun position dynamically (we can't bake lighting in global colormap). Holes cut - turn it off when not used, but it doesn't consume texture. snow + glitter - yes. Try to use atlasing for add pass or turn off heightblending between passes (crosspass heightblending).

    UBER is meant to render suigle objects not terrain. We have currently 2 layers to be available on a surface and coverage is controlled via vertex colors which is not applicable on Unity terrains where coverage is controlled by texture (splat controlmap).

    I haven't inspected MapMagic integrtion, but indeed - RTP sets basemap distance internally and it should be left alone within any 3rd party that integrates with my package.

    Baking gloss data is something that got obsolete in RTP3.3 where we use Unity PBR lighting pipeline. It's now handled "natively" (users don't need to worry about it at all). You error might be related to situation when you bake something within terrain that layer count changed - i.e. you added/removed terrain layer in Unity after adding RTP compoenent. If you follow recommended workflow it shouldn't happen. I mean make terrain with 4 or 8 layers, add RTP, Then add missing detail textures and baking gloss should go fine. But as I said - this feature is now obsolete and I strongly recommend upgrading RTP to newest version.

    Tom
     
  37. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi Tom, I'm getting bug problems with the tessellation feature. My character runs through the floor when it enabled. I have followed your tutorial and pressed reapply height to terrain but it does not seem to help.
     
  38. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Reapply effectiveness depends on terrain collider heightmap resolution. When you've got high resolution heightmap on terrain and use reapply, then use this reapplied data only for terra collider it should be effective, although bicubic smoothing of terrain surface on hard edged / low res input terrain makes terrain smooth while collider is still linearily interpolated (hard edged). With too much of detail displacement it might also break (details are not taken into account under reapplying heights).

    For your characters to not sink you could split collider object and terrain drawing object into 2 and place collider gameobject a tiny bit higher.

    Tom
     
  39. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks Tom, when you say use the reapplied data just for the collider do you mean create a second copy of terrain with higher heightmap resolution and then use that for collider?

    You mention something similar at the end of the tessellation video regarding unity 5 but i did not quite understand what you meant. If you could link me to a explanation that would be very kind.

    Andy
     
  40. TechDeveloper

    TechDeveloper

    Joined:
    Sep 5, 2016
    Posts:
    75
    Hello Tom, sorry to bother you with this but I'm having trouble seeing the water.
    No matter how much I play around with the settings I cant see it. I know it works fine on you material supplied but when painting on the terrain I cant see the water level go high enough to see it. the stones do get shinny but now flowing water above.

    Any tips?

    Edit:
    Ok so I can see the water when I use blend plane with the water shader. However how do i save the runtime material values? there usually a way with standard materials but I dont see any options?

    also to be able to see the water is it only possible using blend planes?


    using Unity 5.4.2

    Thanks
     
    Last edited: Oct 14, 2016
  41. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    HI all, Just an update for Tom or anyone else using TC2 with RTP. The issue I am having with tessellation seems to go away when you remove TC2 from the scene.

    I am building with TC2 and then remove to work on the RTP settings at the moment until TC2 integrates better.
     
  42. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi @tomaszek I'm having problems with RTP version 3.3c in Unity 5.4.1, the problem is as follows:

    I have a terrain that uses 5 layers, I want to use a small amount of features, so I'm not using anything like droplets, snow, water, glitter or whatever, but I want to use tessellation to avoid tons of drawcalls to draw the terrain and also to get extra detail from detail heightmaps.

    the problem is that using 4 (firstPass) + 4 (addPass for the 5th layer) gives bad behaviour because the second pass is not tesselated and you can see like the tesselated version of the terrain mixed with the non tesselated one.

    also I have problems with image effects, I guess because some of them grabs wrong depths from the invisible second pass or whatever, I'm not that deep on shader knowledge.

    so I decided to use 8layers on single pass feature, but now the problem is that shaders don't compile and I get pink terrain, I had already research this problem, is because of max number of samplers (16) in shader and new unity versions using this almost useless LPPV that consumes samplers.

    Well but I'm using DX11 and deferred rendering, and practically no features that consume samplers, also disabled lightmaps feature (+3 samplers), so I should have enough samplers to compile the shader with the "Recompile for given set" button, still the shader doesn't compile, can you please give me a fix for this or help me?

    this is a picture of my config
    config.jpg


    and this is the error in the console:


    Shader error in '<multiple shader files>': maximum ps_5_0 sampler register index (16) exceeded at Assets/ReliefPack/Shaders/ReliefTerrain/RTP_Base.cginc(459) (on d3d11)

    Compiling Fragment program with DIRECTIONAL LIGHTMAP_OFF DYNAMICLIGHTMAP_OFF RTP_PM_SHADING
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING


    cheers
     
  43. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Maybe per layer options or global water options (RTP/Settings/water tab) keep things apart from displaying flowing water. We see flowing only when water is "deep". When water coverage factor computed in shader is low we can only see surface darken only, then changing specularity (surface covered by thin film of liquid), then we see flowing water.. It's approximately the same behaviour on blending plane and terrain itself.
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Use 4 or 8 layers. 5 layers costs almost the same as 8. In deferred you shouldn't use 4+4 (specularity blending doesn't go well with add passes). Errors could be related to addpass (which is not used). Is your terrain pink ? Then Unity indeed requests too much. Looking at your setup, it's weird though. Let's count it:

    RTP:
    1. 2 control maps
    2. 2 diffuse atlases
    3. 4 combined normalmaps
    4. 2 combined heightmaps
    5. 1 global color map
    6. 1 global height&normals texture (for tessellation)
    7. 1 perlin noise texture
    Gives 13

    Unity wants - forward
    1. 3 LPPV (useless for terrain, but it's not that simple to turn it off as it's declared/hardcoded in one of Unity cg header files - you could copy it from Unity site and comment out LPPV define, when you place modified cginc in the same folder as RTP shaders are, it will be used instead of Unity built-in ones).
    2. 1 shadow map
    3. 1 light cookie lookup texture (I'm not sure if it's still used, but was used quite recently)
    Gives 13 textures
    4. 2 blending reflection probes (blending) - in DX11 they reuse sampler (is 1 texture then)
    5. Up to 5 texture for lightmaps (depending on requested model 7 for baked+realtime direction specular GI), they are sampler reusing, so it solves

    Unity - deferred
    1. LPPV
    2. lightmaps

    But if Unity can't compile for forward, it can't compile shader at all ...
    You can try to add exclude_path:forward in all problematic shaders if you use deferred only. It should help. Sampler count will be 13+3 =16 then. If you can turn off LPPV via replacing cginc (look where it's declared - I can;'t remember out of my head now) you still have some room for features.

    Now better part. I believe that d3d9 platforms are minority ones nowadays. Still I will hold RTP3 for people that need to have broader compatibility, but things that are targeted DX10+ ("#pragma target 3.5") should also reuse samplers in RTP. I will introduce it in next RTP3.3 update Will try to manage it next week and submit to AssetStore. Then RTP would use like:

    1. 1 sampler for control map
    2. 1 sampler for diffuse atlas
    3. 1 sampler for normal maps
    4. 1 sampler for heightmaps

    Then such setup will take 7 samplers instead of 13. Sampler limit is 16, while texture limit is 128, so this won't be exceeded.

    Tom
     
  45. JeyDia

    JeyDia

    Joined:
    Feb 14, 2013
    Posts:
    100
    Hi @tomaszek

    Is it normal that my terrain disapear or that I can't paint the terrain ?

    I'm on 5.4.0 F3
     
  46. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    It's supposed to work fine. Maybe you're talking about tessellation ? This is the reason terrain could disappear, but you need to follow workflow presented in tessellation video on YT. When terrain uses tessellation height&normalmap you can't edit hegiths anymore.

    Otherwise - this exact moment I'm tweaking RTP3.3e for submission in U5.4.0f3 and it works.

    Tom
     
  47. TLMultimedia

    TLMultimedia

    Joined:
    Feb 19, 2014
    Posts:
    61
    Apologies if this has already been asked/answered..

    Is there a way to control the flow direction of the water shader? I have used the included flowmap but swapped only the normal/albedo maps for a sandy one to get a beach effect (height map of the rocky stones from demo works because it looks like sandy rocks). However the flow direction is 'sidewards'.

    This seems to be the case no matter how I rotate the plane/mesh so I assume its at the shader level?

    Thanks

    Tim
     
  48. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Generally it flows "downhill" basing on world normals of mesh. Flowmap variants use additional direction texture which is defined in tangent space - i.e. direction encoded in map is interpreted texture space basis. The only way would be eighter change uvs on mesh (can't be done on terrain - it's mapped in world space) or change texture values by some script and write it back to texture. When you read a pixel from texture the direction vector is:

    pixel.rg*2-1

    so (0.5, 0.5, n/u) RGB color on texture means no flow while (1, 0.5, n/u) means flow along u (positive) and no flow in texture space v.

    Tom
     
    TLMultimedia likes this.
  49. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    RTP3.3e has been submitted on AssetStore now. I made separate packages for U5.4 and U5.5 beta. Unity introduced a lot of changes there in rendering pipeline, but it was definitely worth managing for RTP, because one of the coolest U5.5 features is 32bit reversed floating point depth buffer. Goodbye geometry z-fighting and ugly jittering blocky shadows. Tested on terrain with shadow caster placed very far and it was superstable and quite OK resolution even with 2 cascades (which is great as we don't need necesarily to use 4 cascades - performance should go up for vertex intensive environments).

    Another thing is that I went patiently thru all 5000+ lines of shader code to replace standard texture fetches with tex/sampler couples. Simply saying compilation of RTP is not supposed to throw 16 sampler limit exceeded error anymore, even if we check every possible feature and configuration :).

    RTP3.3e delta changelog:

    - U5.5 compatibility (U5.5.0b6 minimum)
    - reusing texture samplers for most DX10+ platforms solves problem of "16 samplers limit exceeded" for good
    - option in LOD manager to exclude deferred path (terrain rendered always in forward)
    - fixed geom blend standard shader
    - fixed web gl build causing erros due to substance code present

    Should be available on AssetStore next days.

    Tom
     
    AndyNeoman, hippocoder, JBT27 and 4 others like this.
  50. TLMultimedia

    TLMultimedia

    Joined:
    Feb 19, 2014
    Posts:
    61
    Ah basically my terrain/ blended mesh are probably sloped slightly in the wrong direction then :D
    That, I can fix.