Search Unity

Relief Terrain Pack (RTP) v3 on AssetStore

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

  1. tryptic

    tryptic

    Joined:
    Nov 13, 2012
    Posts:
    55
    Thanks very much for the quick reply! This was definitely the root of many issues here, after setting everything to Linear the shading appears to be stable. Fwiw, when these files are overwritten, the sRGB flag reverts and needs to be unchecked again.

    I will look into the custom material and let you know how that goes.

    Cheers, -Heinz
     
  2. Darkmonk

    Darkmonk

    Joined:
    Nov 3, 2010
    Posts:
    50
    Hi, thanks for looking into this for me.
    I could not replicate this in a new clean project so i did a clean reinstall of RTP in my main project, cleared the cache and rebaked the lighting and it seems to be working now :)

    I had noticed a few other problems in my project and i believe its because i have been using the Unity cloud storage and apparently there is a bug where if you restore your previously saved version sometimes it syncs an older file back to you and thinks its the newest file, this is really bad from unity but i think this is whats caused the issue as i have had a few other problems with scripts not working etc..
    So I dont think RTP was at fault which is good :)
     
  3. YHS

    YHS

    Joined:
    Aug 10, 2014
    Posts:
    31
    Hi there, I'd like to know if this support Unity2017? Thanks a lot.
     
  4. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Tested and it works (anyway it shows correctly the terrain) - there might be always some minor inconsistecies which I can fix, but it doesn't break the whole concept.

    Tom
     
  5. Darkmonk

    Darkmonk

    Joined:
    Nov 3, 2010
    Posts:
    50
    unfortunatly this error seems to have returned. after i did a clean install it worked perfectly, however I have now baked the GI for a second time after adding some new objects to my scene and now it is only showing the lighting in the corner again :( I did get a couple of error messages though that look like they are from enlighten.

    Assertion failed on expression: 'terrainInstanceHashes.find(instances.instanceID) != terrainInstanceHashes.end()'

    Assertion failed on expression: 'si.atlasOffsetX > systemInfo.atlasOffsetX || si.atlasOffsetY > systemInfo.atlasOffsetY'

    does this sound like an RTP issue or do you think its just an issue with unity ?

    im going to try another re-install and bake to see if it works again.
     
  6. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862

    What RTP does in terms of dealing with lightmaps/atlases is to get underlying terrain lightmap props for geom blend objects, but I'd rather expect above errors are Unity ones (looks like Unity attempts to identify internal terrain "meshses" for GI evaluation).

    Tom
     
  7. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Hi tomaszek,
    is it possible to import a mesh for geometry blending that has its Alpha opacity already set via Vertex Colors (coming from Maya)?
    It seems like RTP only respects RGB channels and overrides the Alpha channel when I add the Geometry Blend component to it. Is this the case?
     
  8. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Hi Marco - you're right. Geom blend uses vertex color alpha channel for blending with underlying geometry.

    Tom
     
  9. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    The alpha values I've set inside Maya are the ones I would like to use in RTP for blending. Is there a way to keep these values?

    Or could you name the lines of code I would need to change to keep my alpha?

    Edit: It looks like I can get what I want if I comment the ClearBlend() call in your MakeMeshCopy() method.
    Initially this results in a wrong RTP_blend_underlying mesh. But as soon as I press the "Stick To Blended Object along normals" button the issue resolves itself.
    I can live with that. A feature update to copy the vertex colors (including alpha channel) from the original mesh would be nice though - supposing that the original mesh and the copy share the same topology.
     
    Last edited: Jul 18, 2017
    tomaszek likes this.
  10. Dwight_P

    Dwight_P

    Joined:
    Feb 26, 2013
    Posts:
    42
    I am having a small issue after updating to 2017.1. For some reason I keep getting errors like this:

    Code (csharp):
    1. Can't access alphamapTexture directly...
    2. UnityEngine.Debug:LogError(Object)
    3. ReliefTerrain:GetControlMaps() (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:371)
    4. ReliefTerrain:RefreshTextures(Material, Boolean) (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:273)
    5. ReliefTerrainEditor:OnEnable() (at Assets/ReliefPack/Editor/ReliefTerrain/ReliefTerrainEditor.cs:74)
    6.  
    Code (csharp):
    1. Can't access alphamapTexture directly...
    2. UnityEngine.Debug:LogError(Object)
    3. ReliefTerrain:GetControlMaps() (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:371)
    4. ReliefTerrain:RefreshTextures(Material, Boolean) (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:273)
    5. ReliefTerrainEditor:OnDisable() (at Assets/ReliefPack/Editor/ReliefTerrain/ReliefTerrainEditor.cs:104)
    6.  
     
  11. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Check the issue against the RTP3.3h. It might help.

    Tom
     
  12. Dwight_P

    Dwight_P

    Joined:
    Feb 26, 2013
    Posts:
    42
    That was the first thing I had tried. I tried to redownload and reimport everything. The only think I've not tried is a full wipe of everything. That would reset all of the settings and am hoping is a last resort. I guess I can make a duplicate project, do a full delete and import. If that helps, any tips to prevent the settings from resetting?

    Edit: I had to do a clean import. When prompted if I would like to update the despricated programming automatically, I hit no. I then recompiled the shaders, and it is working perfectly fine now. I think I originally said to convert the code automatically, and it probably broke things.
     
    Last edited: Jul 22, 2017
  13. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Hi @tomaszek, we´re having some issues with the Geometry vs Terrain Blend script.

    When we press the button rebuild mesh, autoblend or any other operation that requires interaction with the RTP terrain the exception showed in this screenshot is throwed.

    However, our mesh in one of your demo scenes works fine. Do you know which RTPLODManager option is breaking the blend?

    2017-07-25_13h06_52.png
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I know where this error comes from but I haven't found a way to solve it. It's just Unity sometimes refuses to give hitpoint after RayCast call... (a bug) :(. Anyway - it happened for me from time to time. What geom blend object needs is exact point "under the geom blend mesh vertex" - this is used to set the same UVs so that underlying geom blend object can object can mimic underlying terrain. Not sure what could I advise you. As your pavement is kind of sticked geometry you could just skip underlying object and paint blending manually. I know it's kind of dirt workaround. Maybe reassigning terrain, or making a copy of it could help. You can check (look at world space position) at which point Raycast call fails while it is supposed to hit terrain and give back UVs together with deistance from geom blend object vetex to terrain surface (used in autoblend).

    Tom
     
  15. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Could it be related to the size of my mesh? I mean, could the use of smaller meshes fix the issue?
     
  16. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Underlying "terrain" is mesh based? Make sure everything's fine with its collider then. What kind of collider do you use?

    Tom
     
  17. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    No, it´s a RTP terrain and the collider is a standard terrain collider
     
  18. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I get it now - you meant the size of geom blend mesh. I think the problem is not related to mesh size. The error message you get gives exact position at which Unity Raycast() call fails. What's the Unity version you're working on? I remember this issue happened very rarely for me in the past. I make sure to start ray origin way above the ground and cast it downward (or in the direction of mesh normals - that might be the case?).

    Tom
     
  19. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    We´re using 5.6.2f1. However, your last suggestion doesn´t make sense (in my opinion) because our mesh is blending correctly with your rtp demo terrain
     
  20. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    So there must be something specific to your terrain that makes Unity fails to solve raycast. You can experiment with terrain thickness (Unity terrain settings).

    Tom
     
  21. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    My game is totally optimized I can run on 60 fps. but when I look at the ground it will reduce frames to 40! and when I look back to distance it will back to 60 frames again. I can't figure out what's wrong I only use Parallax and most of RTP features are disabled.
     
    Last edited: Jul 26, 2017
  22. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Depends the target platform you test it on. Also - check it in profiler where you can get exactly what takes most for rendering (terrain is denoted as "QuadTreeRenderer" there).

    Tom
     
    Crossway likes this.
  23. Oginecka

    Oginecka

    Joined:
    Sep 25, 2016
    Posts:
    7

    After updating from Unity 5.3 to Unity 2017, the whole terrain went white. The texture data is still there, but for some reason, they aren't rendering at all.

    Has anyone experienced this before? Could I get some advice on how to fix this?
     
  24. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Unity2017 introduced a lot of changes to the rendering pipeline comparing to U5.3. You need RTP3.3h to work properly. It might be necessary to reinstall RTP (removing old installation). You can try to use preset functionality to store current RTP state (at least numerical values).

    Tom
     
    Oginecka likes this.
  25. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Hi @tomaszek , I´m developing an editor script that changes the rtp snow values to adjust the values in edit mode (without pressing play). The terrain doesn´t update the value correctly if I don´t set previously the snow to 1.

    However, it works fine when running the application (in Editor). Is there any function to force an update in edit mode?
     
  26. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Open ReliefTerrainGlobalSettingsHolder.cs and look around - there is a part that synchronizes globalSettingsHolder instance values (they are shared across multiple terrains in scene unless you put terrains in different anchors in hierarchy to use different grouping) with material and global shader variables used for rendering.

    So to do it quickly - change _snow_strength for global holder and acompanying variable via Shader.SetGlobalFloat() call - that's all needed for snow level to get terrain updated.

    Tom
     
  27. Aerys

    Aerys

    Joined:
    Aug 3, 2016
    Posts:
    15
    Hi,
    i have this error when i try to blend my geometry to the terrain.

    And it gives me this "surface error"

    P.S.: i'm on the Unity 2017.1.0 f3 and the 3.3 h version of the plugin
    Thanks in advance.
     
  28. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Tested and for me it works. I simply drag&drop example RTP model (Stone2). You need only to take care that you add geom blend RTP component to the element that actually has renderer. For example if you import a fbx model and put on scene the topmost element is just an anchor while actual mesh is rendered by gmae object down in hierarchy.

    So I assigned RTP geom blend component to default child game object and it works. Take a look at my screenshot:

    RTP_geom_blend_U2017.JPG

    Please refer to my pdf doc for further referece in regards to geom blend functionality.

    Tom
     
  29. MattLance

    MattLance

    Joined:
    Nov 23, 2016
    Posts:
    8
    Hi,

    does anyone know if RTP works with Unity 2017.1.x?

    Would be great to know

    Thanks
     
  30. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Take a look above - yes it works.

    Tom
     
  31. Avonaeon

    Avonaeon

    Joined:
    Apr 17, 2012
    Posts:
    48
    Hey Tom,
    Working on a top-down game where parts of it takes place in the snow. Would like to use the glitter feature, but the way the glitter moves when rotating the in-game camera around a point from top-down looks a bit weird (like 2 counter-rotating textures deformed over the terrain layers).

    I don't know if it actually is rotating around axis, but if it is, I'm wondering if there's a way to change the axis, so it would look better from top-down?

    Thanks,
    Daniel
     
  32. MattLance

    MattLance

    Joined:
    Nov 23, 2016
    Posts:
    8
    Hey Tom,

    sorry for asking again, but i cant see how RTP works with Unity 2017.1. The basic Texture height blending for 4 Layers doesn't work a bit. Nothing is changing. Also 'Extrude Height' doesn't change anything.

    I keep getting the Error:

    Can't access alphamapTexture directly...
    UnityEngine.Debug:LogError(Object)
    ReliefTerrain:GetControlMaps() (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:371)
    ReliefTerrain:RefreshTextures(Material, Boolean) (at Assets/ReliefPack/Scripts/ReliefTerrain/ReliefTerrain.cs:273)
    ReliefTerrainEditor:OnEnable() (at Assets/ReliefPack/Editor/ReliefTerrain/ReliefTerrainEditor.cs

    Obviously the problem there is, that PropertyInfo info = terrainDataType.GetProperty("alphamapTextures", BindingFlags.Instance | BindingFlags.NonPublic); returns Null. I already found something in this thread (Changing BindingFlags.NonPublic to BindingFlags.Public). This eliminated the error message but didn't help to get the basic funtionality of RTP working.

    It would be great if you could help me out!

    Thanks,
    Matthias
     
  33. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The way glitter is computed can be only changed when you dig into shader source code. If spark pattern is too obvious I'd say you should tune the parameters so the pattern is no so dense and doesn't reveal the underlying "trick". Try to play with density, also check if gamma vs. linear lighting makes a difference - it might be necessary to use custom glittermask if the one provided with RTP does not satisfy you.

    Please reinstall RTP to version 3.3h.

    Tom
     
  34. BonsaTech

    BonsaTech

    Joined:
    Dec 22, 2015
    Posts:
    73
    Hi @tomaszek , I´ve found the issue with the Geometry blending. In our case, the mesh is over two terrains at the same time (we´re using a multi terrain scenes). Is there any workaround for this case?
     
  35. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Unfortunately - not now in RTP3. The only workable solution I can think of would be to split your geom blend object into 2 - if that's possible. Otherwise try to avoid placing objects on terrain edges.

    Tom
     
  36. Tyrathect

    Tyrathect

    Joined:
    Jul 10, 2012
    Posts:
    38
    Hey @tomaszek, I've been looking at the frame debugger (Deferred rendering mode in Unity 2017.1), and I have some questions about your rendering approach.

    I'm interested specifically in the Deferred rendering path (which I know you have excluded).

    Why aren't you drawing both layers into the G buffer? If my math is right, it's drawing the terrain at least lights/4 times + 1. It draws the base pass into the G buffer as expected, alpha is pre-multiplied. Then it draws the second pass as if it's a giant, multi-piece, forward-rendered sticker.

    This seems like it has implications for performance, but it also messes up the SSAO for some reason.

    My questions is, why don't you either write an add pass that works with the G buffer, or write a fully featured shader that takes all 8 splats at once? Hardware support for DirectX 11 (and the OpenGL equivalent) are so pervasive now, it seems like it would be worth your while to write a dedicated Dx11 shader.

    Thanks for the great product!
     
  37. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The way Unity draws terrain is to split it into small patches (multiplieces noticed by you frame debugger). The reason we draw 8 layers in 2 passes comes from times DX9 couldn't use more texture resources. Now we can simply set "8 layers in first pass" checkbox in LOD manager - in deferred it's a must because specularity would be solved wrong way. In produces 1 pass (drawing multipieces terrain), no need to write into depth first (like in forward) and it has solved depth+normals for SSAO.

    Tom
     
  38. Fourthings

    Fourthings

    Joined:
    Feb 15, 2010
    Posts:
    313
    @tomaszek,Terrain not rendering at all as once I added the RTP component. I'm using Unity 2017.1

    Does RTP actually work with Unity 2017? Has it been tested? I followed the setup steps exactly, I also tested in a scene with no other assets imported and had the same result - ie the terrain stopped rendering immediately after I added the RTP component.

    I added 4 texture layers to the terrain before adding the component as per the setup video.

    In the screenshot below you can see the terrain brush showing the silhouette of the terrain.

    For the price I would expect this to work out of the box, I'm a bit frustrated...

    [EDIT] Update - So I created a brand new empty project, imported the latest version of RTP, created a terrain, set it up as per the setup video, and added the RTP component. And it does render correctly. So either I made a mistake on the LOD manager and corrupted the compiled shaders somehow? Or there may be a conflict with one of the other libraries I have in my main project. I'm going to go back to my main project now, remove and then re-import RTP, and see if I have any success, I'll update later

    [EDIT 2] Resolved - So I removed all traces of RTP from my main project, setup a new terrain as per the setup guide, re-imported RTP, and once I added the component the terrain did render as normal and I can now continue learning how to use the asset.

    I'm guessing I did something wrong but I'll leave this post here on the off-chance it may help someone

    Screenshot (7).png
     
    Last edited: Aug 4, 2017
  39. FS9606

    FS9606

    Joined:
    Mar 12, 2015
    Posts:
    21
    Example scenes. Do you have an example scene of a small beach? I was reviewing the documentation, which is quite extensive, and I am guessing it will take me a few days to figure out how to put together a beach based on it. if I saw an example, it would give me a reference and it would probably cut my time tremendously. Just wondering....
     
  40. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Screenshots in my pdf doc are taken from example scene which is included in package - the same scene you can download as a demo build (take a look at the first page of this forum thread).

    Tom
     
  41. FS9606

    FS9606

    Joined:
    Mar 12, 2015
    Posts:
    21
    Thank you for your reply. I have been working for a long time, trying to recreate this effect with other tools. Your effect looks like the most realistic I have seen to date. triton did not have it. smartwater3d did not. and a bunch of others tried.
    Anyway... Within this video

    starting at 0:30, I see an ocean that flows into the beach. Also, water that flows back after the wave crashes. And an effect that causes the whiteness near the shore on the water (foam I guess).
    Is this within your demo scene, because I am not seeing it. It would be very useful if we had some kind of working example of this. If it exists, which scene and which asset within the scene please.
    Thank you.
     
  42. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    134
    is there any update on mobile performance or test ? i hope u can upload APk to test thanks
     
  43. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Hi @tomaszek!

    I'm using RTP in a project at the moment and it's getting pretty great results. I've run into a bit of a workflow snag, though.

    Our game is played over a number of different islands, and our project's world is split up over a bunch of scenes -one for each island, which is a terrain. Each terrain in its own scene is working as expected, and additive loading as needed into our main scene also works well. When an island is not loaded in the main scene we show an impostor in its place. To create those impostors we're using Terrain To Mesh in an island's scene, copy-pasting the RTP component from the terrain to the impostor, and that also works well.

    The snag is with anything that we copy-paste from a sub-scene into our main scene, which we're doing for impostor islands. When they come in they're black. Nudging any setting in their RTP component makes them pop into colour, but the perlin normals are messed up, resulting in a shiny looking mesh with dark (nearly black) patches. The same thing happens if we copy a terrain from one scene to another instead of an impostor, so I don't think the issue is anything to do with the mesh.

    All of the scenes in question have an _RTP_LODmanager, all based on the same prefab.

    Ultimately we'll probably end up making a cheaper material for the impostors (I'm considering even just using the colormap that RTP can generate itself), and one way around this for now would simply be to turn the perlin all the way down for them since they're in the distance anyway, but I'd still like to figure out what's causing this.
     
  44. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    The video is showcase of video in production context where we used a lot fo 3rd party elements (models, textures). Ocean solution was custom shader that's not part of RTP which is about terrain shading. You can implement wet/dry cycle of terrain on the beach like on 30th second of the video (water running down the beach and "sinking" in the sand) using RTP.

     
  45. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Ok, thanks, that should get me started.
     
  46. Trunka

    Trunka

    Joined:
    Dec 3, 2014
    Posts:
    17
    Hi Tom,

    Is there any way to switch between 2 pass rendering and 8 layers in the first pass at runtime?

    Thank you,
    Trung
     
  47. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Not out of the box. You would need to prepare 2 shader sets - separate first-pass shader that refers to different (copy) base.cginc file (where 8 layers are defined).

    Tom
     
  48. Trunka

    Trunka

    Joined:
    Dec 3, 2014
    Posts:
    17
    Thank you very much, Tom. I got it at runtime now.

    Trung
     
    tomaszek likes this.
  49. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    To be honest I didn't expected you to figure it out and implement it that quick ;). (was rather - "oh, man, yet another user that has very specific problem to solve while it's not that trivial to be done in 1 click...")

    Tom
     
    Trunka likes this.
  50. Trunka

    Trunka

    Joined:
    Dec 3, 2014
    Posts:
    17
    Hi Tom, I guess it is like "it's my problem, but ask if he can help".

    Copying base.cginc did the trick, but AddPass-FarPass are still rendered in forward, which means just +0.2ms in performance. So I copied with all 3 passes rendered in Deferred, +2 to +3ms switchable at runtime.

    Trung
     
    Last edited: Aug 9, 2017