Download

[Blueprint] Read, Create and/or Modify Texture2D Objects in blueprint

I can’t find any way of reading or writing texture data from within a blueprint. I can think of a myriad of ways that this could be used, from being able to use a texture to place objects in a scene to being able to create truly procedural textures to being able to procedurally generate and modify landscapes. So many ways this could be applied… If this functionality doesn’t exist, I propose allowing blueprint to read and write texture2d objects, represented as a 2D array of vector4s (which is basically just what a 24-bit texture is). Would it be possible to get this added to the Trello roadmap to see if there’s any interest in such functionality from the community? Cheers,

J^2

Hey J.J. Franzen -

Have you tried to use Texture Parameters which can be called and changed within a Blueprint? I linked to an example project with the setup I am referring to. I am using a basic Dynamic Material with the Texture Parameter but you should also be able to use the same basic setup with material functions as well. You just have to setup the parameters.

Let me know if there is additional behavior you are looking for -

Hi Eric. Thanks for the reply. I’m trying to grab that zip file but it’s not working. Only error I get is:

9ade075d7c5804e540d0f7c09611268790e48d36.png

Any suggestions? I’m looking for a way of using a texture map within a blueprint to define where I can place an object or objects. So, I need to be able to read individual pixel data from a texture. Ideally I would like to be able to access a texture as if it were a 2D array of vectors. I don’t see this as being possible at the moment. Am I missing something? Cheers,

J^2

Thank you for the reply and the zip file. I’m looking at the project now. The functionality you demonstrate there isn’t what I’m talking about at all. I understand that it’s possible to modify parameters and settings of a texture or material from within a blueprint. I’m talking about accessing the image data of a texture directly. I want to be able to read the color value of a specific texel and use that information in a blueprint. It would be awesome to be able to set that texel data as well as read it as it would allow for procedural textures and a heck of a lot more from within a blueprint.

Am I making myself understood properly? Here’s an example. Let’s say I have a terrain mesh, and I want this mesh to have a forest on it. But I don’t want to use a landscape object or the foliage system. I want to be able to paint a 2D texture that I can use in blueprint to define where trees should be placed. I could even use different colors to control the placement of different meshes or objects, if the texel is blue, place a grass mesh, if it’s purple, place a flower mesh, if it’s green, place a pine tree, if its gray, place a rock. And this is just what one could do with the ability to read texel data from a texture. If you were able to write texel data to a texture, well, you could do just about anything you could imagine.

Please let me know if you aren’t understanding my question and I’ll try to make a visual example of what I’m looking for. Cheers,

J^2

Being able to turn an image file into an array of data would be pretty useful for quite a few things. I bet I could take an image of Earth and convert it directly into an in-game world map if I could do that. :slight_smile:

Would it be possible to get this onto the Roadmap Trello to see if the community thinks it would be a useful addition? Just wondering if it’s only me who is wishing for such a feature… Cheers,

J^2

Yes please, this would be handy in blueprints.

Posted a request in the roadmap thread. Hopefully it gets some traction there.

Hi Guys -

I placed a feature request in for reading texel inmformation directly from blueprints today, UE-13758.

Outstanding! Thank you Eric. I’m eager to see what the response will be. Cheers,

J^2

There have been a few discussions about this here actually, I can certainly see how it would be a powerful tool! There are a couple of concerns though.

On the reading side, right now we upload textures to the GPU memory and then release them from main memory, so we would need some way to keep a copy in main mem that could be accessed by Blueprints. Means knowing the textures in advance (or copying back from GPU mem), and could use a fair bit of RAM.

On the creating texture side, the thinking right now is it would need to be limited to editor-only. Blueprints are just not really fast enough to process large 2D arrays of data at runtime. You’d also need to compress and store that ‘source data’ so it could be converted to platform-specific formats during cook.

We’ll certainly keep it on our radar!

Using Rama’s new pixel reading nodes:

If not through blueprint, I s there any way of writing texel data in c++?

Hi everyone. Any news on this? I’d love to see something like that implemented. Alternatively, why isn’t the already existing noise function usable inside the blueprints? That too would be really useful. I tried to install some procedural noise plugins but since I’m working on a blueprint only project apparently there’s no way to make them work, so that would be really wonderful to have one of those options avaiable…

Any chance you can show the Blueprint to read pixel value?

Did you use the “Victory BP Library|Load Texture From File” node?