top of page

Wiper No Wiping

Nov 14, 2022
2 min read

I was creating some breakdowns at work one day and decided to quickly create a 'wipe' gizmo that would expedite the task. Around the same time, I started learning Blinkscript from Chris Fryer's An Artist's Guide to Blinkscript. So I thought why not play around and see if I could replicate the Gizmo using Blinkscript. If you don't want to know the results, click away now!


Blinkscript is a C based language that runs on the GPU, making it incredibly fast. Most of what I've learned has come from Chris Fryer's An Artist's Guide to Blinkscript. It's very well put together and easy to understand, 10/10! For anything I needed to know that wasn't directly covered in the course, the Foundry's documentation was helpful, and a special shoutout to this Erwan Leroy blog, where I got and modified the if/else statement used to make the wipe line.



Inside the initial group node, there are actually 2 Blinkscript nodes running the node. One creates the before/after split between the two plates, the other creates the line that separates them. These 2 tasks can be accomplished in 1 node, but since I'm learning, I found that breaking the overall task into smaller tasks was a great way to quickly isolate and resolve any issues within the code.


Below is the code from the Wipe itself; I won't post the code for the split since it's just a simple if/else statement.


kernel Wipe_Line_Placement : ImageComputationKernel<ePixelWise>
{
  Image<eRead, eAccessPoint> before;
  Image<eRead, eAccessPoint> after;
  Image<eWrite, eAccessRandom> dst;


  param:
    // This parameter is made available to the user.


      float wipe;
      int wipewidth;
      float4 color;



  local:
    // This local variable is not exposed to the user.


    int height;
    float width;
    float wipepos;
    float4 baimage;


  // In define(), parameters can be given labels and default values.
  void define() {
 
    defineParam(wipe, "Wipe Position", 0.5f);     
    defineParam(wipewidth, "Wipe Width", 3);
    defineParam(color, "Color", float4(1.0f));   
   
  }



// The init() function is run before any calls to process().
  // Local variables can be initialized here.
  void init() {


      height = before.bounds.y2;
      width = before.bounds.x2;


  }
 
  void process(int2 pos) {



    //used to determine where in 'x' the wipe is
    float wipepos = wipe * width;



    //loop for line width
    for (int x = 0; x <= wipewidth; x++) {


        //loop from 0 to height of image
        for (int y = 0; y < height; y++) { 


  
              dst(wipepos + x,y) = color; 


              // This writes to the dst image at coordinates     
              //0, y, value 1. WARNING! If the coordinates are 
              //outside of the BBOX, nuke will crash! 
        }
    }


  }
};
 
 
 

2 Comments


terrancecart.e.r.36.0.7
Aug 27

ty le keo mình thấy bạn bè nhắc suốt nên tiện tay bấm vào coi thử giao diện ra sao. Mình không có ngồi đọc kỹ hay làm gì nhiều, chỉ lướt vài vòng cho biết cách họ trình bày thôi. Ấn tượng đầu là nhìn khá sáng sủa, không bị nhồi chữ, kiểu chia nội dung thành từng khối nên mắt bắt nhịp nhanh. Mình thích nhất là phần số liệu để theo dạng bảng cột gọn gàng, nhìn cái là hiểu, đỡ phải kéo lên kéo xuống liên tục. Thanh menu cũng đặt chỗ dễ thấy nên chuyển qua lại giữa mấy mục không mất công mò. Nói chung mở ra là biết mình đang ở đâu, vì…

Like

billy24barne.s7.8.3.5
Aug 21

Bài viết dễ đọc và cuốn, cảm ơn bạn đã chia sẻ. Mình cũng hay theo dõi thống kê XSMB mỗi ngày nên đọc xong thấy nhiều điểm rõ ràng hơn. Vì thường xuyên tra cứu và muốn đối chiếu nhanh, mình tự gom lại thành một trang tổng hợp để tiện xem mọi thứ trong một chỗ. Nếu bạn nào cũng quan tâm và muốn cập nhật theo ngày thì ghé https://.za/campaign/soi-cu-xsmb. Bạn nào cần tra nhanh có thể xem thêm tại https://backabuddy.co.za/campaign/soi-cu-xsmb

Like
imdb_icon.png
linkedin_icon.png
bottom of page