How to add an image map to a tilted quad

I hope to get the effect of P1, but in fact he can only get the effect of the black box of P2by code

    var entity2 = viewer.entities.add({
        polygon: {
            hierarchy: new Cesium.PolygonHierarchy(positions),
            material: new Cesium.ImageMaterialProperty({
                image: "path to png",
                transparent: true
            })
        }
    });

Set texture coordinates for the polygon, see: Sandcastle - Polygon, ref-doc - textureCoordinates

Thanks for your reply,but how could I get those Cartesian2

 textureCoordinates: {
      positions: [
        new Cesium.Cartesian2(0, 1),
        new Cesium.Cartesian2(0, 0),
        new Cesium.Cartesian2(0.5, 0),
        new Cesium.Cartesian2(1, 0),
        new Cesium.Cartesian2(1, 1),
      ]
    }

Each coordinate point in polygon.hierarchy corresponds (in order) to the texture coordinate, which is a two-dimensional spatial coordinate system (as shown below) with u and v in the range 0 to 1, here is an example that I hope will help you. sandcastle
ss

Other shapes: sandcastle

Thanks again for your answer, I now have a new problem, my pictures are flipped up and down in some places. do you know how to solve it.

    var positions = Cesium.Cartesian3.fromDegreesArray([
        Number(126.961519),
        Number(46.207604),
        Number(127.865895),
        Number(46.031461),
        Number(127.617953),
        Number(45.424603)
        Number(126.722977),
        Number(45.599256)
    ]);

    var entity = viewer.entities.add({
        polygon: {
            hierarchy: new Cesium.PolygonHierarchy(positions),
            perPositionHeight: true,
            material: new Cesium.ImageMaterialProperty({
                image: "./test.jpg"
            }),

        }
    });


1

Rearrange the order of coordinate points in positions.

I don’t think it’s an issue with the order of the points,If I use perPositionHeight: false,it’s direction will be right,but it will be incompletely displayed

Hi @dingweida390,

Textured polygons are not recommended for displaying geolocated imagery due to the precision needed.

Does SingleTileImageryProvider work for your use case?

I guess not, it only supports rectangular range

@Gabby_Getz OH! I found that this problem had appeared on github many years ago Fit texture coordinates to rectangle/trapezoid geometry · Issue #4164 · CesiumGS/cesium · GitHub
Is he making any progress now?