c++ "Texture Sample" & "Multiply" Node

I want to recreate this Graph bellow in c++

I found this question Creating a dynamic material instance on C++? - Asset Creation - Unreal Engine Forums which has some code for creating a material but i cant find anything for doing the color multiplication

Update:

I have updated as follows. First I created a new material

which takes a texture as an input parameter. I then use this code to load the material file

	static ConstructorHelpers::FObjectFinder<UMaterialInterface> DynamicMaterial(TEXT("Material'/Game/Maps/testDepthMat.testDepthMat'"));
	if (DynamicMaterial.Succeeded())
	{
		MaterialToGet = DynamicMaterial.Object;
	}

and then to draw the material to the hud

if (MaterialToGet)
{
	UMaterialInstanceDynamic* DynamicMaterialToUse = UMaterialInstanceDynamic::Create(MaterialToGet, this);
	DynamicMaterialToUse->SetTextureParameterValue(TEXT("depthTexture"), renderTarget);
	DrawMaterialSimple(DynamicMaterialToUse, thisX, thisY, w, h);
}

This draws just a black square in the HUD. The current material should not do anything to the color since it just multiples it by 1. Not sure whats wrong

In linked you gave there no material creation at all, it just shows how to send parameter to material (which is shader if you didn’t realize yet) which requires creating dynamic instance of material, which is not really creating new material. Instance is parameter state in memory which you can applying to multiple meshes on one go durring rendering, saving some performance.

So you need to do exact same things as answer in that question shows and in your material you need to place Scalar Parameter node with a input you gonna do in C++ function and plug it to B pin of Multiply and you ready to do. You do the same with any other parameter type and you can use multiple amount of them and control a lot of aspects of your shader with them. You can also create material instance as a asset in content browser.

thanks for the explanation, could you provide any code or references to documentation?

http://api.unrealengine.com/INT/API/Runtime/Engine/Materials/UMaterialInstanceDynamic/index.html

As for any C++ example i fint this video Unreal Engine C++ Tutorial - Episode 6: Dynamic Materials - YouTube around 13:00

thanks for the pointers, I have updated the question with code and the current problem of getting a black material drawn to HUD

The solution to the edited problem is to set the Material Domain to ‘User Interface’ in the editor