Convert a texture channel to a Texture2D

Hi, it is possible to convert a texture sampler`s channel to a Texture 2D? I would like to have 4 individual information in each channel and use it in functions like the NormalFromHeightMap. However, it only accepts a Texture 2D, making me work on each image individually inside photoshop.


Hey danielvmacedo -

Currently there is no way to take a Texture Sampler and convert to a Texture Object (T2D input). However, the NormalFromHeightMap is a Material Function and you can pull the Instructions out of the Material Function and then use the regular Texture Samplers OR create a copy of the Material function and replace the Function Inputs in the Material Function with the actual Texture Samples you want to use. OR copy the function and pull off the texture samples in the Material Function from the appropriate RGBA channels then when you place the T2d it will pull the separate channels of that Texture as you have set up.

Thank You

Eric Ketchum

This was what a actually did =), thanks! Don’t you think that it could be a nice feature to have for material node setup!?

Hi, could show me how to do this?

Hi -

I think you mean how to pull out the information from a Material Function and place it into your Material. If so:

Let’s use the NormalfromHeightMap Function for our example:

Open a New Material and place the above Material Function in your Material. The Double Click on the NormalFromHeighMap Node to open the Material Function. You can then select all the nodes in the Material Function minus the Output nodes and copy them. Back in your material paste them. You will have to go back and replace all your Function Inputs which will not paste correctly, but using the original Function as your guide it is not to hard. Finally your copied nodes will allow you to use any nodes that can be used in a Material, like the Texture Sampler.

Thank You

Eric Ketchum


I’ve been following along, but I’m a bit stuck. I’ve copied the function and I called it back into my material. And I’ve replaced the texture objects with my texture samples and that part works. but… I want to control normal map blending through vertex colours from height information, but unreal is being a bit of a pain. This is what I have:

Painting my objects with vertex colours have no impact, whatsoever.

  1. Can I not pull vertex colour information inside a material function?

  2. How can I get vertex colours to control the normalsFromHeightMap function?

I know that this was years ago, but I found myself wanting an answer. This seemed a bit complex for a simple action, so I managed to find a very easy way for those who stumble upon this. In the following image, I am getting the material of my gun, finding the PatternMap texture, casting to that texture as Texture2d, then setting a variable in a Widget that is of type Texture2d. The Widget then displays the texture. This seemed to do the trick!

I tried! But It failed while casting texture to texture2D.

My cast success but the texture returns null!


Use FlattenNormal