Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon uvs are improperly computed #11767

Closed
engineerhe opened this issue Jan 17, 2024 · 8 comments
Closed

Polygon uvs are improperly computed #11767

engineerhe opened this issue Jan 17, 2024 · 8 comments

Comments

@engineerhe
Copy link

engineerhe commented Jan 17, 2024

Specifically, the water material in the 1.103 version flickers a lot and does not show any ripples. The specific code is as follows.
`const viewer = new Viewer("cesiumContainer", {
terrain: Terrain.fromWorldTerrain()
});

Resource.fetchJson({
url: "sk.geojson"
}).then((res) => {
res.features.forEach((feature) => {
let primitive = new Primitive({
geometryInstances: new GeometryInstance({
geometry: new PolygonGeometry({
polygonHierarchy: new PolygonHierarchy(Cartesian3.fromDegreesArrayHeights(GeoJSONFormat.coordinate2LonLatHeight(feature))),
vertexFormat: EllipsoidSurfaceAppearance.VERTEX_FORMAT,
perPositionHeight: true
})
}),
appearance: new EllipsoidSurfaceAppearance({
material: new Material({
fabric: {
type: "Water",
uniforms: {
baseWaterColor: new Color(0.07, 0.20, 0.41, 1),
normalMap: "cesiumStatic/Assets/Textures/waterNormals.jpg",
frequency: 5000,
animationSpeed: 0.01,
amplitude: 100,
specularIntensity: 0.1
// fadeFactor: 0.2,
}
}
})
})
});
viewer.scene.primitives.add(primitive);
});
});

// Add Cesium OSM Buildings, a global 3D buildings layer.
const osmBuildingsTileset = await createOsmBuildingsAsync();
viewer.scene.primitives.add(osmBuildingsTileset);`

image

this is the sandcastle example,select the water material,you will see that.
sandcastle link

@syzdev
Copy link
Contributor

syzdev commented Jan 17, 2024

Change new Cesium.Primitive to new Cesium.GroundPrimitive.

In addition, if the URL contains a lot of content, it is recommended to create a link for it.

@syzdev
Copy link
Contributor

syzdev commented Jan 17, 2024

Here is an example of creating a water material: sandcastle example

s

@engineerhe Overall, this is not a bug.

@engineerhe
Copy link
Author

engineerhe commented Jan 17, 2024

Certainly, thank you for your response and suggestions. I tried your method, and it works for drawing water bodies using GroundPrimitive. However, the issue persists when using Primitive. My requirement is not to have the water bodies attached to the terrain or 3D tiles, but rather to have the water bodies with their own height. Therefore, when drawing water bodies with Primitive, the same issue still exists.

@syzdev

@ggetz
Copy link
Contributor

ggetz commented Jan 19, 2024

I think, similar to #11618, this is because polygon uvs are not correctly set.

As workaround you can set the uvs as the example in #11618 does.

@ggetz ggetz changed the title Cesium 1.103 version water material has a bug. Jan 19, 2024
@engineerhe
Copy link
Author

@ggetz
The UVs for Cesium polygons should not be calculated on the user's end. Typically, developers on this side are not aware of how your polygon is connected with triangles. Specifying UVs is only necessary for custom Geometry.I personally suggest providing the UVs for polygons as default values, rather than requiring developers to specify them.

@ggetz
Copy link
Contributor

ggetz commented Jan 22, 2024

I personally suggest providing the UVs for polygons as default values, rather than requiring developers to specify them.

I agree; That is what this issue is tracking.

@ggetz
Copy link
Contributor

ggetz commented Mar 5, 2024

@engineerhe I don't believe this issue has been addressed. I'm going to go ahead and re-open to keep track.

@ggetz
Copy link
Contributor

ggetz commented Mar 21, 2024

Closing as this was addressed in #11874.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment