Jump to content

Flipping landscape terrain problem


photo

Recommended Posts

Hello. I'm trying to do 3D-terrain from earth map by framing area (pic .1). For that i'm using code from here https://developer.unigine.com/en/docs/2.17/code/usage/landscape_terrain/index?rlang=cs

Then 3d-terrain is complete, i get flipping terrain (like mirror). (pic.2). I'm trying to figure out why terrain is flipping, trying to find parameters or method in landscapes classes that changes or control flipping, but dont "find a way". In result, i solved it by adding in code albedo.FlipX() and height.FlipX().

Question: can it solved by some parameters or method from landscapes or terrain classes? and why is flipping happened?pic1.thumb.png.973bbac31a8bfb5ac8288aca0a5b3744.pngpic2.thumb.png.eece8c059ec62e09374b8d4215e75205.png

    private void OnCreatorCreate(LandscapeMapFileCreator creator, LandscapeImages images, int x, int y)
    {
        Image albedo = images.GetAlbedo();
        albedo.Create2D(albedoImage.Width, albedoImage.Height, albedoImage.Format, albedoImage.NumMipmaps);
        albedo.Copy(albedoImage, 0, 0, 0, 0, albedoImage.Width, albedoImage.Height);
        albedo.FlipX();
 
        Image height = images.GetHeight();
        height.Create2D(heightImage.Width, heightImage.Height, heightImage.Format, heightImage.NumMipmaps);
        height.Copy(heightImage, 0, 0, 0, 0, heightImage.Width, heightImage.Height);
        height.FlipX();
    }
Link to comment

Hello!

By design an image will be placed inside a texture "as is" but internally it is stored differently. To solve this issue you only need to flip it along the Y-axis as shown in the example below:

if (Render::isFlipped())
{
	texture->flipY();
}

Thanks!

  • Thanks 1
Link to comment
×
×
  • Create New...