Re: Is Sunflow limited in Sweet Home 3D?
by Puybaret » Fri May 04, 2018 3:34 pm
Hum, I think you should learn how to handle colors with hexadecimal or binary notation, rather than like integers...
enkonyito, your code should be:
Code: Select all
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.