Search Unity

  1. 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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[HELP] Render Terrain - not expert - Academic & Research purposes

Discussion in 'General Graphics' started by felipemagz, Aug 20, 2019.

  1. felipemagz

    felipemagz

    Joined:
    Aug 19, 2019
    Posts:
    20
    Hello dear comunity,

    Im a geologist and im not an expert on the Unity Software either with programing languages.

    Anyway i have been using Unity for Academic & Research purposes, in my graduation and now in my master degree (Check out my work here:
    ).

    Lets gets started with my doubt, shall we?!

    I have finished my most recent didatic 3D model on sea level oscilations, but i have a problem that can be found on the last one too, the visualization of the surface is ruined by some square forms on the terrain there is some kind of solution on this issue?



    here are some of my terrain settings if its serves as any help...
    upload_2019-8-19_20-0-10.png
     
  2. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    642
    These "square forms" are pixels of your heightmap, it has a resolution of 1025 (Heightmap Resolution). That is to some extent enough, but for a close up it is not. Unity terrains will not interpolate further, the resolution of the mesh is therefore limited to heightmap resolution. There are two solutions.

    Increase heightmap resolution
    If you do that inside Unity it might not look much better at first, you would have to blur things out a little manually.
    The alternative is to open your heightmap in an editor like Photoshop and scale it up to 2049 or 4097. Additionally, you could try to blur the image by just one or two pixels, this could give even nicer results.

    Tesselation Shaders
    With tesselation, it could be possible to smoothen out these edges, but you have to find a suitable shader for terrains if you can't do it yourself.
     
  3. felipemagz

    felipemagz

    Joined:
    Aug 19, 2019
    Posts:
    20
    Hello!

    I've tried to edit the resolution of my heightmap, but the simple fact to open it on Photoshop somehow corrupt the terrain, there is a way to increase the resolution without open the image?

    turned it, (1025)


    on it, wich also didn't had solved the problem (4097)


    going back to resolution 1025 terrain, zooming in, shows me that the border are really that waya nd some other get even more squares at distance view.
    And i cant shape it rounded and neither smooth

     
  4. felipemagz

    felipemagz

    Joined:
    Aug 19, 2019
    Posts:
    20
    i had upload a video to show you how it is now;
    This is 90% of my results on my master degree on geology but its getting anoying the fact of this squares ruining the scenario i wanna show.
     
  5. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Your terrain is very big, split it up in chunks so your heightmap doesn't make those squares

    This happens due to the resolution
     
  6. felipemagz

    felipemagz

    Joined:
    Aug 19, 2019
    Posts:
    20
    do you have some kind of guide, tutorial that i could follow to do that? i had found one but the asset was very expensive and i could not afford, especially without knowing that it would certainly solve the problem
     
  7. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Hi Felipe, you can split the terrain with this new package of Unity https://docs.unity3d.com/Packages/com.unity.terrain-tools@1.1/manual/toolbox-terrain-edit.html

    Install it via Window/Package Manager, be sure to have the view preview packages option active.

    It's free so it's worth a try.

    When you split it you may want to upper the resolution of each terrain, try to mess with it and see if you can get anything.

    Additionally if you end up with good results and want to improve your performance, hide/show the chunks based on the distance and direction of the camera so you can get more fps when moving around.

    If splitting it doesn't work for you, try to make the terrain less larger, you will lose the real scale feeling but you will get more resolution fixing the squares.

    Always make a copy of your project / terrain.
     
    felipemagz likes this.
  8. felipemagz

    felipemagz

    Joined:
    Aug 19, 2019
    Posts:
    20

    Thank you very much!!
     
    Kirbyrawr likes this.
  9. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    642
    This will still not make it smooth. There are ways and tools to do that in unity for the whole terrain but maybe not for free. To edit the heightmap in photoshop you have to export it properly, maybe this helps.
    Also the heightmap scale must always be power of two + 1 (e.g. 1025, 2049, etc.).
     
  10. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Can you explain why it won't make the terrain smooth? I don't think the problem is the heightmap only, but the large terrain he have and the resolution of the heightmap it's like taking a pattern (Heightmap) for a enormous table (Terrain) and trying to pull around the edges to fit (Resolution) the whole table, the pattern will obviously looks bad.
     
  11. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    642
    Alright this image should explain it.

    The simplest solution would be, scale up your height map in Photoshop, smooth it, export it correctly and profit.
    A bit of research brought this up, maybe this has a terrain wide smoothing feature: https://assetstore.unity.com/packages/tools/terrain/terrain-toolkit-2017-83490

    If you want to do it on your own, you can alter the Heightmap in Unity using Terrain.GetHeights and SetHeights. You would have to average the values for each point with N amount of neighboring points. But you should be all right with the solutions above.
     

    Attached Files:

unityunity