pixijs / spine

Pixi.js plugin that enables Spine support.
Other
570 stars 217 forks source link

Inaccurate Blending Calculations in Pixi Spine #532

Open PioneerRedwood opened 1 year ago

PioneerRedwood commented 1 year ago

Bug Report: Inaccurate Blending Calculations in Pixi Spine

Dear Pixi Spine Team,

I hope this message finds you well. I am writing to report a bug related to inaccurate blending calculations in Pixi Spine, specifically when dealing with RGB to hex conversion involving floating-point numbers with precision beyond the decimal point.

Bug Description

When utilizing Pixi Spine to convert RGB values represented as floating-point numbers with high precision (e.g., 13 decimal places) to hexadecimal values, the blending calculations seem to be inaccurate. This issue affects the accuracy of color blending and can result in incorrect rendering in certain scenarios.

Steps to Reproduce

  1. Use Pixi Spine to convert RGB values with precision beyond the decimal point (e.g., 0.1234567890123, 0.9876543210987, 0.1111111111111) to hexadecimal values using the rgb2hex function.
  2. Observe the hexadecimal values generated and compare them to the expected values based on accurate blending calculations.

Expected Behavior

The RGB to hexadecimal conversion should accurately handle floating-point numbers with high precision, ensuring correct blending calculations and rendering in Pixi Spine.

Actual Behavior

The current implementation seems to struggle with maintaining accuracy when dealing with floating-point numbers beyond a certain precision, leading to incorrect blending and rendering results.

Additional Information

This issue can lead to visual artifacts and discrepancies in color blending, impacting the overall quality of the rendered graphics in Pixi Spine applications.

Environment

Proposed Solution

I recommend reviewing the RGB to hexadecimal conversion logic in Pixi Spine, especially when handling floating-point numbers with high precision. Implementing more precise algorithms or ensuring accurate rounding methods could potentially resolve this issue and enhance the overall rendering accuracy.

Please let me know if you require any additional information or if there are specific steps I can take to assist further in resolving this problem. Thank you for your attention to this matter, and I appreciate your efforts in continuously improving Pixi Spine.

Best regards, Chris Redwood