# New dev - How to dynamically grab neightboor/material color for outline post process 

**URL:** <https://forums.unrealengine.com/t/new-dev-how-to-dynamically-grab-neightboor-material-color-for-outline-post-process/2561432>\
**Category:** Rendering\
**Tags:** Post-Processing, outline, unreal-engine, Post-Process, Blueprint, question\
**Created:** [June 17, 2025, 2:38am UTC](https://forums.unrealengine.com/t/new-dev-how-to-dynamically-grab-neightboor-material-color-for-outline-post-process/2561432 "2025-06-17T02:38:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rademon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rademon](https://forums.unrealengine.com/u/Rademon)\
**Post date:** [June 17, 2025, 2:38am UTC](https://forums.unrealengine.com/t/new-dev-how-to-dynamically-grab-neightboor-material-color-for-outline-post-process/2561432/1 "2025-06-17T02:38:11Z")

</div>

Hello everyone! I hope you’re doing ok.

I followed this great tutorial to create a outline post process material [https://www.youtube.com/watch?v=9KvUfnrHcqM&list=TLPQMjkxMTIwMjTRafr2u88eyQ](https://www.youtube.com/watch?v=9KvUfnrHcqM&list=TLPQMjkxMTIwMjTRafr2u88eyQ) and it is working great but what I would like to do is change the hardcoded color I gave it to a group of node or a function that would be able to grab the color of the pixel next to it that is inside the outline and set the color to a darker version of it only for this pixel so tree leaves get a dark green outline, walls get a darker version of their colors etc. Hopefully something dyanamic that can work with multicolored characters/materials/environment instead of a fix of manually setting ONE outline color for each object even if they have more than 1 material and/or color.

While looking for something like this I stumble on that old post and that’s basically what I want. (I have no idea if we can private message others were aren’t friends with here though and couldn’t find the option so that’s why I’m asking here :)) [https://forums.unrealengine.com/t/how-to-color-outlines-by-objects-material-color/2159080](https://forums.unrealengine.com/t/how-to-color-outlines-by-objects-material-color/2159080)

Thanks for reading me, have a nice day!

---

<div class="post-metadata">

**Author:** ![Dasay2605](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dasay2605](https://forums.unrealengine.com/u/Dasay2605)\
**Post date:** [June 19, 2025, 2:13am UTC](https://forums.unrealengine.com/t/new-dev-how-to-dynamically-grab-neightboor-material-color-for-outline-post-process/2561432/2 "2025-06-19T02:13:47Z")

</div>

I think you can try to do the following:

- On the edge, you will choose a base color based on the depth. So the pixel closest to the camera will be used as the edge color.

That’s it. The material setup itself may seem terrifying, but in practice it does exactly what I wrote above.

So the material function I created looks like this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/8/e288682d9978cdff77546eb4eade5a619daeb473.png)

There is one “thickness” input and an output which is an RGB color. The purple and blue are just named rerouting notes used to clean up messy connections.

Then you just use this function instead of the default colors. You can then divide the color by scalar parameter to darken it or do whatever you want.  
This may not be a perfect solution, but I hope it will work for you.

---

<div class="post-metadata">

**Author:** ![Rademon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rademon](https://forums.unrealengine.com/u/Rademon)\
**Post date:** [June 23, 2025, 10:50pm UTC](https://forums.unrealengine.com/t/new-dev-how-to-dynamically-grab-neightboor-material-color-for-outline-post-process/2561432/3 "2025-06-23T22:50:06Z")

</div>

This work so well! Much better than the “solution” I came up with, thank you so much 🙂
