{"id":121,"date":"2010-01-25T17:23:13","date_gmt":"2010-01-25T15:23:13","guid":{"rendered":"http:\/\/euqahuba.com\/blog\/?p=121"},"modified":"2013-01-17T12:34:24","modified_gmt":"2013-01-17T10:34:24","slug":"slice-and-plot-my-scanline","status":"publish","type":"post","link":"https:\/\/euqahuba.com\/blog\/?p=121","title":{"rendered":"Slice and plot my scanline!"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/euqahuba.com\/blog\/wp-content\/uploads\/2010\/01\/nuke_plotSlice.jpg\" alt=\"Slice and plot scanlines.\" \/><\/p>\n<p>Slice and plot scanlines in Nuke!<\/p>\n<p><!--more--><br \/>\nI&#8217;ve been playing with the expression node in Nuke lately, and one of the things I made was \u00a0a simple <strong>Slice tool\/scanline plotter<\/strong>. It can sample a slice (between two points) and will plot the color values as a curve over the image.<\/p>\n<p>I&#8217;ve wrapped it up in a group with a set of exposed parameters, but not exported as a gizmo, just because it might be handy to just <strong>copy\/pasta it into your\u00a0scripts<\/strong> somewhere \u00a0without the need to embed it into a pipeline.<\/p>\n<p>It has three modes, per pixel which is checking the raw pixels, and a sample area which is similar to the per pixel method but it can sample a larger area pr pixel as well. (using the ex: \u00a0<strong>r(x,y,5,5)<\/strong> function) and one that will use the first point to determine which full scanline to sample and plot.<\/p>\n<p>Maybe someone will find it usefull, maybe someone will&#8230;&#8230;&#8230;.<strong>buy me a beer&#8230;.<\/strong><\/p>\n<p><code><br \/>\nset cut_paste_input [stack 0]<br \/>\nversion 6.1 v1<br \/>\npush $cut_paste_input<br \/>\nGroup {<br \/>\n name PlotScanline<br \/>\n selected true<br \/>\n xpos -839<br \/>\n ypos 206<br \/>\n addUserKnob {20 Controls}<br \/>\n addUserKnob {4 mode l \"Sampling method\" M {\"Slice Per Pixel (faster)\" \"Slice Area (slower)\" \"Full Scanline\" \"\" \"\" \"\"}}<br \/>\n mode \"Full Scanline\"<br \/>\n addUserKnob {6 add2image l \"Add to original\" +STARTLINE}<br \/>\n add2image true<br \/>\n addUserKnob {6 Normalize -STARTLINE}<br \/>\n addUserKnob {6 tonemap l \"Tone Map (HDRI)\" -STARTLINE}<br \/>\n addUserKnob {6 curve l \"Plot as curve\" +STARTLINE}<br \/>\n curve true<br \/>\n addUserKnob {3 curveFat l \"Curve Thickness\" -STARTLINE}<br \/>\n addUserKnob {3 sa l \"Sample Area\" t \"Disabled when using pr pixel method.\"}<br \/>\n sa 1<br \/>\n addUserKnob {7 lift l Lift R -1 1}<br \/>\n addUserKnob {7 scale l Scale R 0 5}<br \/>\n scale 1<br \/>\n addUserKnob {26 \"\"}<br \/>\n addUserKnob {12 p1 l \"Start Point\"}<br \/>\n p1 {376 418}<br \/>\n addUserKnob {12 p2 l \"End Point\" -STARTLINE}<br \/>\n p2 {428.5 425.5}<br \/>\n addUserKnob {26 \"\"}<br \/>\n addUserKnob {26 \"\" l \"About \" T \"Plot Scanline v0.4 | theo@euqahuba.com\\nUse P1 to select your scanline and\/or you start slice.\"}<br \/>\n}<br \/>\n Input {<br \/>\n  inputs 0<br \/>\n  name Input1<br \/>\n  xpos -480<br \/>\n  ypos 62<br \/>\n }<br \/>\nset N3069610 [stack 0]<br \/>\n Expression {<br \/>\n  temp_name0 length<br \/>\n  temp_expr0 sqrt(r*r+g*g+b*b)<br \/>\n  expr0 r\/length<br \/>\n  expr1 g\/length<br \/>\n  expr2 b\/length<br \/>\n  name Normalize<br \/>\n  xpos -480<br \/>\n  ypos 108<br \/>\n  disable {{1-parent.Normalize i}}<br \/>\n }<br \/>\n Expression {<br \/>\n  expr0 r\/(r+1)<br \/>\n  expr1 g\/(g+1)<br \/>\n  expr2 b\/(b+1)<br \/>\n  name tonamap<br \/>\n  xpos -480<br \/>\n  ypos 134<br \/>\n  disable {{1-parent.tonemap i}}<br \/>\n }<br \/>\nset N7fe58a0 [stack 0]<br \/>\n Expression {<br \/>\n  temp_name0 rExpr<br \/>\n  temp_expr0 \"min(max(0,\\r\\nceil(r(x,parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name1 gExpr<br \/>\n  temp_expr1 \"min(max(0,\\r\\nceil(g(x,parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name2 bExpr<br \/>\n  temp_expr2 \"min(max(0,\\r\\nceil(b(x,parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  expr0 rExpr<br \/>\n  expr1 gExpr<br \/>\n  expr2 bExpr<br \/>\n  expr3 0<br \/>\n  name scanline<br \/>\n  xpos -302<br \/>\n  ypos 193<br \/>\n  addUserKnob {20 User}<br \/>\n }<br \/>\npush $N7fe58a0<br \/>\n Expression {<br \/>\n  temp_name0 rExpr<br \/>\n  temp_expr0 \"min(max(0,\\r\\nceil(r((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y,parent.sa,parent.sa)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name1 gExpr<br \/>\n  temp_expr1 \"min(max(0,\\r\\nceil(g((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y,parent.sa,parent.sa)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name2 bExpr<br \/>\n  temp_expr2 \"min(max(0,\\r\\nceil(b((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y,parent.sa,parent.sa)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  expr0 rExpr<br \/>\n  expr1 gExpr<br \/>\n  expr2 bExpr<br \/>\n  expr3 0<br \/>\n  name Expression_highQuality<br \/>\n  xpos -515<br \/>\n  ypos 197<br \/>\n  addUserKnob {20 User}<br \/>\n }<br \/>\npush $N7fe58a0<br \/>\n Expression {<br \/>\n  temp_name0 rExpr<br \/>\n  temp_expr0 \"min(max(0,\\r\\nceil(r((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name1 gExpr<br \/>\n  temp_expr1 \"min(max(0,\\r\\nceil(g((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  temp_name2 bExpr<br \/>\n  temp_expr2 \"min(max(0,\\r\\nceil(b((x\/width)*(parent.p2.x-parent.p1.x)+parent.p1.x,(x\/width)*(parent.p2.y-parent.p1.y)+parent.p1.y)-((y\/height+parent.lift)*parent.scale))),1)\"<br \/>\n  expr0 rExpr<br \/>\n  expr1 gExpr<br \/>\n  expr2 bExpr<br \/>\n  expr3 0<br \/>\n  name perPixel<br \/>\n  xpos -419<br \/>\n  ypos 201<br \/>\n  addUserKnob {20 User}<br \/>\n }<br \/>\n Switch {<br \/>\n  inputs 3<br \/>\n  which {{parent.mode i}}<br \/>\n  name Switch2<br \/>\n  xpos -480<br \/>\n  ypos 253<br \/>\n }<br \/>\n Matrix {<br \/>\n  matrix {<br \/>\n      {0 1 0}<br \/>\n      {1 -4 1}<br \/>\n      {0 1 0}<br \/>\n    }<br \/>\n  name Matrix2<br \/>\n  selected true<br \/>\n  xpos -480<br \/>\n  ypos 284<br \/>\n  disable {{-1+parent.curve i x70 1}}<br \/>\n }<br \/>\n Dilate {<br \/>\n  size {{parent.curveFat}}<br \/>\n  name Dilate1<br \/>\n  xpos -480<br \/>\n  ypos 326<br \/>\n  disable {{-1+parent.curve.main}}<br \/>\n }<br \/>\n Clamp {<br \/>\n  name Clamp1<br \/>\n  xpos -480<br \/>\n  ypos 383<br \/>\n }<br \/>\nset N86e9e00 [stack 0]<br \/>\npush $N3069610<br \/>\n Dot {<br \/>\n  name Dot1<br \/>\n  xpos -556<br \/>\n  ypos 66<br \/>\n }<br \/>\n Clamp {<br \/>\n  maximum 331<br \/>\n  name Clamp2<br \/>\n  xpos -590<br \/>\n  ypos 352<br \/>\n }<br \/>\n Merge2 {<br \/>\n  inputs 2<br \/>\n  operation plus<br \/>\n  bbox intersection<br \/>\n  name Merge1<br \/>\n  xpos -590<br \/>\n  ypos 394<br \/>\n }<br \/>\n Dot {<br \/>\n  name Dot2<br \/>\n  xpos -556<br \/>\n  ypos 433<br \/>\n }<br \/>\npush $N86e9e00<br \/>\n Switch {<br \/>\n  inputs 2<br \/>\n  which {{parent.add2image i}}<br \/>\n  name Switch1<br \/>\n  xpos -480<br \/>\n  ypos 425<br \/>\n }<br \/>\n Output {<br \/>\n  name Output1<br \/>\n  xpos -480<br \/>\n  ypos 470<br \/>\n }<br \/>\nend_group<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Slice and plot scanlines in Nuke!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4,5],"tags":[29,48,26,32,47,34],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-compositing","category-tips","category-tools-development","tag-compositing-2","tag-expression","tag-nuke","tag-nukex","tag-plot-scanline","tag-vfx"],"_links":{"self":[{"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":19,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions\/321"}],"wp:attachment":[{"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/euqahuba.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}