Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

A simple node to overlay one image over another. Script acts by considering the lowest RGB value as if it were an alpha value. Titled the node as "Cover."

Update because the link (Cover) doesn't work anymore (oops) here's the script itself again, anyways. (Just fixing my oops.)

function init()
     setName("Overlay")
     setDesc("Overlays texture on another.")
     setSize(140, 24+64+8+8+18+18+7+4)
     addOutput(24+32)
     addInput("Underlay", 104)
     addInput("Overlay", 104+18)
     addInputParameter("Tolerance","Minimum Pixel Value",104+34,1,0,256)
end
function apply()
     Size = getTileSize()
     for x=0, Size-1 do
         for y=0, Size-1 do
             T1R, T1G, T1B = getValue(0,x,y,255)
             T2R, T2G, T2B = getValue(1,x,y,255)
             Tol = getValue(2,x,y,255)
             Min = math.min(T2R,T2G,T2B)
             if Min >= Tol then
                 setPixel(0,x,y,T2R,T2G,T2B)
             else
                 setPixel(0,x,y,T1R,T1G,T1B)
             end
         end
     end
end

(Put this in a text file, make sure the extension is .lua, and stick the file in the install path --> nodes.) -- It'll show up as whatever the file name is.