I am trying to create a boat wake trail effect by drawing a polygon behind the 3d model of the boat, with the vertices based on an array of the boat's previous positions. The issue I have run into is that I cannot seem to set a material for the polygon.
Here is my function for drawing the polygon based on a set of calculated vertex positions:
<code>
createPathPolygon (name, vertexPositions) {
var material = Cesium.Material.fromType('Image');
material.uniforms.image = '/assets/images/clouds/png/cloud-texture-1-original.png'; // to be replaced with water texture...
var pathPolygon = this.viewer.entities.add({
id : name,
name : name,
polygon : {
hierarchy : {
positions : vertexPositions
},
material : Cesium.Color.WHITE.withAlpha(0.3) // this works
// material : new Cesium.StripeMaterialProperty({
// evenColor: Cesium.Color.WHITE,
// oddColor: new Cesium.Color(186/255, 194/255, 1),
// repeat: 5
// })
//material : material // this does not work (path is just solid white)
//material : '/assets/images/clouds/png/cloud-texture-1-original.png' // this does not work (nothing is displayed)
}
});
pathPolygon.polygon.hierarchy = new Cesium.ConstantProperty(new Cesium.PolygonHierarchy(
vertexPositions));
}
</code>
Also, if anyone has a better idea of how to create this kind of boat wake effect, I'd be interested to hear it. I thought about maybe editing water vertex normals, but I don't know how I'd efficiently find which water vertices are near the entity, and that approach would also require me to find what part of cesium actually does the water animation stuff. I had also considered a "bread crumb" kind of approach in which I just draw a series of textured rectangles behind the boat, but I doubt that would look very good.
Thanks in advance for any help.