Iterate through pixels of textures/images

Is it possible to iterate through all the pixels in a texture and get color values in Blueprints?
I am trying to generate spawn objects based on this values.

Hello KenzaburOe,

I have a setup that you may be able to use for your value collection. Please note that this will not go pixel by pixel but you can pull out the color values of a texture in blueprint.

Things that you will need:

  1. A material parameter collection
  2. A Texture that you would like to use
  3. A material
  4. A Blueprint

Step one:

To create a Material Parameter Collection you will want to go to the folder you would like to store it in (in the content browser) Right Click > Materials & Textures > Material Parameter Collection. Go ahead and name this as you would like. Open your MPC (Material Parameter Collection) and set it up like the following:

Step two:
Open your Material. To access the Collection Parameter Right Click > Type “Collection”. After this you will need to bring in your texture. Right Click > Type Texture Sample > go into the Details panel and assign your texture. Then finish by setting up your material as follows:

Step three:
Open your Blueprint and you can Set/Get Scalar Parameter Values from there Here is an example:

Please Note: In UE 4.5 as of 10/15/2014 there is an issue with this method. If you would like to try this in 4.5 you will need to do this in 4.4 and migrate these assets to 4.5 or preform this in 4.4 and upgrade the project to 4.5.

Hello Rudy, this looks great, but im missing something… how can you promote or copy the numerical colour value from the texture into a parameter? There must be a way, surely? Do hope you can help

Hello Rudy, this looks great, but im missing something… how can you promote or copy a numerical colour value from the texture into a parameter (to share between blueprints)? your answer implies that its possible but I cant see how

There must be a way, surely? I want to use an MF-generated pattern to drive a material, but also use it to drive actor behaviour. Im sampling the material in a scenecapture2d to a rendertarget - ,and then trying to extract colour data for a central pixel from that.

Textures / materials are a great way in principle to store complex data, if we could transfer data in and out…

Ive tried lots of approaches, its very frustrating that nodes available in one blueprint type are not available in other types…

Looks like I have to recreate the material function inside a blueprint, and then have the problem of creating a UV input the same as that in the material…

thanks

“how can you promote or copy the numerical colour value from the texture into a parameter?”

I have exactly the same question!

As far as I know it isn’t possible to pass values from a material back to a blueprint (at least that’s what I was told) so I was very intrigued by this post.

‘Get Scalar Value’ only retrieves the value of the U_Control/V_Control collection parameters.

Rudy, did you actually (somehow) retrieve a pixel colour in your blueprint?

I have the same question