Cops: Subtract Clamps Black Values (but not always??) {[SOLVED]}

   891   2   1
User Avatar
Member
1177 posts
Joined: April 2017
Offline
Hi!

I was trying to create a Highpass. Basically, you subtract the original image by a blurred version of it (results in negative values) and add 0.5 to it to move the values above 0.

I'm stuck at the subtract step. I end up losing all values below Zero (When I look at the histogram). It only happens when I subtract by the blurred image but not when I subtract by a Color node. Any clue why?

-Olivier
Edited by olivierth - April 27, 2025 13:25:51

Attachments:
Houdini_cops_Loss_of_Values_Below_Zero_01.JPG (43.3 KB)

User Avatar
Member
654 posts
Joined: Aug. 2014
Offline
I think you're experiencing this behavior because the TIFF you're importing is a non-linearized 8-bit image, and that bit depth doesn't support negative pixel values. The 8-bit image is passed to Blur COP2, which doesn't do any depth conversion and operates in bit depth of its input, which is 8. Then you're subtracting one 8-bit image from another, which leads to clamped values.

Now, in the right branch of your node tree, you're using Color COP2, which is capable of changing the image depth (with Image -> Raster Depth). Subtract (and other blending COP2s as well) can also do this conversion via Merge->Raster Depth parameter, which is set to "Promote to Highest Bit Depth" by default.

So my guess is, and I could be wrong, that Color COP2 from your right branch generates a 16-bit color, the imported image is a non-linearized 8-bit image and the "subtract2" promotes the low raster depth of the input image to Color COP2's 16-bit. And that's why negative values aren't clamped.
User Avatar
Member
1177 posts
Joined: April 2017
Offline
Fantastic!

Changing the File node's File Raster Depth to Project Depth fixed my problem!

-Olivier
Edited by olivierth - April 27, 2025 13:25:28

Attachments:
Houdini_cops_Loss_of_Values_Below_Zero_02.JPG (35.2 KB)

  • Quick Links