Download

How to set decal image (C++)

Hey guys im looking for a way to set the image of a UDecalComponent using c++…I want to get the image from a website link…Can someone please help me

I do not want to use blueprint I am comfortable with c++ only.

Thanks!

You can use Rama’s blueprint library to read the image from web. You can create a material instance dynamic, feed it with the image you got and apply it on decal.

Is there anyway to do this with c++…I dont really like blueprint.

I just spent 5 minutes on google.

  1. searched for “unrealengine download image”
  2. Read a few answerhub things that talk about the ImageWrapper blueprint node
  3. Went to github and looked at the source code for the blueprint

https://github.com/EpicGames/UnrealEngine/blob/ab237f46dc0eee40263acbacbe938312eb0dffbb/Engine/Source/Runtime/UMG/Private/Blueprint/AsyncTaskDownloadImage.cpp#L61

Looks like you can just load the class and call DownloadImage, or collect all the relevant bits and write your own function.

To answer you rant, people aren’t answering because you aren’t showing initiative. To give an idea of the mindset you’ve put everyone in - I was actually tempted not to answer just because all you were doing is writing bump rather than saying what you are doing.

Just writing “I want a Ferrari” and then “bump bump bump” wont get me a Ferrari. Where as explaining how I’m trying to earn the money to buy a Ferrari might just get some help…

NB. This is only half the answer, I also googled how to get a downloaded image into a Material. Why don’t you show your working (Even if its just pages you found on google that you think are relevant) and I’ll steer you in the right direction.

First off thank you for answering! I was just getting frustrated because I would think something like this would be a nobrainer…after being able to do an http request to an api. My goal is to make a pokemon style game so I connected to pokeapi.co rest api…to get all the data I need to attach to a pokemon class. So what I did do was follow the tutorial on unreal engine learning page, programming tutorials, and followed how to apply a material to a boxcomponent. So Instead of doing the /Game/shape/…path I was using the url for the image but that didnt work…

So I appreciate you steering me into the right direction…I will look into this right now! The github link produces a 404.

Im trying to follow this here:

&d=1432154210

Hey GeekyPayback! I was able to replicate the blueprint but its not working for me…
The cube shows missing texture. I washed the flow as I was playing the game and it flows through the success…but the cube never gets textured :?

Here is a screen shot of my blueprint class:

Your attachment doesn’t work. I can’t see what you have posted. I will have a go at doing this myself later today.

Thanks!! this link doesnt work?

nope. Doesnt work, says invalid attachment

I just set up the blueprint on a test level to download this image - http://cdn.bulbagarden.net/upload/thumb/0/0d/025Pikachu.png/250px-025Pikachu.png

This is my level start blueprint

downloaded-image-blueprint.PNG

Here is my material (very complex!)

f1ca90a3ae3d83bbe272da25b48471f7d289c712.png

And this is it in game with log messages and picture of an electric rodent.

9c3aa0b852e6a77ca24d8c1d35e86874e7215f33.jpeg

So using the blueprint definitely works. Next step is figure out what you’ve done. Have you added log statements (like mine) to check your code is definitely firing?

Capture.PNG.jpg

I must be missing something because it says that the download succeeded but does not get applied…

ahhh i got to create a 2D material!!!??

ok i just created a material just like you and it still doesnt get applied to the cube… only the parent material gets applied…not the downloaded one.

Your “Create Dynamic Material Instance” node does NOT have a Parent. If you look in your last image carefully it says “Select Asset” which means its value is currently None/NULL/nullptr. In this case the engine will use the default material. Which is this grey checkerboard. In the first image @GeekyPayback posted, the Parent is specified as “DynImg”. And the required material setup for it is in the second image. Also your parameter name must match the TextureParameter name used in the Material.

I need to chime in on this one.

@novellof some of your posts bumping this thread are less than five minutes apart and are pretty much considered spam. Our unwritten rule around here is that we allow bumps if threads go inactive for four or more days, but we rather people don’t do it at all unless you’re posting something useful. Please be sure to study the forum rules. Most of what was in this thread should be considered spam, so I’ve cleaned it up.

Posts like these are also against the rules, and in future will earn you an infraction. As a side note, this is also not a good way to encourage people to help you - especially in the C++ forum. Again, please respect the forum rules:

Best of luck finding a solution.

Thank you!!! It works! It was because of

  1. missing parent
  2. paramter name did not match up with the texture
  3. ***had to restart the engine for somereason after making these changes

Thank you GeekyPayback and UnrealEverything!

Sorry for spamming the forums out due to my frustration