Custom material in C++


I have a custom shader/material question I cannot seem to find an answer to. Basically, I have three shaders - vertex, geometry and pixel. I also have geometry I need to render using these shaders. I get to the point where I am calling FPrimitiveDrawInterface::DrawMesh - however, the ‘FMeshBatch’ expects a FMaterialRenderProxy* parameter to be set that I would expect to contain those shaders I need. What I need to know is: how to create a custom FMaterial (or whatever) from my shaders?

I only found two questions on this site to this topic and none really answered the question I have so I am trying to post my own to get a definitive answer. Thanks in advance for any input!

Have you found a solution to your problem?

Nope,. I have long since switched to Unity 5 that makes it trivial to write such custom rendering paths

a similar problem :

Thanks for the reply, but I know it is so, better to read what is written in the first post

Unreal only provides graph material editing unlike text for that Unity have, but both just add to deeper more complex shader system that engine habe. if you want to add any shader code in UE4 you need to write usf file and some C++ code to control it, but ofcorse this won’t avoid you to make material.

Material editor also provides code node allowing to add the code

Not ot mention you can just make graph doing exact same thing as your shader code, all code material graph is converted to HLSL code so there is no performance impact. Only downside of using material graph is lack of ability to loop and fact you are limited to nodes that there is.

I just replaying to main question :stuck_out_tongue: