For my sandbox mining game, I tried making ores have a small chance of spawning in a specific way. It works fine, however the visual changes look odd and particleemitters are a solid color. I was told by somebody to use a “CMYK formula”. Do you have any recommendations to make the colors look nicer without doing it manually, or do you know what the CMYK formula is? Any help is appreciated.
Not entirely sure what you are doing but if you need a CMYK to RGB function, here is a quick example:
local function CMYKtoRGB(c,m,y,k)
local r = 65535 - (c * (255 - k) + bit32.lshift(k, 8))
local g = 65535 - (m * (255 - k) + bit32.lshift(k, 8))
local b = 65535 - (y * (255 - k) + bit32.lshift(k, 8))
r = bit32.rshift(r, 8)
g = bit32.rshift(g, 8)
b = bit32.rshift(b, 8)
return Color3.fromRGB(r, g, b)
end
print(BrickColor.new(CMYKtoRGB(0,255,255,0)).Name) --> Really red
and for the reverse:
local function RGBtoCMYK(r,g,b)
local k = math.min(1.0-r, 1.0-g, 1.0-b)
local c = 0.0
local m = 0.0
local y = 0.0
if k < 1.0 then
c = (1.0 - r - k) / (1.0 - k)
m = (1.0 - g - k) / (1.0 - k)
y = (1.0 - b - k) / (1.0 - k)
end
c = bit32.lshift(c, 8)
m = bit32.lshift(m, 8)
y = bit32.lshift(y, 8)
return c, m, y, k
end
print(RGBtoCMYK(1,0,0)) --> 0 256 256 0
This may be useful, but what I’m doing is altering the colors of a part using a formula, and somebody said to use a CMYK formula.
What data do you need to pass to the formula? Ryan’s example should work for a basic CMYK to conversion formula. Generally CMYK is used for more accurate color production (when referring to printing), so I’m still a bit unsure what type of CMYK “formula” you mean.
I don’t know either, I was just told by somebody to use some sort of CMYK formula. I’m just trying to have some sort of altered color effect, such as red parts → pink, blue → green, yellow → red, etc.
Are you intending on tweening and changing the color live time? Or having a sort of filter over the world that makes colors different?
Just a chance to make an object have a different color. My problem is the current way I do it looks funky, and my other idea wouldn’t affect neutral colored objects.