Print at Dec 15, 2025, 4:47:03 PM

Posted by Puybaret at May 4, 2018, 5:34:23 PM
Re: Is Sunflow limited in Sweet Home 3D?
Hum, I think you should learn how to handle colors with hexadecimal or binary notation, rather than like integers...

enkonyito, your code should be:
this.sunflow.parameter("radiance", null,
power * ((lightColor >> 16) & 0xFF) * ((this.homeLightColor >> 16) & 0xFF),
power * ((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
power * (lightColor & 0xFF) * (this.homeLightColor & 0xFF));

You need to apply a 0xFF filter on the color bits after they are shifted from 16 bits, because the 8 higher bits may contain the transparency value, 0xFF being a full opaque value.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator