Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Relief Terrain Pack (RTP) v3 on AssetStore

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

  1. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,056
    I want to use RTP again because of its mesh blender. For now I'm suing Unity 2018.4.2f and just get RTP from asset store but there an is error I get now.

    Assets/ReliefPack/Scripts/ReliefTerrain/GeometryVsTerrainBlend.cs(694,12): error CS0121: The call is ambiguous between the following methods or properties: 'NormalSolver_by_CharisMarangos.RecalculateNormals(UnityEngine.Mesh, float)' and 'NormalSolver.RecalculateNormals(UnityEngine.Mesh, float)'



    Also there is another error from mesh deformer asset I get after importing RTP.

    Assets\ReliefPack\Scripts\ReliefTerrain\GeometryVsTerrainBlend.cs(706,12): error CS0121: The call is ambiguous between the following methods or properties: 'NormalSolver.RecalculateNormals(Mesh, float)' and 'NormalSolver_by_CharisMarangos.RecalculateNormals(Mesh, float)'
     
  2. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    This is interference of 2 classes that defines RecalculateNormals() as an extension to Mesh class. RTP has it defined in GeometryVsTerrainBlend.cs in line 2851 while in your project there is yet another extension that also does it (probably the same thing). I'd suggest to try removing extension defined in my script (just remove this function and the end of my class and recompile. Then check if geom blend in RTP works as expected. Otherwise - take a look (search your project for) at the other implementation present in your project and check the difference or (in case it's not used nor critical) - remove that implementiation in NormalSolver static class.

    Tom
     
  3. RockingGameDeveloper

    RockingGameDeveloper

    Joined:
    May 28, 2015
    Posts:
    18
    Anyone have a screen shot of what the settings have to be set to in order to have snow viable on the terrain? My snow does not appear.
     
  4. ohbado

    ohbado

    Joined:
    Aug 13, 2014
    Posts:
    31
    Hello.
    I'm trying to use RTP in Unity 2019.4.14.
    However, when I install RTP, I get the following error in the log when I start the Unity editor

    Shader 'Hidden/Relief Pack/ReliefTerrain-AddPass': fallback shader 'Relief Pack/ReliefTerrain-AddPass' not found​

    I removed and re-imported the RTP, but the error did not go away.
    Do you have any good ideas?
     
  5. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    Briefly checking I can not reproduce the error. Imported newest RTP3.3q (check yourside in verinfo.txt file in RTP asset folder) into Unity 2019.4.14f1.

    Could you give exact setup? (LOD manager state after recompiling shaders, lighting path, platform). Also - does error impact rendering (might be error reported on non used shader as add passe is not always needed)?
     
  6. Aberro

    Aberro

    Joined:
    Jan 27, 2013
    Posts:
    5
    I'm considering buying this pack, but I'm not sure about supported features and price is... well, quite significant for me, as I'm not a company and not from first world country. Does your shader pack supports HDR? Can I edit shaders source code for my project? How fine POM with silhouettes works, like, will I need hundreds of passes to display fine details on object's silhouette, or there's some optimization features? Is it only POM, no other techniques, like cone step mapping? Because AFAIK, POM can step over some small peaks on height map when viewing angle is very steep. I've seen your shaders support point sources, but does that include both self-shadowing and shadow casting? And how that shadow casting works, I guess, by default - using cubemaps?
    To be more specific, I need to render planets using very HD textures, at least 8k*4k and with point light source very far away. That's where problem with POM and fine details for silhouette arise. I don't expect appropriate shadow casting on such distance and I guess I'll need to fake shadow casting myself without using cubemaps, but if your shaders using some other technique than cubemap for point light sources, that could be decisive factor for me buying your pack.
     
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    I'd like to make sure we're talking about my Relief Terrain Pack (wchich this thread is dedicated to) or my other product - UBER?

    1. HDR is what Unity takes care of here - has basically not much to do with my shaders specific features. Both UBER and RTP handles it in both forward and deferred lighting paths.
    2. Shader source code is included by default. It doesn't mean modifying shaders will be easy task (depending on what you'd like to do). RTP is based on surface shader. UBER is modified Unity Standard shader code.
    3. POM isn't realised using separate rendering passes. It's computed in pixel shader functions (in loop - which you might refer to be as "passes"). Step size is customizable so that you can tune precision against performance. This custom implementation of Parallax Occlusion Mapping with secant search step (so it can minimize number of spets necessary to resolve it).
    4. Silhouettes - this is something that only UBER handles. Still - perfect (artifact free no matter viewing angle) silhouettes can be achieved only using tessellation which both UBER and RTP can do. Then - we're not refering to POM at all as tessellation will do it granularizing mesh GPU side on-fly.
    5. Shadows - tessellation provide mesh for shadow casting pass so it's fully casting/collecting suitable. As for shadows solved via POM. RTP doesn't support silhouettes nor writes into depth under shadow casting pass. It can only solve self-shadowing of bumps that come from heightmap. Shadowcaster see this geometry as proxy (regular mesh without bumps - RTP terrain that uses POM will not cast bumpied shadows on anything else). UBER can do more - it modify depth when rendering shadow casting pass. So - if you select silhouette POM UBER shader variant you can get silhouettes casted from object as well as it collects shadows from other objects inside its "heightmap bumps" (because regular rendering pass also can write into depth).

    For your specific usecase which seems to be planetary system with a point light star in the center - you'll most probably run into trouble of objects being extremely large scaled. Existing solutions for such use case assumes that one plant can cast shadow on the other procedurally - that is planetary shader calculates which other planet spheres occludes a pixel accordingly.
     
  8. Aberro

    Aberro

    Joined:
    Jan 27, 2013
    Posts:
    5
    Oh, sorry, I've meant UBER, ofc. Support link from store was at this post, I didn't though it's same page for other products too.

    3. By passes I've meant surface search steps, yes. AFAIK, default technique is just making predefined amount of steps at an equal distance (except for binary search or other methods to find precise hit point), usually with optimization that makes less step when viewing angle is close to 90 degrees and more steps at steep angles, but I've heard there's some other more adaptive technique, though I didn't happen to know which exactly, so, maybe it's just what I've wrote - amount of steps depending on viewing angle. But I've read nothing about secant search step, so, maybe it's it. Also, I know that cone stepping, especially relaxed cone stepping, tends to find surface level at much fewer steps and also is much more precise, as it's practically never misses small bumps. I've tried to implement it, and I mostly did, but then I failed with silhouette implementation.
    4. As for tessellation, I believe, I can't use it on such HD textures, because it'll probably ruin performance, and if I'd make tesselation grid less precise that won't give correct silhouette.
    5. I see. Well, I'm impressed that UBER can cast silhouette in shadows, but yes, I guess I'll have to use procedurally generated shadows with my code anyway.

    Ok, thank you. I guess it mostly fits my needs. Though, I'll think a bit more.
     
  9. chbran

    chbran

    Joined:
    Dec 9, 2018
    Posts:
    3
    Following Error popping up in 2019.4.17 LTS . Wasnt there in 2019.4.16 LTS
    maybe 25 Errors on different codelines. Allways same error.

    Shader error in 'Relief Pack/ReliefTerrain-FirstPass': not enough actual parameters for macro 'UNITY_SAMPLE_TEX2D_LOD' undeclared identifier 'UNITY_SAMPLE_TEX2D_LOD' at Assets/ReliefPack/Shaders/ReliefTerrain/RTP_Base.cginc(1070) (on d3d11)
     
  10. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    Sorry for delayed response. We all need to take some rest this time ;).
    The problem here is that Unity (at last) introduced missing macros to sample specific lod levels of texture. As I used the same naming convention and Unity uses macro with 3 params (while RTP uses 2) the macro usage in code is badly used.

    I'll introduce this fix in next minor update soon. Fortunately fixing the issue isn't complex - the easiest way we only need to undef Unity's macro and redefine it the way RTP uses it in shaders.

    in RTP_Base.cginc and (simial part in RTP_AddBase.cginc) find this part:

    Code (csharp):
    1.  
    2. //#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_PSSL)
    3. #if defined(UNITY_USING_SPLIT_SAMPLERS)
    4.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    5.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex.SampleGrad(sampler##tex,coord,dx,dy)
    6.    #endif
    7.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD_SAMPLER)
    8.        #define UNITY_SAMPLE_TEX2D_GRAD_SAMPLER(tex,samplertex,coord,dx,dy) tex.SampleGrad(sampler##samplertex,coord,dx,dy)
    9.    #endif
    10.    #if !defined(UNITY_SAMPLE_TEX2D_LOD)
    11.        #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex.SampleLevel (sampler##tex,(coord).xy,(coord).w)
    12.    #endif
    13.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    14.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex.SampleLevel (sampler##samplertex,(coord).xy,(coord).w)
    15.    #endif
    16.    #if !defined(UNITY_SAMPLE_TEX2D_BIAS)
    17.        #define UNITY_SAMPLE_TEX2D_BIAS(tex,coord) tex.SampleBias (sampler##tex,(coord).xy,(coord).w)
    18.    #endif
    19. #else
    20.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    21.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex2Dgrad(tex,coord,dx,dy)
    22.    #endif
    23.    #if !defined(UNITY_SAMPLE_TEX2D_LOD)
    24.        #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex2Dlod(tex,coord)
    25.    #endif
    26.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    27.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex2Dlod(tex,coord)
    28.    #endif
    29.    #if !defined(UNITY_SAMPLE_TEX2D_BIAS)
    30.        #define UNITY_SAMPLE_TEX2D_BIAS(tex,coord) tex2Dbias(tex,coord)
    31.    #endif
    32. #endif
    33.  
    and replace with tweaked version:

    Code (csharp):
    1.  
    2. //#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_PSSL)
    3. #if defined(UNITY_USING_SPLIT_SAMPLERS)
    4.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    5.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex.SampleGrad(sampler##tex,coord,dx,dy)
    6.    #endif
    7.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD_SAMPLER)
    8.        #define UNITY_SAMPLE_TEX2D_GRAD_SAMPLER(tex,samplertex,coord,dx,dy) tex.SampleGrad(sampler##samplertex,coord,dx,dy)
    9.    #endif
    10.    #if defined(UNITY_SAMPLE_TEX2D_LOD)
    11.        #undef UNITY_SAMPLE_TEX2D_LOD
    12.    #endif
    13.    #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex.SampleLevel (sampler##tex,(coord).xy,(coord).w)
    14.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    15.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex.SampleLevel (sampler##samplertex,(coord).xy,(coord).w)
    16.    #endif
    17.    #if !defined(UNITY_SAMPLE_TEX2D_BIAS)
    18.        #define UNITY_SAMPLE_TEX2D_BIAS(tex,coord) tex.SampleBias (sampler##tex,(coord).xy,(coord).w)
    19.    #endif
    20. #else
    21.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    22.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex2Dgrad(tex,coord,dx,dy)
    23.    #endif
    24.    #if defined(UNITY_SAMPLE_TEX2D_LOD)
    25.        #undef UNITY_SAMPLE_TEX2D_LOD
    26.    #endif
    27.    #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex2Dlod(tex,coord)
    28.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    29.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex2Dlod(tex,coord)
    30.    #endif
    31.    #if !defined(UNITY_SAMPLE_TEX2D_BIAS)
    32.        #define UNITY_SAMPLE_TEX2D_BIAS(tex,coord) tex2Dbias(tex,coord)
    33.    #endif
    34. #endif
    35.  
    There is also similar code in standalone shaders where we overwrite RTP_Base.cginc inits.
    Find this:

    Code (csharp):
    1.  
    2. //#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_PSSL)
    3. #if defined(UNITY_USING_SPLIT_SAMPLERS)
    4.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    5.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex.SampleGrad(sampler##tex,coord,dx,dy)
    6.    #endif
    7.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD_SAMPLER)
    8.        #define UNITY_SAMPLE_TEX2D_GRAD_SAMPLER(tex,samplertex,coord,dx,dy) tex.SampleGrad(sampler##samplertex,coord,dx,dy)
    9.    #endif
    10.    #if !defined(UNITY_SAMPLE_TEX2D_LOD)
    11.        #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex.SampleLevel (sampler##tex,(coord).xy,(coord).w)
    12.    #endif
    13.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    14.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex.SampleLevel (sampler##samplertex,(coord).xy,(coord).w)
    15.    #endif
    16. #else
    17.    #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex2Dgrad(tex,coord,dx,dy)
    18.    #if !defined(UNITY_SAMPLE_TEX2D_LOD)
    19.        #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex2Dlod(tex,coord)
    20.    #endif
    21.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    22.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex2Dlod(tex,coord)
    23.    #endif
    24. #endif
    25.  
    and replace with this:

    Code (csharp):
    1.  
    2. //#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(SHADER_API_GLES3) || defined(SHADER_API_GLCORE) || defined(SHADER_API_PSSL)
    3. #if defined(UNITY_USING_SPLIT_SAMPLERS)
    4.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD)
    5.        #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex.SampleGrad(sampler##tex,coord,dx,dy)
    6.    #endif
    7.    #if !defined(UNITY_SAMPLE_TEX2D_GRAD_SAMPLER)
    8.        #define UNITY_SAMPLE_TEX2D_GRAD_SAMPLER(tex,samplertex,coord,dx,dy) tex.SampleGrad(sampler##samplertex,coord,dx,dy)
    9.    #endif
    10.    #if defined(UNITY_SAMPLE_TEX2D_LOD)
    11.        #undef UNITY_SAMPLE_TEX2D_LOD
    12.    #endif
    13.    #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex.SampleLevel (sampler##tex,(coord).xy,(coord).w)
    14.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    15.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex.SampleLevel (sampler##samplertex,(coord).xy,(coord).w)
    16.    #endif
    17. #else
    18.    #define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,dx,dy) tex2Dgrad(tex,coord,dx,dy)
    19.    #if defined(UNITY_SAMPLE_TEX2D_LOD)
    20.        #undef UNITY_SAMPLE_TEX2D_LOD
    21.    #endif
    22.    #define UNITY_SAMPLE_TEX2D_LOD(tex,coord) tex2Dlod(tex,coord)
    23.    #if !defined(UNITY_SAMPLE_TEX2D_LOD_SAMPLER)
    24.        #define UNITY_SAMPLE_TEX2D_LOD_SAMPLER(tex,samplertex,coord) tex2Dlod(tex,coord)
    25.    #endif
    26. #endif
    27.  
    Notice that now in case there IS defined macro UNITY_SAMPLE_TEX2D_LOD (as Unity introduced it recenetly in HLSLSupport.cginc) - we #undef it:

    Code (csharp):
    1.  
    2.    #if defined(UNITY_SAMPLE_TEX2D_LOD)
    3.        #undef UNITY_SAMPLE_TEX2D_LOD
    4.    #endif
    5.  
    and #define RTP one below.

    Happy New Year!
     
    Kusras and hopeful like this.
  11. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    49
    tomaszek, why when successfully importing Relief Terrain into Unity 2020.2.1f1, am I not seeing the full Terrains in ANY of the example scenes?

     
  12. AerionXI

    AerionXI

    Joined:
    Jul 20, 2020
    Posts:
    49
    Someone can help?
     
  13. Endi24

    Endi24

    Joined:
    May 6, 2015
    Posts:
    44
    Hey there, I have an issue (on freshly imported projects and also existing ones, version 2019.4.9f)
    upload_2021-1-7_1-18-35.png

    after completing all the steps in this tutorial (I found this more up to date than the official ones)
    (2) Unity5: Using Gaia with RTP - How to add RTP to your Gaia Terrain - YouTube
    This is how it shows up in my project. Basically the further you get away the more terrain shows, but when you are close, it appears like this.
    What I've done: Used Gaia for terrain stamping, put the rtp core script on terrain, compiled shaders as in the video (with POM), recompiled, created a texture and saved in the project, put that texture in global maps section, added heightmaps to the maps through RTP, re-applied height texture, and then refreshed all. This is my end result, third time on a brand new project. Tried both linear and gamma. Any ideas?
     
  14. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    Check in wireframe scene view mode to see if terrain disappears at "pixel stage" or mesh is missing. The thing I'd suspect - in case of tessellation usage - make sure you don't use instancing on terrain and proper heightmaps are used.
     
  15. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,834
    I believe it's realted to bug I described the one post above yours. Does Unity show any shader compilation errors?
     
  16. Endi24

    Endi24

    Joined:
    May 6, 2015
    Posts:
    44
    Yes, it has a gUV undefined error. In which case I am waiting for an update.
     
  17. Endi24

    Endi24

    Joined:
    May 6, 2015
    Posts:
    44
    Yes, disabling this: upload_2021-1-7_17-34-19.png

    Fixed my issue. Any other things I should be doing? Disable batching (static, dynamic)? Or am I fine to go along now?
     
unityunity