As an experiment, I threw this together to see how nice it would be to edit Postprocessing stack effects in shader graph.
Since effects are used to be done by transforming a source texture into a destination texture through a shader, The idea is to have a “Main Texture” source input node, and an “Image Effect Master” output node, and the graph would be responsible for transforming things in between.
I wrote an effect renderer that takes a material as a parameter, allowing it to be generic and working for any full screen effect shader.
The prototyping I did is too hacky for my taste, because I’m not familiar with all aspects of shader graph and SRP, but somehow it worked nicely:
Which made it easy to get creative with image effects. Using graphs for image effects made so much sense, and was wondering if this is an idea Unity would like to pursue and have it builtin.
Big +1 from me. I think this is something that should definitely be possible with shader graph out-of-the-box. I can’t imagine they would not add this ability at some point. It seems obvious.
As an aside… I have to say that video is one of the greatest things I’ve ever seen. The sound effects and everything are just hilarious! I assume that is a game you’re working on? Great work there.
Thanks! It was originally a job interview assignment (a simple first person that shoots whatever) but I decided to try out the newer Unity features for the sake of learning, and I put on a game jam mindset on, then it simply got weird haha.
Another experiment: creating a “stereo” post processing effect (shifting the red/blue channels to the left/right a little) using shader graph. Doesn’t take depth into consideration, but still.
@iBicha Which version are you using as Render pipeline ? Because, I’ve tried to import your project using Unity 18.3.b4, imported necessary packages and purged ecs related stuff bcuz it was giving roslyn related errors. Anyway, right now in shader graph there is a red error on top of Image Effect Master which says “Current render pipeline is not compatible with this master”.
Yes I am using LWRP 4.0.1, Is there a way to seperate the image effect part from other experiments bcuz of compiler errors. I’ve tried it but it got broken
That’s pretty odd, since the LWRP 4.0.1 is what I’m using.
I did a loaded a fresh clone of the repo in Unity 2018.3.0b5 both on Windows and Mac. They both failed with different kinds of errors. Restarting the editor on each made the project load successfully.
But you are right, the image effect feature should have been in a separate repo, but it was hacked together for testing.
This post is mainly to get the attention of Unity’s graphics team and see if they want to implement such feature. If not, I might consider rewriting a clean version and publish it separately.
@iBicha What I see is this when I clean compiler/ECS related stuff with LWRP 4.0.0 (4.0.1 not working). This is the default repo files, I didnt change anything and post processing effect not works at all. Btw this is overlay shader.
Other than that, I understand your intension and thats what I was looking for sometime, but when I asked to them over scriptablerenderpipeline repo, they replied me “Shader graph does not work with new srp” and they didnt have a plan to implement back then. But I’d like to create a tutorial video with an example bcuz I find it useful to create image effects with shader graph just like you do. And I believe it could be helpful for community.
This is currently in the works. I’m working on subshaders to support LWRP, HDRP, and the legacy rendering as well with the same graph. It should work well, at least for basic effects.
If anyone following this or interested, the trouble is every time I update the packages, everything just breaks (because of changes made to scripts or to the shader libraries etc). I knew the best route was to get Unity to somehow implement this instead of someone else. The second best approach is to build this in an independent way from the packages (shader wise, not using any of the shader libraries from SRP packages)
Thanks! I could make the project in ImageEffectGraph work out of the box but the Sevakon threw a few shader errors and after I fixed them I got this scene:
Is that how it is supposed to look?
That’s right. On the Postprocessing volume component, you will see there are a couple of custom effects applied (in addition to the built-in ones). You can change the effects by swapping the material in the inspector (there are some materials included that you can try, found in Assets/Effects/Graphs (in the sevakon repo).
Really excellent work! I would love to test this in my game. It brings a ton of possibilities to the effects that I can apply to camera transitions. Will showcase one here once I have it ready. Thanks for your great work.
You’re very welcome! Please let me know if there are some use cases where this doesn’t work, or when some shaders are not possible to implement like this (an issue on github would be nice) Thanks
If you dont mind, I’m thinking about making a shader graph tutorial using your image graph implementation. I believe it will also help you to take some attention. I guess I’ll do that this weekend.