← All ideas

Screen-Space Shaders/Real-Time Compositing

Most if not all game engines have shaders that work not on materials for a object, but on a render texture from camera. Basically, they apply shader to rendered image like Compositing does, but in real time. That how all effects like bloom and vignette, blur and all others work. We even have realtime bloom and SSR in Eevee.

Can developers give us ability to make shaders like these with nodes, using almost the same shader system for such effects? It only requires to take textures from camera or viewport with window coordinates and put them back after applying shader.

I used to write some simple things like that in Unity. It has Blit() function that allows to take texture from camera, modify and send back in before rendering done. But i have little to no idea how to modify Blender rendering code and hook it up to nodes.

We could even probably make realtime depth-based outline shader with this, as an example. It almost complete real-time compositing in viewport. I understand that from artistic control perspective, it's better to render first and modify later, but for casual tweaking or faster rendering it might be much better.

2021-04-24_16-30-11.png

97.2%

Development Status: Open

Upvote 35 Downvote 1
Fluffyrescent
24 Apr 2021

9 Comments

thinsoldier

Supposedly this is planned. "viewport compositing" has appeared in a few things the devs have written but with no actual description of what it is. Severl people assume it is what you describe. #1 Rewrite all the compositing nodes as fragment shaders that can run on GPUs to speed up everything #2 add an option to render compositing step in viewport renders.

2
sombrero76

This is very similar to my >> old proposal <<

peter.boos

Essentially i think this could be a node system for the camera alike shaders Maybe what you say is a nice proposal for evertything nodes ?.

kinda wonder what would becomme possible if a few areas got mixed here. focus depth, bloom blur,

Draise

Yes please. Viewport Post-processing in a nutshell. Something you could find in any game engine. This can and should work realtime: lens flares, grunge on lenses, other lense effects, NPR effects, fringing, aberration, even old CRT effects.. all of this could be realtime and composited with render buffers.

They have mentioned doing it, with a different name, but it could get there. Oneday.

vangel

This is called compositing in 3D animation workflows and basically every other media workflow.. If you very carefully search for it on the strange thing called Internet you might get a glimpse of it.

Fluffyrescent Author

* @vangel * If you can read, please do that to see that i use this very strange word right in this very post title.

vangel

* @Fluffyrescent * Oh I really understand what you are saying. Just render one frame and everything you do with it in Compositing is almost real time to tweak and change. I'm using and writing post-shaders myself in Unreal and know how useful they can be in a game engine where there is no real Compositing phase and performance is key, but not so much in an animation package where you have a lot more miliseconds to do it right and user friendly. I'm not against to have post-shader in Blender viewport but I think viewport performance is MUCH more important than bloating up the 3d display pipeline with the insertion of a custom shaders pass. Why not extending the Composer with more shader nodes or possibly a script OSL node?

Fluffyrescent Author

* @vangel * No one is stopping you from toggling it off and on when you need, like all existing Eevee effects. Compositing that exists right now, however, is abysmally slow. Just initializing it with no nodes already adds to render time. Besides, it much easier to tweak things right in viewport then trying to fix some screw-up in post. Especially if you screw up some small detail and have to re-render darn thing in Cycles. Worst of all, some nodes don't even work the same if you change image resolution.

vangel

* @Fluffyrescent * Fixing things in post is not as bad as you make it, especially if your workflow is prepared for it anyways. It's only bed in Blender because the Blender compositing itself is slow and bad for so many reasons. If it must be free use Fusion/Davinci. After Effects and of cause Nuke are the not so cheap workhorses we normally use.