Combining Shader Effects w/ Backbuffers & Runtime Shader Generation | Godot Dungeon Crawler Devlog 1

preview_player
Показать описание
This is the first time I've done a video like this, I hope it came out alright. More thoughts and timestamps below.

0:00 Introduction
1:50 Shaders and two examples of common effects
4:00 Problem: How to apply both shaders at once
6:23 Node-based approach: BackBufferCopy and CanvasGroup
12:56 Difference between CanvasGroup and BackBufferCopy
16:26 Node approach drawbacks: Cluttering the scene tree and inflexible tree ordering
19:07 Code-based approach: Generating shaders with different effects and switching between them
22:44 Using shader preprocessor directives to create different effect combinations
28:03 Code approach drawbacks: Materials are resources, and resources are shared among nodes
31:40 Trick: Using the modulate property to mock unique uniforms
35:30 Catch to look out for with using modulate to mock unique uniforms
37:35 An idea for a way to reduce the amount of required materials
38:16 Wrapping up with a demonstration of combining shaders in my game
40:00 Conclusion

First, if you have any feedback, please do share it. While I likely won't ever script these, I know there are probably other ways I can improve the format beyond just practicing more. Likewise if you're more knowledgeable about shaders and noticed I said anything incorrect, please do correct me!

I know I said this was my second attempt at recording this in the video, but it was actually my third. That was just my second attempt that specific day. I had actually tried to record this devlog the week before as well, but it was just as long and much less focused than this one.

This ended up being a lot more informational/guide-like than I anticipated, there isn't very much showcasing going on. But I think that's alright. My game isn't very flashy at the moment, and I also wanted to talk about this topic because there really isn't very much information out there on how to achieve this. I had to do a ton of digging and testing before I finally got some ideas that lead to working solutions. There weren't a lot of other cases I could find of people needing to do similar things on the godot reddit or forums, and the few that were either had no/unsatisfactory answers, or were far more complex than the workarounds I ended up with.

I'm not quite sure what to talk about or showcase next. If I feel particularly inspired about any of the other game systems I end up working on, perhaps I'll make a devlog about them, and maybe they'll be more of a showcase instead accidentally becoming a lecture, lol.

There was actually a pull request for cascaded canvas groups that was intended to add a simpler and more performant way to use CanvasGroup nodes for doing multiple render/shader passes, but the pull request has not been merged and I'm unsure if it will be. While it wouldn't perfectly solve my use case, it seems like it would still be handy and I bet would be more than sufficient for many other people.

Рекомендации по теме
Комментарии
Автор

I was surprised to see no comments- I found this video very informative. Various forums seem to recommend your first option, and I hadn't seen preprocessing shader files before as a suggestion. Makes me wonder about an addon to convert gdshaders to what you called "shader include files"- then a shader which takes them as inputs. Great Video!

jonathanfogel