CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.75k stars 3.46k forks source link

Error displaying when setting polygonGeometry object water material. #11575

Closed LaogaKAKA closed 10 months ago

LaogaKAKA commented 11 months ago

Set the "appearance" attribute on the Primitive, and when the geometry object is PolygonGeometry, it displays an issue, as follows: Snipaste_2023-10-20_11-18-10

ggetz commented 11 months ago

Would you be able to include a Sandcastle example that replicates the issue? That would help us give us more context to determine the issue. Thanks!

ggetz commented 10 months ago

I'm closing this issue due to inactivity. If you believe this is still an issue, please feel free to re-open. Thanks!

qmhc commented 8 months ago

@ggetz Hi, you can reproduce in here. This issue seems to occur since v1.110.

jixiaoye commented 8 months ago

@qmhc image

const viewer = new Cesium.Viewer("cesiumContainer");

const positions = [ Cesium.Cartesian3.fromDegrees(115.98, 22.99, 0.8), Cesium.Cartesian3.fromDegrees(115.99, 22.995, 0.8), Cesium.Cartesian3.fromDegrees(115.995, 22.98, 0.8), Cesium.Cartesian3.fromDegrees(115.98, 22.98, 0.8) ];

const material = new Cesium.Material({ fabric: { type: Cesium.Material.WaterType, uniforms: { baseWaterColor: Cesium.Color.AQUA.withAlpha(0.3), normalMap: Cesium.buildModuleUrl( "Assets/Textures/waterNormals.jpg" ), frequency: 1000, animationSpeed: 0.01, amplitude: 10, specularIntensity: 5 } } });

let hierarchy = new Cesium.PolygonHierarchy( positions,

);

let polygonGeometry = new Cesium.PolygonGeometry({ polygonHierarchy: hierarchy, textureCoordinates: { positions:[ new Cesium.Cartesian2(0, 1), new Cesium.Cartesian2(0, 0), new Cesium.Cartesian2(1, 0), new Cesium.Cartesian2(0, 0), ] }})

const water = new Cesium.Primitive({ show: true, geometryInstances: new Cesium.GeometryInstance({ geometry:polygonGeometry }), appearance: new Cesium.EllipsoidSurfaceAppearance({ material, aboveGround: true }) });

viewer.scene.primitives.add(water);

viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(115.985, 22.985, 2000), duration: 0 });

jixiaoye commented 8 months ago

@qmhc 这个你用GroundPrimitive就没这个UV问题了,或者增加textureCoordinates

jixiaoye commented 8 months ago

https://sandcastle.cesium.com/#c=pVRtb9owEP4rVj5RCZnQCg0yWg2xqau07kW024elH0xyAW+O7fkFxqb+950TEl6GplbjA7F99zzne+7OmZLWkRWHNRhySSSsyRQs9yX9XJ110iir9lMlHeMSTBqdvUxlKrMKqZXljuMSwV9TSRr0lBmHKyYvaGFU+RoWBsB2+v0BHQ275PycjkZdEtPhWfeJqNEWNXgmbFDjhnuwJ+EuatyL54UbHkRL5cOeViVzYDgThzrfbk87v0OIgs0NzxJSbQhxGw3JsSf9EhZ3aKqzIV7yQpnStjBC5sxC5TZVQpmWotrRyaf7CV1zt5wIvWSdmF5sdcGfRCImbpluMXPPRX6rci/g3ohO40hIGk2sBWd7d/DTeQO2tw4R31cMln7TizRqvHcBCgM/PMhsk5B+HMftOZMcBcJWmmmAPEH94v7OWGrBnc8hgNpTqyHzgpkb6UBiHyLloLY9hg/+Pda9KsCRJQfDTLbcHMr/UYnNQsm3jRXza3u6G7A7Bl27XoMqwZnTPI0xVFMfUSe7OyCzq0WbKmVyLlG4unxt8ATHaY9/13SduNvvxkHQ0+Y+9t6/7HFrJ+R/GR5Q4qDyrsmrFjiSxvASc1pBEMUu1TohzvjQvIutWjeIZDILEuzhro+sAd4gkqNihEsgIdMamAnOB0xvhODaKp7PvClYBpPWLXA2cxnwc7WCa6O8zOtL1slt26h+JqnNQALVTVaWsjzvVHkfuGWsxGrTQmzuVD3cOVgXSo3lTZ70mDRvV/jirNQ1y73ZUsTbm0XdaGzdRsBVMxmveKmVccTjwFLac4DzE1qsN/fZd3A0szYAg+u4tw8d53xFeH554tknmWDWoqXwQsz4L0ijq3EP/f+CCsWwpRcfVmAE2wS3Zf/qXX1IKR33cHsa6ZQSc2aOmP8A

LaogaKAKA commented 6 months ago

It's been so long, I didn't expect anyone to come back. Haha, I solved it with Shader, but thank you all! ; )

hzh1022 commented 4 months ago

@qmhc 这个你用GroundPrimitive就没这个UV问题了,或者增加textureCoordinates

朋友,如果我的primitive顶点是动态添加的,那应该怎么确定textureCoordinates呢,或者使用GroundPrimitive的时候怎么解决附着在3dTiles上 的问题呢