How to create custom shader?

Hello, I’m a beginner graphics programmer and I’m interesting in all stuff related to rendering. For me it seems that graphical part of UE4 is the half of the engine, but I can’t find any information about it. Yes, I’ve read this 2 pages in documentation about graphics development but: 1. It seems outdated. 2. Well, I can’t understand anything - it’s so brief and dry.
In learning purposes I want to create a shader (a set of shaders) that uses all pipeline stages. Where should I start? Can you provide a step by step guide what classes I need, how to implement this in engine (because I bet I need to modify source code).

Hi Nikitablack,

I am planning on doing just this, writing some documentation on how to implement your own custom shaders using Vertex Factories, Global Shaders and Drawing Policies. I will be writing the documentation with some examples in mind, so by the end you should have some custom shaders to play with that actually do something. I will be writing the documentation over the weekend.

Hi Ehamloptiran,

I saw your previous posts. The hair work is awesome! I asked a question in this thread (hair), but it seems that data lost due to some database problems yesterday. I spent 2 days on ue graphics stuff but still have very little progress. Can I help you with documentation somehow?

Just let me know if there are any specific topics you want me to cover, or any specific effects you want to see. So far the topics I want to cover are:

  • How to create shaders based on FGlobalShader
  • How to create Vertex Factories using custom shaders (Including integrating Geometry Shaders, since initially they aren’t supported)
  • A breakdown of Vertex Factory USF (What functions are required and what they do)
  • How to use Compute Shaders
  • How to create a custom Drawing Policy
  • Maybe touch on post processing and Material Editor related stuff

If I understood correctly, FGlobalShader is a post processing thing.
I think that overview of the architecture would be great. With some simple flat color shader that pass through all pipeline stages.

Hey Ehamloptiran, are you still going to be writing any documentation on this?

Hi gboxentertainment,

Yes I do still plan on getting that documentation out. It has been pretty low on my list of priorities, things with my project have been pretty hectic over the last month or so. I’ve also learnt a lot more about the rendering side of UE4, so I have more things to cover.

But if there are any particular questions you want answered, or urgent help, you can usually find me on irc at #unrealengine

Bump :smiley: been coding shaders for years and as I’m going through the UE4 “materials” video tutorials I’m facepalming so hard, there’s gotta be a way to just code those up instead. A full screen of 6-8 fat wire-connected nodes for what could be 2-3 lines of shader code? This would drive me mad in practice… I’m happy all the artsy code-hating types have a clicky tool but sheesh let me just code shaders close to the metal… Ehamloptiran, did you ever get around to writing down some notes of your experiences on this?

Bumping on this too, would really love to see a clear workflow or the appropriate way on how to create custom shader work on Unreal Engine.
The least I could do is to replicate what Ehamloptiran did on FluidSurface, any notes you could share with us Ehamloptiran?

Has there been any word on the documentation?

I read your thread on Metaballs by the way and there you said “Feel free to comment in if there is anything specific you would like me to cover, or any certain effects you want to see.” So I hope this isn’t bothering anyone but I have some requests for the shader guide (and I generally would really like to see something like this):

glitch-looking effects, or an old vhs-style, kinda like Silent Hill 3 had. Also the deep, dark, grainy black and white look of Tetsuo:

Of course, I don’t expect you to show all of those (or any of those), just saying what I’m interested in seeing.

You might probably want to look at this [Tutorial] Pixel and Compute Shaders in UE4 - C++ Gameplay Programming - Unreal Engine Forums Temaran write a good documentation and plugin for anyone interested to custom shader authoring

I use the Unreal Editor that came with Star Wars: Republic Commando. If I may, could someone please tell me how to export a shader and edit it to the point at which it would best befit these two images?
501stCommander.bmp and 501stCommanderHelmet.bmp are the names of the images. I cannot seem to post them here, so if at all possible. you can send me a private message requesting my email contact information.

Or, better yet, you can take a look at the flickr photos shared by yours truly, Coltrane Eightone.

If I may, is anyone still here?