Code shaders in UE4 are woefully unsupported. I’ve been using material blueprints and custom nodes to make a soft body physics system https://imgur.com/a/isJcphttps://imgur.com/a/2KNot It actually works alright, can handle 125k nodes at 120fps, enough to do full body character animation- Replacing classic animation bones. Problem is, I can’t supplement it with compute shaders for the hard jobs like collision detection. UE4 is just going to fight me every step of the way.
https://docs.unity3d.com/Manual/ComputeShaders.html look at this! Actual easy support for code shaders out of the box! No spending a week fiddling and waiting on long compile times. And you can use the output to move mesh vertices without it tearing at the texture seams, unlike UE4. And (unrelated) their forward rendering path is battle tested and lets you access lighting data in shaders! At this point, I’m starting to think it’ll be easier to rebuild my whole project in Unity than keep going in UE4. Scratch the last few months I guess…
I must say that this is a huge problem for me as well. There are lots of shaders I wish to add and many I wish to replace entirely.
If I, for example, wanted to add a new preset for leaves, one for grass, etc. instead of subsurface, clear coat, default, etc. it’s a huge pain.
I also feel the BRDF system in general needs to be easier to modify as needed for different materials. This however is a little easier as I can simply open up ShadingModels.usf, change the default shading shader, and recompile shaders. However I wish I could do this within the editor.
I also want to add some Nvidia gameworks stuff like a Flow beta that I have, but it looks like such a huge chore and new code to learn, so it’s hard to find motivation to implement it when they plan on releasing it later for ue4 anyway.
In general I’m not happy with the UE4 shader setup. I’d like to be able to, from within the editor, open up a new tab where I write or modify a shader, then click compile, and boom there it is.
Epic, we know you love your node system, but please consider it as a nice-to-have for prototyping and not as a replacement.
Currently there is way too much functionality implemented with blueprint or material node interfaces - but we need to do serious stuff in C++ and HSL.
A Shading Model “Custom” would be nice, There you can either write HLSL Code directly, or you can point to different Shader Files.
It is important that we can write any Shader in the Pipeline.
(Sorry my English is not very good.) Really happy to have some people who need custom shaders. Hope UE4 can have this function soon. When people see our work, exclaimed is actually UE4. Rather than through the product to know is UE4 project.
I see this is an old thread, but I’ve had all the same frustrations the people in here are talking about. I was so happy to switch from Unity to Unreal a few months ago because of all the great tools it has, but I have been so frustrated by the materials that I’m seriously considering going back to Unity. I will have to do more programming there to get the same feature set unreal has automatically, but I know I will have complete control over how my game looks. I had some really beautiful shaders for foliage that I’ve been loathe to give up.
To be honest, I would like to just drop the deferred rendering entirely and do forward rendering for my game with custom shaders and colored shadows. Barring that, if I could at least set up my own shader models, that would fix 90% of my struggles.
The whole reason I want forward rendering is to use custom shaders with colored shadows on different objects, and blend static and movable shadows. Seems like they mostly added forward rendering for the anti-aliasing.
Forward rendering was added for VR performance. Colored shadows is very easy to do with modifying MobileBasePassPixelShader.usf if you use forward shading.
Does that involve modifying the engine? I’m not sure that’s something I could jump into very easily, but I’ll have to look into it.
EDIT: I think I’ll be switching to the forward renderer, here, after looking into it a bit. I really hope in the future they consider adding custom shader support right in the engine. I’m not an expert, but it seems like the reason it wasn’t there before was because it was using deferred rendering, so now it should be possible to implement!
I want to get into writing shader code and spoke to someone that said for the effect I want I need to write a fragment shader. Is that still not well supported?
A Fragment Shader is pretty much a Pixel Shader, which is what you make with the Material Editor. If you want to do anything freakishly advanced, you may have to write a custom .usf shader, but that’s no different to having to write a HLSL shader in any other engine really…
BTW - Pretty much all the Shaders can be modified even in a launcher build, I did some small mods to post-process shading for Satellite Command (adding anamorphic lens flares) - which shipped on the Launcher version of 4.12.
This strikes me as a similar issue to the blueprint vs C++ argument. Blueprint & Material Editor are both insanely powerful but made so that artists and non-experienced programmers can use them to generate good results. Creating a more complex editor for materials creates more problems than it solves.
C++ and .usf files are there for shader core programming. Sometimes you have to make engine source changes if you want to expose items to the details panel (like a custom post process pass for example), but most of the time you can get away with writing directly to the .usf files in a launcher build. Just make sure you back them up of course. Perhaps the most annoying part is no Syntax highlighting for .usf files… To be honest though, working with source engine isn’t as hard as it used to be. Grab a copy of SourceTree to make life easier.
I’d like to see more flexibility here too, but you can still do most of this stuff if you dig into USF files. Plugin support would be bloody nice though.
Just had a thought, that the single best addition to material editor at this point would be adding a Pass Switch material expression. It would allow you to have separate node networks for each pass, the material is rendered in. You can already have this behavior using custom node #if, but certain passes are inaccessible and some passes use simplified shaders, that do not rely on material code, (such as shadow depth rendering for solid objects without WPO, for example).
I would like this really much. Like planar reflection pass does not need that much detail. That is actually what Epic did at their Reflections realtime raytracing demo. https://www.youtube.com/watch?v=J3ue35ago3Y
This would also make planar reflections usable on mobile(clip plane is implemented with alpha testing.) and would help a lot in pc/consoles too. No need for paying clip plane cost for other passes than actual planar reflection rendering.
Another thing that I might suggest for material editor as a simple to implement and elegant solution, is to add a text field to material details, that would function like custom node, but would allow you to inject code into begging of material template. This way you can modify base pass material shader with define directives whatever way you want, without breaking anything.