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

Procedural texture, logic functions


Recommended Posts

Hi Affinity team,

can you please add logic functions that would allow to process if/select-clauses?

i currently try to simulate by + and *, but could lead to complex formulas and wrong results  

0 rated as false, all other values rated as true

* means any other value (except those listed above)

logic functions and, or, not should return only 0 or 1, normalizing all non-0 to 1

E.g. 

and(a,b) res

0 * 0

* 0 0

* * 1

or (a,b): res

0 0 0

* * 1

not (a) res

0 1

* 0

if (c,y,n) res

0 y n n

* y n y

Ifsign (c, n, z, p) res

C=0 z

c<0 n

c>0 p

Thank you in advance

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

I do a fair amount of Procedural Texture programming and handle conditional statements by such as first deriving 0-1 for true-false and then multiplying by the result for condition a then adding multiplying by inverse for condition b. For comparing numbers, I typically subtract and do a roundup (scaling numbers as needed).

eg (untested, so fingers crossed) a version of max(R,G) is:

var ifrg=roundup(R-G); //is zero if green greater than red else 1

var mxrg=ifrg*R+(1-ifrg)*G;

And yes, things get complex!

 

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

23 minutes ago, dmstraker said:

I do a fair amount of Procedural Texture programming and handle conditional statements by such as first deriving 0-1 for true-false and then multiplying by the result for condition a then adding multiplying by inverse for condition b. For comparing numbers, I typically subtract and do a roundup (scaling numbers as needed).

eg (untested, so fingers crossed) a version of max(R,G) is:

var ifrg=roundup(R-G); //is zero if green greater than red else 1

var mxrg=ifrg*R+(1-ifrg)*G;

And yes, things get complex!

 

absolutely. Normally a+b can be used for "OR", but if you don't always normalize and have e.g. 1 + (-1) you get wrong results.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Ah yes. -ves of course.

Another gotcha is calcs done as real numbers. So what should be 0 could be just out. 

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

Hi Dave (dmstraker)

Are your Procedural Texture  macros cross platform compatible. I run on MAC and have had trouble with your macros in 1.9.1

I don't code but am really interested in getting your macros to work especially the Luminosity ones

I have attached a screen capture of what they look like. (missing sliders)

Thanks for any info

 

screenshot_01.png

Link to comment
Share on other sites

On 3/9/2021 at 8:27 PM, spiderpod7d said:

Hi Dave (dmstraker)

Are your Procedural Texture  macros cross platform compatible. I run on MAC and have had trouble with your macros in 1.9.1

I don't code but am really interested in getting your macros to work especially the Luminosity ones

I have attached a screen capture of what they look like. (missing sliders)

Thanks for any info

 

screenshot_01.png

Looks like you can scroll down to other sliders -- see the scroll bar to the right of sliders visible.

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

There is a bug (afp-4203) in the current Mac1.9.x versions of the procedural texture dialog where the input controls are not displayed and you only see blank space.

Hoping this is fixed by end of 1.9.2 beta as I use Dave's (great) macros too, a significant enhancement to the attribute based selection of APh.

Link to comment
Share on other sites

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.