Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 17
Posts: 17   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 6936 times and has 16 replies Next Thread
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 601
Status: Offline
Reply to this Post  Reply with Quote 
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
[May 4, 2018, 4:38:06 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
ndorigatti
Member



Italia
Joined: May 12, 2017
Post Count: 65
Status: Offline
Reply to this Post  Reply with Quote 
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
[May 4, 2018, 2:04:43 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 4, 2018, 3:34:23 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 601
Status: Offline
Reply to this Post  Reply with Quote 
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
[May 5, 2018, 12:23:37 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 601
Status: Offline
Reply to this Post  Reply with Quote 
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
[May 9, 2018, 11:35:02 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[May 11, 2018, 11:22:57 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 601
Status: Offline
Reply to this Post  Reply with Quote 
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
[May 11, 2018, 7:05:48 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 17   Pages: 2   [ Previous Page | 1 2 ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved