Print at Dec 15, 2025, 7:33:25 PM
Posts: 17   Pages: 2   [ Previous Page | 1 2 ]
View all posts in this thread on one page
Posted by enkonyito at May 4, 2018, 6:38:06 AM
Re: Is Sunflow limited in Sweet Home 3D?
When I apply the RGB color #91895E (9537886 in decimal) to the furniture, the HomePieceOfFurniture.getColor() or HomeMaterial.getColor() method returns -7239330 (in decimal).
How can I convert this signed integer to an unsigned integer?

The value -7239330, processed by
this.sunflow.parameter("radiance", null,
power * (lightColor >> 16) * (this.homeLightColor >> 16),
power * ((lightColor >> 8) & 0xFF) * ((this.homeLightColor >> 8) & 0xFF),
power * (lightColor & 0xFF) * (this.homeLightColor & 0xFF));
does not give the expected color.
----------------------------------------
EnkoNyito

Posted by ndorigatti at May 4, 2018, 4:04:43 PM
Re: Is Sunflow limited in Sweet Home 3D?
Hi, looking online:
#91895E is rgb(145, 137, 94)

if I take the negative value:
int negative = -7239330;
int r = (negative >> 16) & 0xFF;
int g = (negative >> 8) & 0xFF;
int b = negative & 0xFF;
System.out.println(r);
System.out.println(g);
System.out.println(b);

the output is:
145
137
94

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

Posted by enkonyito at May 5, 2018, 2:23:37 AM
Re: Is Sunflow limited in Sweet Home 3D?
Thank you both, I get the right color now!

I think that the TriangleMeshLight class does not allow to have a visible object in the 3D view and that is not visible in the rendering. sad
----------------------------------------
EnkoNyito

Posted by enkonyito at May 10, 2018, 1:35:02 AM
Re: Is Sunflow limited in Sweet Home 3D?
I think that the TriangleMeshLight class does not allow to have a visible object in the 3D view and that is not visible in the rendering. sad
I solved this problem by adding the sweethome3d_light prefix. smile

Light type libraries will be provided with the next version of the plug-in.
----------------------------------------
EnkoNyito

Posted by Puybaret at May 11, 2018, 1:22:57 PM
Re: Is Sunflow limited in Sweet Home 3D?
Just to be sure that you used it correctly, the sweethome3d_light prefix is used to name shapes like light sources that should be visible in the 3D view only when selected.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator

Posted by enkonyito at May 11, 2018, 9:05:48 PM
Re: Is Sunflow limited in Sweet Home 3D?
Yes exactly and not viewable when rendering. That's what I was trying to get from the start.

Now I can have several models that can be used as needed. Differentiation is done at the object's properties and processed by the PhotoRenderer class.
----------------------------------------
EnkoNyito

Posts: 17   Pages: 2   [ Previous Page | 1 2 ]