COPS "reformat" options like nuke [SOLVED]

   2333   7   1
User Avatar
Member
127 posts
Joined: Feb. 2021
Offline
I am probably just blind, but I can't figure out how to crop and reformat an image like I would in nuke.
In nuke I would reformat and crop to my format and have it scale by width and have a center crop.

In cops, all I can figure out is to crop from bottom or top.
Edited by AndreasWeidman - Sept. 1, 2021 17:07:36
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
7837 posts
Joined: Sept. 2011
Online
Yeah, that would be nice to have. It's quite a lot of math and hard to get right as it is now. I think you can do it with a combination of transform scale node and crop nodes.
User Avatar
Member
127 posts
Joined: Feb. 2021
Offline
Tried that combo. Can't figure it out at least.
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
127 posts
Joined: Feb. 2021
Offline
Is there any token in Cops to get the original width/height? W/H didnt work, nor did $W or $H.
If there is a token I could write some expression
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
1748 posts
Joined: May 2006
Online
It's irritatingly hard. You can chref the width and height from the file cop, or use vex to query the image dimensions.

It should be much much easier.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
127 posts
Joined: Feb. 2021
Offline
Good ideas! I truly wish SideFX would give a tiny bit of love to cop2 networks once in a while (COP2s have feelings too). I doesn't have to be nuke. But its perfect for slaps and texture stuff. Polishing the basics and adding av few bits and bobs would be enough in my book.
Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
127 posts
Joined: Feb. 2021
Offline
SOLVED
For anyone looking for the same thing. This is what I came up with. Just replace resx and resy with your resolution or aspect ration. Then use the same resolution in a scale node. Thanks mestela for pointing me in the right direction.

Attachments:
Screenshot from 2021-09-01 23-03-29.png (48.8 KB)

Andreas Weidman
VFX Supervisor - Dupe VFX
www.dupevfx.com
User Avatar
Member
8 posts
Joined: Oct. 2017
Offline
Thanks everyone for the wonderful solutions! Here is my spin on it with HDA.
Click on 'Edit Parameter Interface' and add vector2 'ar' and float 'ratio'.

Horizontal Crop:
if ( ch("ratio")<1, (res("../`opinput('.',0)`", D_XRES) - ch("hcrop2")) / 2, 0 )
if ( ch("ratio")>1, res("../`opinput('.',0)`", D_XRES), (res("../`opinput('.',0)`", D_YRES) / ch("ary")) * ch("arx") )
Vertical Crop:
if ( ch("ratio")>1, (res("../`opinput('.',0)`", D_YRES) - ch("vcrop2")) / 2, 0 )
if ( ch("ratio")<1, res("../`opinput('.',0)`", D_YRES), (res("../`opinput('.',0)`", D_XRES) / ch("arx")) * ch("ary") )
Ratio:
res("../`opinput('.',0)`", D_XRES) / res("../`opinput('.',0)`", D_YRES)

Features:
  1. Procedural path and resolution of the input node
  2. Custom aspect ratio
  3. Supports vertical and horizontal aspect ratios
  4. Packed into HDA
Edited by yakymoto - yesterday 09:48:27

Attachments:
custom_crop1.png (534.9 KB)
cop2_reformat.hda (17.7 KB)

Best regards, Stanislav Yakymenko.
Houdini artist based in Berlin, Germany.
yakymoto.com
  • Quick Links