Can I read a texture in blueprints?

This may be more of an engineering question but i’m looking to read a texture’s color values in a blueprint. I only need to read it once and was hoping it would be as simple as it is in materials, but i can’t seem to find anything in the forums on working with textures in blueprints.

Assuming I could provide some sort of “uvs” to determine the point i want to look at, is this sort of thing possible in blueprints? Or would i need to dig into C++ to add this kind of thing in?

Id also like to know :confused:

No, I’ve tried it. You would have to convert FTexture2D to FTexture2DMipMap to read it, but it’s not exposed to BP.

I would like to know how I could enable in blueprint, so that I can use in a blueprint only project. I want to be able to read texture in blueprint, so that blueprint can assign a material to a static mesh object according to the values of the texture pixels. Each pixel would represent data on a map, such as temperature, humidity, precipitation
ect. and then assign materials based on the climate created by the values read from the texture. I can then also pass that to a Procedural Content Graph, to spawn rocks and fawna.

Can a plugin do this if I make my own plugin?
A C++ project would be required to write a function in C++ to expose t oblueprints, and then I would not be able to change the project back to a blueprint only project correct (from my experience)?

So if a plugin would work, I am thinking this may be the only solution?
Other than, convincing epic UE5 devs a convincing enough argument to add it to native blueprint?

Sounds like you want Landscape Material Layers and Landscape Material Sampling using PCG

You would need to dig into c++ to do that, there are a few stackexchange questions about how to do approach it :slight_smile:

1 Like

Thanks for the resources, checking it out, this is beyond me at this current moment :frowning: Maybe at some point I can pay someone to create a plugin when it comes time in the project. This helps alot thank you!

1 Like

@blindminds The second answer was more for the original post, while the one above (this one) is more relevant to you and doesn’t require C++ or anything, you can do it with little-to-no programming knowledge :wink:

You don’t need any plugin or anything, all the functionality you’re describing is already in the engine :smiley:

I wouldn’t mind just reading the height from my RVT that powers the virtual heightmesh. Instead of a line-trace against the underlying landscape, I could exactingly place meshes ON the heightfield-mesh, or better, better-place my characters foot for IK…

I guess so, but not really? I mean, I get that I could create a landscape material using the informational textures, but that’s not exactly what I was hoping for. I want to read those textures to drive parameters in the materials and PCG graphs. Would I need to set the landscape material to the information material, spawn everything, then change the landscape material back? This seems like a clumsy method? Have two landscapes? One for specifically getting location information?

I might have misunderstood what you were looking for.

My understanding was that you were looking to spawn different types of meshes/material based on what’s painted on the landscape; basically this.

This video also shows the reverse process, i.e sampling a custom texture (not the landscape itself) and use it inside the world.

My understanding is either/or/and would work for your needs :wink:

1 Like

Thank you for he links, the second video is (i think) exactly what I was looking for. Will be digging into it soon!

1 Like