Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I apply a shader to all nodes at once? #3

Open
MyNameIsDabin opened this issue Jan 2, 2020 · 2 comments
Open

How can I apply a shader to all nodes at once? #3

MyNameIsDabin opened this issue Jan 2, 2020 · 2 comments

Comments

@MyNameIsDabin
Copy link

Applying shaders to each node is somehow thought to be costly.
Can't you use it like a Screen Filter with ColorRect?

@Calinou
Copy link

Calinou commented Mar 15, 2021

Applying shaders to each node is somehow thought to be costly.

It's not costly if you reuse the material, but the issue is that Godot won't support per-instance uniforms until 4.0. Per-instance uniforms let you specify different shader parameters for the same material without requiring you to duplicate it.

@CptPotato
Copy link
Owner

CptPotato commented Mar 15, 2021

I somehow totally missed this question, sorry for that. In addition to what @Calinou pointed out it also depends on what you want to filter (each object separately or the whole screen buffer at once).

For example, I think for pixel graphics it's great to render everything at the low "internal" resolution into a buffer and then upscale that in a single post processing step to the output resolution. In this case you would only need to use the shader once for the upscaling step.
Additionally it can have performance benefits because almost the whole pipeline runs at a low resolution (graphics performance in these type of games is usually not an issue though). This also means that everything in the scene adheres to the pixel grid - which can be seen as both a good and a bad thing.

Otherwise you'd have to set the shader for each object as mentioned. I think it's also possible to use scenes or custom nodes in Godot to "inherit" the shader or set it internally so you don't have to do it manually for every single object you add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants