FUSION STUDIO 16 colorwheel in fuses

User avatar
Chuguin
Posts: 3
Joined: Tue Aug 27, 2019 7:07 am
Real name: Hugo

FUSION STUDIO 16 colorwheel in fuses

#1

Post by Chuguin » Wed Sep 11, 2019 11:49 pm

Hi,
It's my first post here i've been lurking around this great forum for a few weeks now wondering if i really should ask this noob question.
Since i've not foud the answer i was looking for here i am!
Do any of you know how to get the old color wheel inside fusion studio 16 when making a fuse?

When i use

  1.  INPID_InputControl = "ColorControl",
  2.         CLRC_ShowWheel = false,

I get the rectangle palette...

I've found this one

  1.  INPID_InputControl = "ColorWheelControl",

but it's not really the same i guess?
I'm really new to the fusion game but i would really apreciate some advices.

Thanks.
Chug.

by Midgardsormr » Thu Sep 12, 2019 7:05 am

As best I can tell the ColorControl's wheel has been replaced by the rectangular widget.

There are no built-in functions to convert HSV to RGB and back, but it's pretty easy to find some on the web:

And here are HSL-RGB conversions from my own scriptlib:

Code: Select all

function rgbToHsl(red, green, blue, alpha)
	local max = math.max(red, green, blue)
	local min = math.min(red, green, blue)
	local h,s,l

l = (max + min) / 2

if max == min then
	h = 0
	s = 0
else
	local delta = max - min
	if l > 0.5 then s = delta / (2 - max - min) else s = delta / (max + min) end
	if max == red then
		h = (green - blue) / delta
		if green < blue then h = h + 6 end
	elseif max == green then 
		h = (blue - red) / delta + 2
	else 
		h = (red - green) / delta + 4
	end

	h = h / 6
end

return h, s, l, a or 1

end -- End of rgbToHsl()


function hslToRgb(hue, saturation, lightness, alpha)
	local r, g, b
	if saturation == 0 then
		r = 1
		g = 1
		b = 1
	else
		function hue2rgb(p, q, t)
			if t < 0 then t = t + 1 end
			if t > 1 then t = t - 1 end
			if t < 1/6 then return p + (q - p) * 6 * t end
			if t < 1/2 then return q end
			if t < 2/3 then return p + (q - p) * (2/3 - t) * 6 end
			return p
		end

	local q
	if lightness < 0.5 then q = lightness * (1 + saturation) else q = lightness + saturation - lightness * saturation end
	local p = 2 * lightness - q

	r = hue2rgb(p, q, hue + 1/3)
	g = hue2rgb(p, q, hue)
	b = hue2rgb(p, q, hue - 1/3)
end

return r, g, b, a or 1

end -- end of hslToRgb()

edit: Wow; I had no idea that would automatically embed. Sorry about the sudden bright light!

Go to full post

User avatar
Kristof
Fusionista
Posts: 557
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 1
Been thanked: 18 times

Re: FUSION STUDIO 16 colorwheel in fuses

#2

Post by Kristof » Thu Sep 12, 2019 2:11 am

Not a tailored answer, but perhaps this link might get you going:

https://www.steakunderwater.com/VFXPedi ... r_Controls

This is for macro setups, but the syntax is (very) similar for fuses.


User avatar
Chuguin
Posts: 3
Joined: Tue Aug 27, 2019 7:07 am
Real name: Hugo

Re: FUSION STUDIO 16 colorwheel in fuses

#3

Post by Chuguin » Thu Sep 12, 2019 6:08 am

Kristof wrote:
Thu Sep 12, 2019 2:11 am

Not a tailored answer, but perhaps this link might get you going:

https://www.steakunderwater.com/VFXPedi ... r_Controls

This is for macro setups, but the syntax is (very) similar for fuses.

Thank you Kristof for your reply.
In fact it's a usefull link, the two snippets i pasted in my post come from the same link you forwarded.

After posting my message i thaught about my issue and i have an idea to maybe fix it. I need to find a way to convert the HSTV output from the ColorWheelControl in to RVB. I haven't had the time to check in the doc if there is a built in function in lua fusion to make this conversion.

Chug.


User avatar
Midgardsormr
Fusionator
Posts: 1096
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 2
Location: Los Angeles, CA, USA
Been thanked: 74 times
Contact:

Re: FUSION STUDIO 16 colorwheel in fuses

#4

Post by Midgardsormr » Thu Sep 12, 2019 7:05 am

As best I can tell the ColorControl's wheel has been replaced by the rectangular widget.

There are no built-in functions to convert HSV to RGB and back, but it's pretty easy to find some on the web:

And here are HSL-RGB conversions from my own scriptlib:

Code: Select all

function rgbToHsl(red, green, blue, alpha)
	local max = math.max(red, green, blue)
	local min = math.min(red, green, blue)
	local h,s,l

