PixelData issues in ImageCesium

Hi, I’m trying to modify the presentation of the tiles. I noticed that ImageCesium has the information needed for the tiles. In some scripts the height width of the tiles is set to 1 and in others the height width of the tiles is set to the projection height width, what difference does this cause?

Also, I notice that pixelData stores colour information, how do I arrange the position of the four channels after setting the channels to 4? Are the channels organised in the order of A, R, G, B or in the order of four bytes per pixel? Do I need to make changes to bytesPerChannel?

I would also appreciate if you have any other suggestions!

What are you trying to accomplish by modifying ImageCesium? There’s likely a different way to accomplish what you’re aiming to do that doesn’t involve directly modifying pixel data, such as creating a custom material to use with your tileset.

To answer your question, the layout of ImageCesium::pixelData is listed in the comment in its source file:

  /**
   * @brief The pixel data.
   *
   * This will be the raw pixel data when compressedPixelFormat is std::nullopt.
   * Otherwise, this buffer will store the compressed pixel data in the
   * specified format.
   *
   * If mipPositions is not empty, this buffer will contains multiple mips
   * back-to-back.
   *
   * When this is an uncompressed texture:
   * -The pixel data is consistent with the
   *  [stb](https://github.com/nothings/stb) image library.
   *
   * -For a correctly-formed image, the size of the array will be
   *  `width * height * channels * bytesPerChannel` bytes. There is no
   *  padding between rows or columns of the image, regardless of format.
   *
   * -The channels and their meaning are as follows:
   *
   * | Number of Channels | Channel Order and Meaning |
   * |--------------------|---------------------------|
   * | 1                  | grey                      |
   * | 2                  | grey, alpha               |
   * | 3                  | red, green, blue          |
   * | 4                  | red, green, blue, alpha   |
   */
  std::vector<std::byte> pixelData;

You shouldn’t need to touch bytesPerChannel. At the end of the day, only 8 bits per channel is supported in Unity anyways.