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

Universal Outline2D Shader (with fix for Godot 4.x) #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Dreadset
Copy link

Created a universal Outline2D shader script and fixed error regarding uniform 'hint_color' (it's called 'source_color' since Godot 4.0).

This script is a refactored combination of the shaders "outline2D_inner", "outline2D_outer" and "outline2D_inner_outer". With this, you can easily choose the desired outline in the inspector. Also added the possibility to turn the outline on and off via the inspector.

Created a universal Outline2D shader script and fixed error regarding uniform 'hint_color' (it's called 'source_color' since Godot 4.0).

This script is a refactored combination of the shaders "outline2D_inner", "outline2D_outer" and "outline2D_inner_outer".
With this, you can easily choose the desired outline in the inspector.
Also added the possibility to turn the outline on and off via the inspector.
Copy link
Contributor

@NathanLovato NathanLovato left a comment

Choose a reason for hiding this comment

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

Thank you for taking the time to contribute. I've been looking at and toying with the code for a few moments, taking the time to edit it to see if it could be made simpler or more efficient, and thinking if we want a shader like this in the repository.

Generally speaking, the use of branches is strongly discouraged in shaders unless necessary because the code more or less runs as is, with no optimizations made by the computer. As we make these shaders for people to learn from, I want to be a little careful with the shader code, and also as we update it to Godot 4, take the opportunity to improve existing shaders with learning in mind (existing shaders in the repository are not necessarily perfect in this regard!).

So, for example, when choosing between different outline types, I think a resource or a piece of code that lets you choose at the node level and that would automatically swap the shader for you would be a better practice for offering user flexibility.

Is this something you would like to do?

Note that we set up an issue where people can claim shaders and demos they want to update, to ensure people know who's working on what: #53.

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

Successfully merging this pull request may close these issues.

2 participants