Fix alpha, color transform in adjustColor shader #65
+25
−4
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.
the adjustColor fragment shader multiplies the color by alpha on the output. the color is already premultiplied by alpha, so this only causes colors to turn darker as the opacity / alpha decreases, causing black edges and making the output look "dirty". this is specially noticeable in glows and particles!!
![image](https://private-user-images.githubusercontent.com/84390581/372211307-ba5f9a04-6178-4f54-9a7d-6538132bd33d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MzQwNzcsIm5iZiI6MTczOTkzMzc3NywicGF0aCI6Ii84NDM5MDU4MS8zNzIyMTEzMDctYmE1ZjlhMDQtNjE3OC00ZjU0LTlhN2QtNjUzODEzMmJkMzNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDAyNTYxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRiYWM1NGI0Mjc5OTAyNzJhNTkwMWIyZjNjOWI3M2NmZjQ2YTJhYzNhMjE1NjQ2Nzk4MTVhZjdmOWIzZjljY2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Ar8fkRF0BR0JiZySP4J-Ybd4heCJqovoBXnOhO8DKUc)
![image](https://private-user-images.githubusercontent.com/84390581/372211176-9cb322fb-590a-4cd6-a870-0374e12bd8c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MzQwNzcsIm5iZiI6MTczOTkzMzc3NywicGF0aCI6Ii84NDM5MDU4MS8zNzIyMTExNzYtOWNiMzIyZmItNTkwYS00Y2Q2LWE4NzAtMDM3NGUxMmJkOGM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDAyNTYxN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk0ZTRhZWY0ZjlkMTM3NzJiYmMzMDc4ZjA3MzNjNDgyMGZiMTBmMGU5MWRjZTEyN2YxY2FmM2U1MmVlNjU5NTUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.altsJKsB-hx15UlHJ6a7n-rnbxRkpJ8ZrMziuRgx-8w)
BEFORE:
this tiny fix simply removes that alpha multiplication, essentially fixing this issue
AFTER:
texture2D
has also been changed toflixel_texture2D
, to allow Flixel color and alpha transformations to be applied (pictured below). this doesn't affect the appearance of sprites without these transformations applied