engine icon indicating copy to clipboard operation
engine copied to clipboard

fix opacity conversion when 0.0, remove extraneous clamp

Open pjbaron opened this issue 2 years ago • 3 comments

The opacity value ranges from NEGATIVE_INFINITY to POSITIVE_INFINITY and at opacity === 0.0 the sigmoid will return 0.5. The original code would convert this to an alpha of 255 instead of 128. It is possible that the condition is intended to catch an undefined opacity, so I have made that explicit. If this is not the case, then the ternary condition can be removed entirely. However if there is a possibility of opacity === null, that should be handled as well. The sigmoid function cannot return < 0 or > 1 so the clamp is not needed.

Fixes # I don't think there's bug report, but I've been having problems with opacity and went into the engine to find out why.

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

pjbaron avatar Dec 12 '23 22:12 pjbaron

sorry about the lint fail, it appears my editor inserted spaces on an empty line

pjbaron avatar Dec 12 '23 22:12 pjbaron

Hi @pjbaron,

What problems have you been having with opacity?

Can you provide us a repo we can test with?

Thanks!

slimbuck avatar Dec 13 '23 14:12 slimbuck

@slimbuck it was the separate clones of 'center' which were making my morph targets appear transparent, not opacity as I had previously thought. I commented with more details about that on a separate issue about optimisation/redesign of the splatting system.

pjbaron avatar Dec 13 '23 20:12 pjbaron

Closing this as the solution does not seem needed. Please update the description / change the PR based on the feedback if this is not correct.

mvaligursky avatar Feb 26 '24 11:02 mvaligursky