HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/resolve/Developer/Fusion Fuse/ZebraVS.fuse
-- namespace Fusion::ZebraVS {

--[[	Out-of-range Zebra-pattern ViewShader fuse		]]--

-- params for the shader:
params =
[[
float black		// enable switches (0 or 1), one per line
float white
float check
]]

-- Here's the GLSL shader itself:
shader =
[[
void ShadePixel(inout FuPixel f)
{
	EvalShadePixel(f);								// get source pixel

	vec4 clampb = max(f.Color, 0.0);				// clamp black
	vec4 diffb  = ceil(abs(f.Color - clampb));		// unclamped = 0, clamped = 1
	vec4 clampw = min(f.Color, 1.0);				// clamp white
	vec4 diffw  = ceil(abs(f.Color - clampw));		// unclamped = 0, clamped = 1

	diffb = black * clamp(diffb,0.0f,1.0f);			// limit to 0..1 and apply switch
	diffw = white * clamp(diffw,0.0f,1.0f);
	vec4 diff = diffb + diffw;						// combine channel differences

	if (check != 0)
	{
		vec2 coord = sign(fract(f.TexCoord2 / 10.0f) - 0.5f);
		diff *= abs(coord.x + coord.y) * 0.5f;							// alternative: checker pattern
	}
	else
		diff *= step(mod(f.TexCoord2.x + f.TexCoord2.y + 0.1f, 8), 4);	// zebra pattern

	f.Color = mix(f.Color, diffb, diff);			// switch between orig & black/white
}
]]

-- regnode
FuRegisterClass("ZebraVSFuse", CT_ViewLUTPlugin, {		-- ID must be unique
	REGS_Name = "Zebra ViewShader",
	REGS_Context = "Fusion::ZebraVS",
	})

-- Called on creation. Add any controls here.
function Create()
	InBlack = self:AddInput(tr("Black"), "Black", {
		LINKID_DataType    = "Number",
		INPID_InputControl = "CheckboxControl",
		INP_Default        = 1.0,
		ICD_Width          = 0.5,
		})
	InWhite = self:AddInput(tr("White"), "White", {
		LINKID_DataType    = "Number",
		INPID_InputControl = "CheckboxControl",
		INP_Default        = 1.0,
		ICD_Width          = 0.5,
		})
	InChecker = self:AddInput(tr("Checker"), "Checker", {
		LINKID_DataType    = "Number",
		INPID_InputControl = "CheckboxControl",
		})
end

-- This is called when the shader is created
-- img may be nil
function SetupShadeNode(group, req, img)
	return ViewShadeNode(group, "ZebraVSFuse", params, shader)	-- pass struct name, params, and shader string
end

-- This is called every display refresh
-- img may be nil
function SetupParams(req, vs, img)
	local black = InBlack:GetValue(req).Value		-- retrieve control values
	local white = InWhite:GetValue(req).Value
	local check = InChecker:GetValue(req).Value

	vs:Set(1, black)							-- and setup the shader's parameter values
	vs:Set(2, white)
	vs:Set(3, check)
	return true
end


-- };