dmstraker Posted March 2, 2020 Share Posted March 2, 2020 I'm working on isolating the maximum value colour in each pixel, so in Apply Image I'm successfully using: DR=SR*rounddown(1-(max(SR,SG,SB)-SR)) DG=SG*rounddown(1-(max(SR,SG,SB)-SG)) DB=SB*rounddown(1-(max(SR,SG,SB)-SB)) rounddown is effectively a boolean operator that reduces this expression to 1 or 0, which happens when the R, G or B value is the same as the maximum value. Implementing this in Procedural Texture I'm getting an illogical and different result. R: R*rounddown(1-(max(R,G,B)-R)) G: G*rounddown(1-(max(R,G,B)-G)) B: B*rounddown(1-(max(R,G,B)-B)) In a test case using B to check out differences, the evalution of B differs *sometimes* when Blue is the maximum. I suspect a rounding or clamping effect, so (max(R,G,B)-B) is not sometimes wholly zero when B is maximum. An example where this evaluation fails is RGB of 102, 109, 135. This seems to be happening more when the value of Blue is higher. A fix is clamping the max calculation, B*rounddown(1-clamp((max(R,G,B)-B),0,1)), but is a kludge that shouldn't happen (and, I'd suspect, most users would not find). Procedural Texture, for some reason, seems to calculate much faster than Apply Image. Not sure why this is. When PT calculations don't need kludges I'll move over a number of macros I offer in my InAffinity YouTube channel (which currently take several minutes to calculate in Apply Image). APh version is 1.8.0.585 Quote Dave Straker Cameras: Sony A7R2, RX100V Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11" Favourite word: Aha. For me and for others. Link to comment Share on other sites More sharing options...
Staff Chris B Posted March 26, 2020 Staff Share Posted March 26, 2020 Hi Dave, I believe Apply Image is bounded whereas Procedural Texture will be unbounded, that's why you need the introduce the clamp. Quote How to format a bug report | Learning Resources | List of V2 FAQs | YouTube Tutorials Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.