Search code examples
webots

color field of ElevationGrid


I'm trying to convert a 3d point cloud to an ElevationGrid node.

Each point of the cloud has a color, so I thought that I could use color and colorPerVertex fields of ElevationGrid, but I don't think Webots renders the colors.

What am I missing?

The solid node I tested is:

Solid {
  children [
    Shape {
      geometry DEF BB ElevationGrid {
        color Color {
          color [
            1 1 1
            0 0 0
            1 1 1
            0 0 0
            1 1 1
            0 0 0
          ]
        }
        height [
          0, 0.1, 0, 0.1, 0, 0.1
        ]
        colorPerVertex FALSE
        xDimension 3
        zDimension 2
      }
    }
  ]
}

Solution

  • It seems to be a bug in Webots R2019a. According to the documentation, it should work as you expect it. But the color field appears to be ignored. I would suggest you the following workaround: generate a texture that contains the colors you need and map this texture on the ElevationGrid node (you will need to add an Appearance node to the Shape node to so it).