Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Documentation for TerrainData.GetPatchMinMaxHeights()

Discussion in 'General Graphics' started by ferretnt, Aug 9, 2021.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Is there any documentation describing the XZ extents of the patches returned by TerrainData.GetPatchMinMaxHeights() (and corresponding override method)? The array returned doesn't seem to be an n*n array given a square terrain - is it hierarchical in some way, and if so is there a way to find out how?

    There seems to be no Google hit for Get/Override PatchMinMaxHeights(), nor any use of it in any public source code, including the Unity Terrain Utilities package.
     
  2. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    I guess not.
     
  3. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Seriously? Anybody? There’s a public API that nobody on the internet has used or understands with no example code in existence?
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    I just looked at the docs here:
    https://docs.unity3d.com/ScriptReference/TerrainData.GetPatchMinMaxHeights.html
    https://docs.unity3d.com/ScriptReference/PatchExtents.html

    It looks like the returned data is simply a pair of floats for the min and max Y height. There is no XZ?

    It sounds like it's one value returned per patch, but I don't know whether patches line up with a n*n representation of the terrain.

    If you want to further clarify your question I can probably poke the terrain team to give you a better reply here than I can.

    Oh and also, you will probably get more of the right people looking at this if you post in https://forum.unity.com/forums/world-building.146/
     
  5. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Thanks for the reply Richard. This would be great if you could ping the terrain team. It's not at all obvious what spatial extent a returned patch corresponds to, and as the API stands (assuming that the purpose is to be able to call GetPathMinMaxHeights() and OverridePatchMinMaxHeights()), I can't see how you can compute the patch heights you'd like to set for a given patch because there is no definition of the spatial extent of any given patch.

    I've also tried using the same terrainData, resampled at various texture sizes from 33x33 to 513x513, and the only obvious thing that happens is you get more patches as you have higher res terrain (which would be expected), but that doesn't tell you where each patch is.

    https://forum.unity.com/threads/documentation-for-terraindata-getpatchminmaxheights.1199134/
     
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
    Great! Let’s see if someone in the other forum can help, and I’ll give the team a nudge if we dont hear anything soon
     
    joshuacwilde likes this.
  7. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Hey @richardkettlewell looks
    Like radio silence for the last week on the other forum so would be great if you could ask the terrain team internally. I’m only trying to ensure that there’s at least one nontrivial explanation of a public API on the entire internet. As things stand the data it returns (and that it’s override equivalent expects) is so undefined they seem useless.
     
    richardkettlewell likes this.
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,281
  9. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Thanks! I do see a reply in there (which I'll follow up with just now), but don't think it's relevant.