Advertisement
Guest User

AlphaCut

a guest
May 9th, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. function init()
  2.     setName("Alpha Cut")
  3.     setDesc("Put Transparency into stuff")
  4.     setSize(100,18+18+24+64+8+8+7+4)
  5.     addOutput(24+32)
  6.     addInput("Texture",24+64+8+8)
  7.     addInput("Alpha",18+24+64+8+8)
  8.     addParameter("Cut","Lightness Cut",18+18+24+64+8+8,50,0,100)
  9. end
  10. -- Ugly way to use channels
  11. function apply()
  12.     math.randomseed (getValue(5,0,0,1))
  13.     x = 0
  14.     y = 0
  15.     tileSize = getTileSize()
  16.     for i=0, tileSize*tileSize-1 do
  17.         x = i%tileSize
  18.         y = math.floor(i/tileSize)
  19.         outr, outg, outb = getValue(0,x,y,1)
  20.         if (getValue(2,0,0,100) < getValue(1,x,y,1)) then
  21.             setPixel(0,x,y,outr,outg,outb)
  22.         end
  23.     end
  24.    
  25.    
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement