Am i right that unreal can't get a simple color value from a texture?

This seems like a really simple thing but from searching and trying all sorts of stuff i can’t seems to take a texture in the material editor and get an average color output to use.

Im doing it for a small lighting project like those tv’s which give ambient lighting behind based on the colors of an image.

Unreal doesn’t seem capable of it so im not sure if unity might be better for the job?

can you provide a reference to what exactly you want it to look like?

Im trying to get something like this.

In the material editor you have inputs like textures and colors. You can easily change a color and use it as if it was a texture but you can’t seem to take a texture and get a common color output for use with something like a point light.

It’s limitation of shaders and GPU overall, note that material is a shader, graph you making is turned to HLSL code so you directly bound to it’s features and limitations + in UE4 you also bounded to limitation of UE4 rendering process and how it handles shaders. In shaders as code you can process only one pixel you actively working on and you can request pixel color only from samplers (in UE4 nodes with UV input). Sadly there no way of getting frame you working on as it simply… not ready yet, you sahder code walking on it :stuck_out_tongue: And with UE4 you can only get pixels behind object (SceneTexture), pixels reflections and stuff like that.

Theres a quite simple but little bit expansive work around, make a material function insted of material, make it input UV map and with that UV map generate pixel you would generate at that position, then in main material use that function to regenerate pixels from other positions. If you want to optimize it more you dont need to use material function and make diffrent liter way to recostruct those pixels dpending on need, material function would simply look nice insted of copy pasteing same graph

On thing you trying to do you could maybe do something on Post Processing level

I’ve created an effect like this in Unity but haven’t had a chance to try it in Unreal Engine, yet. But the same approach should be valid…

In Unity, I placed a camera directly in front of the screen so that it only captured the screen. I had this camera render its output to a very low resolution (2x2) texture. The result was that it averaged the colors for me. I then used that texture in a custom shader to produce the glow/flicker effect.

In Unreal, I believe you’d use a Scene Capture 2D object as your camera and have it render to a Render Target texture asset. You could then use this texture asset in a custom material to do whatever you’d like with the averaged color it produces.

Caveat, I haven’t yet tried this so I can’t promise it will work. But try it and report back here if you succeed!

I forgot about this but to anyone looking it turns out to work but im not sure the colors are quite right?

Im still hoping there’s a trick to convert textures to color values as it could possibly give more control and better results?