# Intermittent black line rendering artifacts when adding images via Entity

**URL:** <https://community.cesium.com/t/intermittent-black-line-rendering-artifacts-when-adding-images-via-entity/46435>\
**Category:** CesiumJS\
**Created:** [June 5, 2026, 3:38am UTC](https://community.cesium.com/t/intermittent-black-line-rendering-artifacts-when-adding-images-via-entity/46435 "2026-06-05T03:38:28Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![szkwen](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@szkwen](https://community.cesium.com/u/szkwen)\
**Post date:** [June 17, 2026, 2:42am UTC](https://community.cesium.com/t/intermittent-black-line-rendering-artifacts-when-adding-images-via-entity/46435/4 "2026-06-17T02:42:26Z")

</div>

> [@darcyvdd](#):
>
> - Are you drawing to the same canvas object in place each frame, or swapping references?

Hi @darcyvdd,  
Thanks for your reply.

Let me clarify point 3 first:

**Are you drawing to the same canvas object in place each frame, or swapping references?**

I’m intentionally using a double-buffered canvas approach (swapping between two canvas instances) to work around a known issue reported in the Cesium community:

[BUG: CallbackProperty for ImageMaterialProperty image doesn’t update image](https://community.cesium.com/t/bug-callbackproperty-for-imagematerialproperty-image-doesnt-update-image/5254)

In my implementation, I alternate canvases like this:

```javascript
curCanvas = curCanvas === 'a' ? 'b' : 'a';

```

This is necessary because updating the same canvas in-place does not reliably trigger texture refresh in Cesium in my case.

* * *

**Point 2: Is it a video element or some other image source?**

It’s an image source (bitmap), rendered via:

```javascript
activeCtx.drawImage(bitmap, 0, 0);

```

* * *

**Point 1: Is it a element drawn each frame in a requestAnimationFrame loop?**

It’s not strictly requestAnimationFrame. I’m using a timed update loop:

```javascript
setTimeout(() => {
    // Alternate canvases
    const activeCanvas = useCanvasA ? canvasA : canvasB;
    const activeCtx = useCanvasA ? ctxA : ctxB;
    activeCtx.drawImage(lastBitmap, 0, 0);
    currentCanvas = activeCanvas;
    useCanvasA = !useCanvasA;
    // Ensure it is initialized only once.
    if (!fmvEntity) {
      fmvEntity = cesiumViewer.entities.add({
        polygon: {
          hierarchy: new Cesium.CallbackProperty(() => currentHierarchy, false),
          material: new Cesium.ImageMaterialProperty({
            image: new Cesium.CallbackProperty(() => currentCanvas, false)
          }),
          classificationType: Cesium.ClassificationType.TERRAIN,
        }
      });
    }
  cesiumViewer.scene.requestRender();
}, 33);

```

I also explicitly call `scene.requestRender()` to force re-rendering in request render mode.

* * *

And this is my [sandcastle](https://sandcastle.cesium.com/#c=pVfrbtpIFH6V01QqZkVtcJo0gSRdStImUi8RQe2PZYUGe8CztT3emTGErfIw+yz7YntmxgYbSLPVhkgwnnO/fOeYJRkXCn4BImFAJcsTmAmewPggMKfxQW+cjtOAp1LBgtElFXAOKV0W1O4X88wp6Qc8VYSlVIwPmobT8+Bc/8Elz6cxhQFJF6jrbkmyjKVzcMiCs7DULSgJ9dNlxJA2FGSJp6aVUFoRGAl9NCPkQZ7QVLkB8il6FVN9chqWoqENqLK8/SkWda9VFMrcOVXaNXqPtH5Yp3u7pnu7j26cxlRBLulgbbgSOe3Z50EuBFpQhAVDm8dx/eqaUUFEEK02t6XyQf/Tl/7d5OvN5egab486fm/r6vrq5v31aH2Ht4VDSxaqqGJ4ea6K7G3II8rmkarQrx/UFNVTPlpyYAmZUwnOV/aNJTRkBAafh3cg80wXHg23kmvIO0WJ3eiDo2NoH2PSuJSfBZuzFEkaJOXpKuG5bGxIpAj0VaRUJruel2cxJyF6V2h3uZh7+pTpkxfwJEG9noryZOqdeqevvVFEJ1dEqGgiKU0nuhsm/YzHMZ90Xrt/ZHPv0G9n9y+fpGtUEmWM8/e75T/tlv+/3Gp77VfeLREkJRPBFlRMQhorUvFl/2Wjns13PBcQcIHNjV9cYKNiB2FqRwTVMgiwVqlogWRJHuNNCIQKRmIg2GrbPWzE6Hr/bZwCfIeYp13o+B331fGrk6MWoIAu+Edux2934KEFgGYonr2M6UztcBx1fsAhdJ0+wdI5PS1ZplwpnjzCVTdtl8ta93s9bkOaS2Kgz2Icn/5BAyVL5Hs/AEqCCGGXJHQrT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/vM3DPX2Cpd6e21Yqu5/AmioIrOODA6odru9NUhuErNoI+zlWai/lhFNy7cbjTVlmIr3EJ7ah1DExOBoEYtmTSM8bNb8vVyPMlXNS3HlwV3bFlFpS5XjoHVwJnWnmI3xV2Zf/HMRO67rKYqYrrd5b5oH3yi+Hkuz1515JctZyBbAwvM9L/p2AcGbGb6d3rG/6Pjg4sxD+hpbgccFdGiSqHOxAaIzD4+7XIpz3ItEReK/). After starting it, when I zoom in and out on the map, I can clearly see flickering black lines.

---

_[View the full topic](https://community.cesium.com/t/intermittent-black-line-rendering-artifacts-when-adding-images-via-entity/46435)._
