microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.45k stars 4.58k forks source link

Orthographic projection does not render objects in City Environment #2344

Open rozni opened 4 years ago

rozni commented 4 years ago

When trying to get orthographic images in the City Environment, the render usually does not contain anything but the ground texture. This is especially true when looking straight down, for pitches closer to 0, sometimes, there is a building, perhaps other objects.

Running CityEnviron v1.2.2 (similar in v1.2.0 too) on Windows 10.

Reproducing

settings.json

{
  "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
  "SettingsVersion": 1.2,
  "SimMode": "ComputerVision",
  "ViewMode": "NoDisplay",
  "CameraDefaults": {
    "CaptureSettings": [
      {
        "ImageType": 0,
        "Width": 1000,
        "Height": 1000,
        "ProjectionMode": "orthographic",
        "OrthoWidth": 100.0
      }
    ]
  }
}

Script

import airsim
from math import pi

client = airsim.VehicleClient()
client.confirmConnection()

orientation = airsim.to_quaternion(-pi/2, 0, 0)
position = airsim.Vector3r(0, 0, -50)
pose = airsim.Pose(position, orientation)

client.simSetVehiclePose(pose, ignore_collison=True)
image = client.simGetImage('', airsim.ImageType.Scene)

airsim.write_file('orthographic.png', image)

Output

orthographic

ab3nd commented 4 years ago

I have also seen this bug. Annoyingly, I can't share images, because, AFAIK, the model I'm working with is proprietary, but the bug appears to be related to problems with the terrain surface/ "ground".

My map includes a city, with roads, buildings, some large stones, cars, shipping containers, etc. The city is in a relatively flat area, but has some elevation change over the area the city is in.

When I get an RGB image of the city in ortho mode, the roads disappear, seemingly into the ground, along diagonal lines, frequently at a 45 degree angle to the edges of the image. Some buildings also disappear.

When I get a depth image of the city in ortho mode, the buildings and roads look fine, but the terrain is broken up into regular square regions with diagonal lines across them from bottom left to top right. On each side of the diagonal, the slope of the terrain appears to be limited to a simple gradient. The diagonal lines where the roads disappear correspond to the isoclines in that gradient that match the elevation of the road surface. Roads can also disappear at edges between regions, especially if there is a change in the gradient direction from region to region. I also have a ravine in my map, and it only appears in one square region, while being missing from the adjacent ones (which it should continue into).

So if I had to guess, at least part of the problem is that the terrain is getting simplified into large regions with very simple slopes, and then only the things that stick up above that slope are getting rendered (everything else is "underground"). In Ronzi's case, sometimes a building and maybe some telephone poles; in my case, many of the buildings and some of the roads.

The ravine also appears to be coming out "inside out" in the depth image, which is to say, appearing as a hill rather than a depression, which may indicate something about whatever is confusing the terrain surface rendering.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had activity from the community in the last year. It will be closed if no further activity occurs within 20 days.