Alienhead Posted July 20 Posted July 20 I'm seeking an example of setting a PointLight's COLOR and BRIGHTNESS in LUA code please. Yes I've combed the docs and tried all that it said, tis' the reason I've resorted to asking here.. ty. light:SetColor(.5) --- sits the brightness but it also changes the color back to 1,1,1 Quote Alienhead Components and Software
Solution Josh Posted July 20 Solution Posted July 20 Color is actually just converted to a normalized (from zero to one range on each channel) color and brightness like this: c = color; intensity = 1.0f; if (c.r > 1.0f or c.g > 1.0f or c.b > 1.0f) { intensity = Max(c.r, Max(c.g, c.b)); } if (intensity != 1.0f) { c.r /= i; c.g /= i; c.b /= i; } And this converts normalized color and brightness back to the color: color.r *= intensity; color.g *= intensity; color.b *= intensity; In your case, this is all you would need: light:SetColor(light:GetColor() * 0.5) 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.