# Image black edge blending

**URL:** https://forum.castle-engine.io/t/image-black-edge-blending/1245
**Category:** 2D
**Created:** [June 26, 2024, 5:26am UTC](https://forum.castle-engine.io/t/image-black-edge-blending/1245 "2024-06-26T05:26:48Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![michalis](https://forum.castle-engine.io/user_avatar/forum.castle-engine.io/michalis/32/3_2.png) [@michalis](https://forum.castle-engine.io/u/michalis)
#### Post date: [June 29, 2024, 10:50pm UTC](https://forum.castle-engine.io/t/image-black-edge-blending/1245/10 "2024-06-29T22:50:55Z")

</div>

Ah! Thanks, I see you pointed the arrow at the problematic spot in your first post, I didn’t look at it carefully enough 🙂 OK, I see the problem and I understand what you want (from the movie),

As for:

> [@a493203176](#):
>
> BlendFunc cbl = { backend::BlendFactor::SRC\_ALPHA, backend::BlendFactor::ONE

→ these settings are definitely controlled by the `RenderOptions` mentioned above. You can set equivalent settings by

- `RenderOptions.BlendingSourceFactor` = `bsSrcAlpha`
- `RenderOptions.BlendingDestinationFactor` = `bdOne`

But indeed this, as of itself, will not give you the desired effect. The alpha of your image is not ready for this.

To make it work, you need to implement the 2nd setting you show, where from a quick glance the critical thing is “grayscale value of source primitive’s pixels will be used as an alpha value”. The way to solve this:

1. I would recommend you just process your images to set the desired alpha channel of them.

2. Alternatively, if you really want to simulate an effect at run-time like the engine you show on the screenshot, you can write a simple “shader effect” in CGE that derives “effective” texture alpha from texture RGB color.

---

_[View the full topic](https://forum.castle-engine.io/t/image-black-edge-blending/1245)._
