# Jagged edges in HTML graphics

**URL:** <https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408>\
**Category:** General\
**Tags:** template, html, server\
**Created:** [February 11, 2024, 4:00pm UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408 "2024-02-11T16:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![noumaan](https://casparcgforum.org/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@noumaan](https://casparcgforum.org/u/noumaan)\
**Post date:** [February 11, 2024, 4:00pm UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/1 "2024-02-11T16:00:00Z")

</div>

Hi,  
I am experiencing jagged edges in CasparCG HTML graphics. This issue is only present in CasparCG and does not occur when using the same HTML page in Chrome browser, vMix v26, and the latest OBS.

server: CasparCG 2.4 RC1  
system: windows 10

```auto
<!DOCTYPE html>
<html>
<head>
  <style type="text/css">
    body{
      background: black;
    }
    #box {
      position: absolute;
      top: 20%;
      left: 20%;
      width: 50%;
      height: 50%;
      background: linear-gradient(-45deg, #7A0000, #C20000, #DE3F3F);
      border-block: 6px solid whitesmoke; 
      transform: perspective(700px) rotateY(-6deg);
}
</style>
</head>
<body>
  <div id="box" />
</body>
</html>

```

 ![sample](https://casparcgforum.org/uploads/default/original/2X/4/4f213f223f2973704a59bc9172d48080c8f452f3.png)

this is the output from vMix with same html

 ![vmix sample](https://casparcgforum.org/uploads/default/original/2X/5/53a87d59f8dc1828f8aa5973ca802429228c6bc7.png)

adding `outline: 2px solid transparent;` to html making it smooth in CasparCG server.

 ![sample with outline](https://casparcgforum.org/uploads/default/original/2X/6/6d4c5b27e0e0bd0cdb2dd5ebf4804673c2feddc1.png)

but something is still not smooth as this is the output from cg server to vmix via ndi.

 ![cg to vmix](https://casparcgforum.org/uploads/default/original/2X/0/03d57f69b832f4aec33a4a0d81acca14b5573abd.png)

---

<div class="post-metadata">

**Author:** ![bifuteki](https://casparcgforum.org/letter_avatar_proxy/v4/letter/b/b5ac83/32.png) [@bifuteki](https://casparcgforum.org/u/bifuteki)\
**Post date:** [February 12, 2024, 2:33am UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/2 "2024-02-12T02:33:23Z")

</div>

What is your casparcg.config file look like? That can be very telling.

---

<div class="post-metadata">

**Author:** ![Julusian](https://casparcgforum.org/user_avatar/casparcgforum.org/julusian/32/12_2.png) [@Julusian](https://casparcgforum.org/u/Julusian)\
**Post date:** [February 12, 2024, 9:59am UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/3 "2024-02-12T09:59:48Z")

</div>

Does it look any better/different if you set `angle-backend` to `d3d11`? [server/src/shell/casparcg.config at a6fdb6a5a54cfa4ee4790e3c738d8d4853dc18eb · CasparCG/server · GitHub](https://github.com/CasparCG/server/blob/a6fdb6a5a54cfa4ee4790e3c738d8d4853dc18eb/src/shell/casparcg.config#L59)

Could OBS /VMix be injecting some CSS/JS to enable some antialiasing?  
It looking different in caspar to vmix via ndi is strange, unless vmix or ndi is messing with the frames in some way

---

<div class="post-metadata">

**Author:** ![noumaan](https://casparcgforum.org/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@noumaan](https://casparcgforum.org/u/noumaan)\
**Post date:** [February 13, 2024, 7:09pm UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/4 "2024-02-13T19:09:43Z")

</div>

> [@bifuteki](#):
>
> What is your casparcg.config file look like? That can be very telling.

```auto
<configuration>
    <paths>
        <media-path>media/</media-path>
        <log-path disable="false">log/</log-path>
        <data-path>data/</data-path>
        <template-path>templates/</template-path>
    </paths>
    <lock-clear-phrase>secret</lock-clear-phrase>
    <html>
        <remote-debugging-port>8081</remote-debugging-port>
        <enable-gpu>false</enable-gpu>
    </html>
    <channels>
        <channel>
            <video-mode>PAL</video-mode>
            <channel-layout>stereo</channel-layout>
            <consumers>
                <decklink>
                    <device>1</device>
                    <key-device>1</key-device>
                    <embedded-audio>true</embedded-audio>
                    <latency>normal</latency>
                    <keyer>external</keyer>
                    <buffer-depth>4</buffer-depth>
                </decklink>
                <ndi>
                    <name>ch2</name>
                    <allow-fields>true</allow-fields>
                </ndi>
            </consumers>
        </channel>
    </channels>
    <controllers>
        <tcp>
            <port>5250</port>
            <protocol>AMCP</protocol>
        </tcp>
    </controllers>
    <amcp>
        <media-server>
            <host>localhost</host>
            <port>8000</port>
        </media-server>
    </amcp>
</configuration>

```

> [@Julusian](#):
>
> Does it look any better/different if you set `angle-backend` to `d3d11`? [server/src/shell/casparcg.config at a6fdb6a5a54cfa4ee4790e3c738d8d4853dc18eb · CasparCG/server · GitHub](https://github.com/CasparCG/server/blob/a6fdb6a5a54cfa4ee4790e3c738d8d4853dc18eb/src/shell/casparcg.config#L59)

Tested it with d3d11 but it’s not doing anything with aliasing/jagged edges.

> [@Julusian](#):
>
> It looking different in caspar to vmix via ndi is strange, unless vmix or ndi is messing with the frames in some way

i think vmix is doing something with the frames as below is the output from CasparCG to media express via decklink output

 ![media express](https://casparcgforum.org/uploads/default/original/2X/d/db18ba9ca2611e884db6ab43bc5e2b6dd9020705.png)

---

<div class="post-metadata">

**Author:** ![mdsh](https://casparcgforum.org/user_avatar/casparcgforum.org/mdsh/32/387_2.png) [@mdsh](https://casparcgforum.org/u/mdsh)\
**Post date:** [February 14, 2024, 2:31pm UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/5 "2024-02-14T14:31:22Z")

</div>

Is the difference because CasparCG is running interlaced and VMix is running progressive?

---

<div class="post-metadata">

**Author:** ![agatin](https://casparcgforum.org/user_avatar/casparcgforum.org/agatin/32/48_2.png) [@agatin](https://casparcgforum.org/u/agatin)\
**Post date:** [February 14, 2024, 10:46pm UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/6 "2024-02-14T22:46:22Z")

</div>

Your problem is in the config.  
I see you are using PAL and that’s SD resolution.  
Try 1080p5000.

---

<div class="post-metadata">

**Author:** ![noumaan](https://casparcgforum.org/letter_avatar_proxy/v4/letter/n/dfb087/32.png) [@noumaan](https://casparcgforum.org/u/noumaan)\
**Post date:** [February 16, 2024, 11:42am UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/7 "2024-02-16T11:42:04Z")

</div>

> [@mdsh](#):
>
> Is the difference because CasparCG is running interlaced and VMix is running progressive?

don’t know what are they doing. maybe they are using different subsampling.

> [@agatin](#):
>
> Your problem is in the config.  
> I see you are using PAL and that’s SD resolution.  
> Try 1080p5000.

Jagged edges in HTML are more about antialiasing than resolution.  
Adding `outline: 2px solid transparent;` is a handy workaround to trigger antialiasing and get those smooth edges back.

here is the output of 1080p5000 without outline css.

 ![1080p5000](https://casparcgforum.org/uploads/default/original/2X/0/0d5c37741831c65a1c50b3e03836e89b95a0a970.jpeg)

---

<div class="post-metadata">

**Author:** ![aircooled76](https://casparcgforum.org/letter_avatar_proxy/v4/letter/a/ecae2f/32.png) [@aircooled76](https://casparcgforum.org/u/aircooled76)\
**Post date:** [February 18, 2024, 7:21am UTC](https://casparcgforum.org/t/jagged-edges-in-html-graphics/6408/8 "2024-02-18T07:21:26Z")

</div>

Had this trouble, turned on text smoothing in Windows and it fixed it.
