Announcement

Collapse
No announcement yet.

How to intermittently updating a texture with a jpg?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to intermittently updating a texture with a jpg?

    Hi,
    I am not a pro at ue4, so the answer may be obvious. I have a jpg I am downloading from a url, and that gives me the jpg as a raw TArray<uint8> and I need to get that image to a surface. I was just telling the image to save to disk and then was using blueprints and using ImgMediaSource->Media Player->Media Texture. But the problem doing this is that the img changes and this process only works once, and when the image is updated, unreal tells me "# changes to source content files have been detected. Would you like to import them?"
    So what I am asking is, what is a common way to take a jpg TArray<uint8> and put it on a surface in the game, that needs to be updated every 5 mins?
    Thanks
    Last edited by RudeCoffee; 10-20-2019, 03:59 PM.

    #2
    Tip: Jpg is one of the worst file formats by far for ue4. Use png/targa. All textures get compressed or are stored uncompressed anyway, jpg compression shreds texture quality and usually makes normalmaps completely unusable, PNG doesnt.
    Also, we need extra detail, Are you trying to update a shader every 5 mins?

    Comment


      #3
      Alright, so I have figured out how to take the jpg and use an ImageWrapper and turned it into a Texture2D. But now I am trying to figure out how to get the Texture2D to my material's TextureSampleParameter2d
      Last edited by RudeCoffee; 10-20-2019, 10:28 PM.

      Comment


        #4
        I HAVE DONE IT, well this has been a full day of learning. Thank you Bits360
        I learned about the UMaterialInstanceDynamic class and that did the job, taking the jpg->ImageWrapper->Texture2D->MaterialInstaceDynamic.

        Comment

        Working...
        X