Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces a non-destructive workflow for effects/filters as proposed in #619.
2023-11-11.17-08-22.mp4
2023-11-11.17-07-18.mp4
All it does is essentially takes a copy of the images of the cels, uses
ShaderImageEffect
to apply each shader of every effect into the copy, and display that copy to the canvas (if Display Layer Effects is enabled) and to the exported image. The image data of the cels are not affected in any way, thus making it non-destructive.The biggest issue with this system is performance. Drawing is noticeably laggier when effects are enabled, and this is due to
RenderingServer.force_draw()
thatShaderImageEffect
is using. This method is necessary however, without it the resulting image is blank. A better solution may be this godotengine/godot#75436, or to use something like this godotengine/godot-proposals#7379.The UI is different than the one proposed in #619, because I used a newer mockup by mrtripie which was posted on our Discord server. Feel free to give feedback!
To avoid code duplication with the destructive image effect UI and to future-proof the system, the parameter UI of the effects is being generated on the fly by reading the shader code and making the appropriate UI elements for each uniform (ValueSliders for ints and floats, CheckBoxes for bools, ColorPickerButtons for vec4s, etc). This system is future-proofed in the sense that we 1) don't have to update the UI every time a shader changes (although we have to do it anyway for the destructive image effects as of right now), and 2) it supports custom shaders loaded by the user, whenever we implement this feature.
Features not yet implemented, not inside this PR's scope:
Save the effect data on pxo, as well as the result images for easier importing (by third-party software) and exporting. Probably not going to work on it since the pxo format is subject to change, see Change the file format of pxo files #939.EDIT: This was implemented later, after this PR got merged, in 8c34532.
.gdshader
files, and for every shader file we would add both a destructive effect in the Image menu, and a non-destructive layer effect.- A way to permanently apply effects.EDIT: Implemented in cc8d18c and 5f7ae70.