Jump to content
You must now use your email address to sign in [click for more info] ×

Different evaluation of same expression in Procedural Texture vs Apply Image


Recommended Posts

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

  

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

  • 4 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.