l = (max + min) / 2

if max == min then
	h = 0
	s = 0
else
	local delta = max - min
	if l > 0.5 then s = delta / (2 - max - min) else s = delta / (max + min) end
	if max == red then
		h = (green - blue) / delta
		if green < blue then h = h + 6 end
	elseif max == green then 
		h = (blue - red) / delta + 2
	else 
		h = (red - green) / delta + 4
	end

	h = h / 6
end

return h, s, l, a or 1

end -- End of rgbToHsl()


function hslToRgb(hue, saturation, lightness, alpha)
	local r, g, b
	if saturation == 0 then
		r = 1
		g = 1
		b = 1
	else
		function hue2rgb(p, q, t)
			if t < 0 then t = t + 1 end
			if t > 1 then t = t - 1 end
			if t < 1/6 then return p + (q - p) * 6 * t end
			if t < 1/2 then return q end
			if t < 2/3 then return p + (q - p) * (2/3 - t) * 6 end
			return p
		end

	local q
	if lightness < 0.5 then q = lightness * (1 + saturation) else q = lightness + saturation - lightness * saturation end
	local p = 2 * lightness - q

	r = hue2rgb(p, q, hue + 1/3)
	g = hue2rgb(p, q, hue)
	b = hue2rgb(p, q, hue - 1/3)
end

return r, g, b, a or 1

end -- end of hslToRgb()

edit: Wow; I had no idea that would automatically embed. Sorry about the sudden bright light!


User avatar
Chad
Fusionator
Posts: 1408
Joined: Fri Aug 08, 2014 1:11 pm
Been thanked: 14 times

Re: FUSION STUDIO 16 colorwheel in fuses

#5

Post by Chad » Fri Sep 13, 2019 12:49 pm

If you wanted to track exactly what Fusion does internally, you can do Image:CSConvert("RGB", "HSV"), just on an itty bitty image. Would be nice if that also allowed you to operate on a pixel/color instead of an image.


User avatar
Chuguin
Posts: 3
Joined: Tue Aug 27, 2019 7:07 am
Real name: Hugo

Re: FUSION STUDIO 16 colorwheel in fuses

#6

Post by Chuguin » Mon Sep 16, 2019 2:48 am

Midgardsormr wrote:
Thu Sep 12, 2019 7:05 am

As best I can tell the ColorControl's wheel has been replaced by the rectangular widget.

There are no built-in functions to convert HSV to RGB and back, but it's pretty easy to find some on the web:

And here are HSL-RGB conversions from my own scriptlib:

Code: Select all

function rgbToHsl(red, green, blue, alpha)
	local max = math.max(red, green, blue)
	local min = math.min(red, green, blue)
	local h,s,l

l = (max + min) / 2

if max == min then
	h = 0
	s = 0
else
	local delta = max - min
	if l > 0.5 then s = delta / (2 - max - min) else s = delta / (max + min) end
	if max == red then
		h = (green - blue) / delta
		if green < blue then h = h + 6 end
	elseif max == green then 
		h = (blue - red) / delta + 2
	else 
		h = (red - green) / delta + 4
	end

	h = h / 6
end

return h, s, l, a or 1

end -- End of rgbToHsl()


function hslToRgb(hue, saturation, lightness, alpha)
	local r, g, b
	if saturation == 0 then
		r = 1
		g = 1
		b = 1
	else
		function hue2rgb(p, q, t)
			if t < 0 then t = t + 1 end
			if t > 1 then t = t - 1 end
			if t < 1/6 then return p + (q - p) * 6 * t end
			if t < 1/2 then return q end
			if t < 2/3 then return p + (q - p) * (2/3 - t) * 6 end
			return p
		end

	local q
	if lightness < 0.5 then q = lightness * (1 + saturation) else q = lightness + saturation - lightness * saturation end
	local p = 2 * lightness - q

	r = hue2rgb(p, q, hue + 1/3)
	g = hue2rgb(p, q, hue)
	b = hue2rgb(p, q, hue - 1/3)
end

return r, g, b, a or 1

end -- end of hslToRgb()

edit: Wow; I had no idea that would automatically embed. Sorry about the sudden bright light!

Wow thanks a lot Midgardsormr, sorry for the late feedback i wasn't at work this week end (rare times).
I'll definately look into it. I found some HSV conversion function inside eLinBC.fuse from Stephan Ihringer who's using Roman Fedotov fuction (quite a lot of names :) )

I'll see how it goes, i've realised i haven't explained my goal here. I'm modifying the the Nuke Grade fuse from MuseFX so i can have the colorwheel displayed in the UI. One of my coleague is transitioning from nuke and because of the wierd rectangular widget having to adjust RGB sliders independently is quite tedious.
And as a side project it allows me to learn a bit much about how to make my own tools.

Thanks again!
Chug.

PS: I took the liberty of removing the bright code from the quotes of your reply hehe.