How can I get image from URL and use it as texture?

Hi,

I wonder if I can download an image at the runtine, and use it as Texture, in UI or on some BSP.
I guess that we can can, but How ?

any ideas ?

thx.

I guess you can use libcurl (which is already included as a UE4 module) and then use a UTexture2D::CreateTransient to create a texture to be applied to a UMaterialInstanceDynamic. Does it make sense?

Some useful links:

Or you just use the Download Image node. Look here:

The plugin is not needed if you want to load the texture from the web. The node comes with the standard UE edition.

Hope that helps

I’m trying to set material onto object at run-time from texture, normal map, displacement map etc. located in the hard disk. To achieve this i need to create dynamic material instance and set the parameter to the material by loading the image file at run-time.

I’m creating material from texture & displacement map image file. These image files are loading from folder using Victory Plugin’s “Victory Load Texture 2D from File” Node.

I’m creating the material instance dynamic of the “test material”. Now I’m setting the texture and displacement parameter as shown in figure 4.
After creating material instance dynamic, I’m setting this material to the object.

figure[1] test material:

figure[2] texture:

figure[3] displacement map:

figure[4] Method:

Now here is the problem.

When I directly create material in material editor from texture and displacement map and set it onto object. It doesn’t generate** moiré pattern.**

But when I run-time set the material onto object using figure [4]. It will generate moiré pattern.

Here are the sample screen shots of both.

figure[5]: Material Editor result:

figure[6]: Runtime result: Imgur: The magic of the Internet

I think the “Load Texture 2D from File” nodes is not calculating the Mip Map correctly.

I tried with following nodes but the result is same.
1> “Victory Load Texture 2D from File” (Created by rama)
2> “Load Texture 2D from File by Extension” (Created by you)
3> “Victory Load Texture 2D from File Pixels” (Created by rama)

I hope you will take this request into consideration. I would like to thank you in advance for your time and attention in this matter.
Should you have any further questions or concerns, please do not hesitate to contact me.

Regards,

1 Like