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

Fix falsey value bug causing certain tinted objects to display colour… #214

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

connorhsm
Copy link
Contributor

We were finding some objects not looking quite right in our fork for Two Hours One Life. I found that when a sprite has its tint/colour modified in the editor, the colouring would not be displayed in some cases. For example, we have one clothing type which has several variants. Default, red, blue and black had no issue, but green showed grey.

In the data for the object, this colour modification is represented as:
color=0.000000,0.521127,0.190835 for this object. But it could just as easily be 1.000000,0.000000,0.190835 or 1.000000,1.0000000.000000 and be susceptible.

Eventually it was narrowed down to this part where the value 0 was being interpreted as false. It would apply whenever any of the 3 values were equal to 0 and any of the preceding values were 1.

As far as I can tell, this has always been a problem. This change (unexpectedly) had an effect on processing of approximately 1,600 sprites for 2HOL.

Our issue tracking this: twohoursonelife#42

This doesn't perfect transparency, but it helps with the effect. See twohoursonelife#43

Before:
image
image
image

After:
image
image
image

@ryanb ryanb merged commit 2c1129e into Kazetsukai:master Jun 25, 2024
@ryanb
Copy link
Collaborator

ryanb commented Jun 25, 2024

@connorhsm thanks, merged! Might be a little while before I deploy and reprocess the sprites.

@connorhsm connorhsm deleted the fix-shaded-objects branch September 7, 2024 08:27
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