i would say no… not in the editor…
the reason is that the real shader sourcecode depents on the target platform (d3d vs opengl vs gles)…
maybe the documentation on shader development has something more…link text
if you want to do this because you already have the source code from somewhere else i would recommend to reverse engineer it…
analyze what the shadercode does and recreate it in ue until it matches… this way your material will work an every device and in future(dx12 is coming) and you don’t mess with ue’s way of handling materials…
I would like to provide directly the shader source code for a material, instead of using the visual elements. Is this possible to do in the UE4 editor? If so, how?
And if not possible directly in the UE4 editor, is there another way to put shader source (eg to then make it available in the editor)?
In editor only via “Custom” node
but there few limitations:
- Code you entered is applied as it is
and shader languege depends on
rederer (DirectX will use HLSL,
OpenGL will use GLSL, Playstation
gonna use something else), so using
it will make your game less portable
- “Custom” block is not very friendly
to use with your shader functions, as that
code it self is forcefully contained
in function already and sometimes
it’s very hard to convert same
functionality of functions in blocks.
In UDK/UE3 i find a way to work
around it by calling generated
function from custom blocks, but it
was very hackish, no very suitable
method for retail game hat should
work for 100% and i’m not sure if
same trick would work with UE4
material editor.
So in general it’s better if you try to recreate your shader in nodes, if not then best solution is to dive in to Unreal Endine source code and implement features you need, but i’m myself don’t know where to start with this.
Keep in mind that unlike Blueprints material graph is directly converted in to shader code, so you should not worry about performance ;]
Very informative, thanks!
Thanks for the recommendations, it really seems the way to go