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

Add a post-process shader template for CompositorEffect #93236

Closed

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Jun 16, 2024

I guess this should ease up the creation of CompositorEffect (code borrowed from https://docs.godotengine.org/en/latest/tutorials/rendering/compositor.html).

@dalexeev dalexeev requested a review from a team June 16, 2024 16:59
@Chaosus Chaosus force-pushed the compositor_effect_template branch 3 times, most recently from e9ae7dd to 571ba3d Compare June 16, 2024 17:23
@Chaosus Chaosus force-pushed the compositor_effect_template branch 6 times, most recently from e90fab0 to 81fe737 Compare June 16, 2024 17:45
@Chaosus
Copy link
Member Author

Chaosus commented Jun 16, 2024

@dalexeev, @AThousandShips Please check again

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on style

@Chaosus Chaosus force-pushed the compositor_effect_template branch from 81fe737 to ad0bc49 Compare June 16, 2024 17:48
@AThousandShips AThousandShips added this to the 4.x milestone Jun 16, 2024
@Chaosus Chaosus force-pushed the compositor_effect_template branch 2 times, most recently from 76131d7 to 8ffb644 Compare June 16, 2024 18:01
@Chaosus Chaosus force-pushed the compositor_effect_template branch 2 times, most recently from 0332673 to 9bc10a0 Compare June 16, 2024 18:09
Copy link
Member

@dalexeev dalexeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GDScript code style looks good to me.

@Chaosus Chaosus force-pushed the compositor_effect_template branch from 9bc10a0 to 3d41679 Compare June 17, 2024 05:27
@Chaosus Chaosus force-pushed the compositor_effect_template branch from 3d41679 to fb20250 Compare June 17, 2024 05:35
@Chaosus Chaosus force-pushed the compositor_effect_template branch 6 times, most recently from 7ed6ae2 to e22608f Compare June 17, 2024 06:43
@Chaosus
Copy link
Member Author

Chaosus commented Jun 17, 2024

After some thinking, I decided to divide it to two templates: one for simple CompositorEffect and one for CompositorEffect with inline code insertion, both without any comments (I think they will irritate the advanced users of this class).

@Chaosus Chaosus force-pushed the compositor_effect_template branch 3 times, most recently from a1c6aa6 to 4b559d7 Compare June 17, 2024 07:07
@akien-mga akien-mga requested a review from BastiaanOlij June 17, 2024 08:45
@Chaosus Chaosus force-pushed the compositor_effect_template branch 2 times, most recently from 85b3b22 to dd70fca Compare June 17, 2024 14:56
@demolen
Copy link

demolen commented Jul 2, 2024

only manually entering CompositorEffect as the parent class in the new script dialog would provide the templates. clicking on the inherit object Icon (the one that looks like a tree view) and looking for "CompositorEffect" doesn't provide any results. I don't know if this is related to this PR per se. but I spent quite a while trying to figure this out.

Screenshot 2024-07-02 at 18 56 38 Screenshot 2024-07-02 at 18 56 56

@Chaosus
Copy link
Member Author

Chaosus commented Jul 2, 2024

I don't know if this is related to this PR per se. but I spent quite a while trying to figure this out.

That's because it only shows Node-based classes, and CompositorEffect is a Resource-based class. That may be fixed, but not on this PR.

@demolen
Copy link

demolen commented Jul 2, 2024

I also get this error in a freshly made project when instantiating the Default CompositorEffect template, I looked up on the code and internal_size() seems to be a method of RenderSceneBuffersConfiguration

Screenshot 2024-07-02 at 19 38 09

@Chaosus Chaosus force-pushed the compositor_effect_template branch from dd70fca to 60a6161 Compare July 2, 2024 17:50
@Chaosus
Copy link
Member Author

Chaosus commented Jul 2, 2024

I also get this error in a freshly made project when instantiating the Default CompositorEffect template, I looked up on the code and internal_size() seems to be a method of RenderSceneBuffersConfiguration

Ah, thank you for checking, I forgot to check it with enabled type hints, my fault.. Fixed

@Chaosus Chaosus modified the milestones: 4.x, 4.4 Jul 25, 2024
@akien-mga
Copy link
Member

CC @BastiaanOlij

@BastiaanOlij
Copy link
Contributor

I'm personally not a big fan of this. CompositorEffects in its current form was always meant as a foundation that could be used by experienced users, ontop of which things could be build that hide the complexity (but also limit its functionality to specific use cases).

For the use case here I made the shader example just as that, an example that shows how this could be used but which would need to be further worked out to become a good base.

To be exact, I raised this proposal for a much better alternative some months ago: godotengine/godot-proposals#7849
This would introduce a new material type and a new CompositorEffects subclass, and a number of hints that allow us to automatically bind the needed inputs and outputs and have people write proper shaders for this type of compositor effect.

The biggest issue that still needs to be worked out for that however is proper support for chaining effects where effects can read from the color buffer and write into a pong buffer, and visa versa.

@Chaosus
Copy link
Member Author

Chaosus commented Sep 9, 2024

Alright, if it's not desired, then closed.

@Chaosus Chaosus closed this Sep 9, 2024
@Chaosus Chaosus deleted the compositor_effect_template branch September 9, 2024 10:24
@Chaosus Chaosus removed this from the 4.4 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants