smile Easy 3D light bulb positioning

This topic has been viewed 10081 times and has 9 replies
Thread status: Active
Discuss anything here [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Easy 3D light bulb positioning

Post by db4tech »

Hi All,

Some of my original goals while working on 'full user lamp control'.
  • Make it easier for users to position their lamps in the 3D view.
  • Since a lamps intensity can now be changed, simplify the light bulb list by only having one colour of each, plus maybe add 1 or 2 more colours.
The alterations seem to be working without problems, but to get this to work I changed one line of code in the rendering plugin, so I need Emmanuel to approve the change (to make sure I haven't broken anything) before I can release the new AdvancedRenderingLights-1.6.sh3f and updated AdvancedRenderingMini-1.6.1.sh3p

As an extra:
I've also further tweaked the caustics "Compute glass transparency" which should help lights placed slightly further away to still travel through thick glass objects, this is only a slight improvement!

The cross-hair idea (which can be improved) is just a simple workaround for now, to help users position their lights in 3D until we have a more permanent solution.


Here are a couple of screen captures:
Firstly the interface showing the cross-hairs in the 3D view.

Image

Next a render of the scene, to show that the cross-hairs don't render.

Image


Keen eyed users, will probably also noticed the simplified light bulb list, plus one extra addition. [:)]
I've tried to also do all the new light bulb translations, there are a couple I couldn't manage.

For users not wanting to use 'User lamp control' ("Use angle as power knob") the BasicLights.sh3f or BasicPlusExtraLights.sh3f will still be available!


Do hope this will be helpful for users!

db4tech
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Easy 3D light bulb positioning

Post by Puybaret »

Go forward db4tech.
You can submit your own plug-ins and sh3f files as long as your releases are clearly named differently. AdvancedRenderingMini-1.6.1.sh3p sounds ok, but I would name the SH3F file as AdvancedRenderingLights-1.6.1.sh3f for the sake of homogeneity.

Thank you again for your great contribution. [:)]
Emmanuel Puybaret, Sweet Home 3D creator
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Re: Easy 3D light bulb positioning

Post by db4tech »

Thank you! [:)]

I'm sorry to say I've got a bit stuck though. My original idea worked but found out it did cause another problem. So after undoing those changes, and having a rethink, I'm trying to add a new exception rule.

Just to test my new exception rule idea works, I temporarily disabled the 2 lines below, I haven't learned enough yet, to know how to let shapeName.startsWith("sweethome3d_light") have it's own exception rule. The idea does work, [:)] I just need help on how to proceed, to give sweethome3d_light, its own exception rule.


// Build a unique object name
String uuid = UUID.randomUUID().toString();

String appearanceName = null;
TexCoordGeneration texCoordGeneration = null;
if (appearance != null) {
if (ignoreWindowPanes
&& shapeName != null
// && shapeName.startsWith(ModelManager.WINDOW_PANE_SHAPE_PREFIX)
// && isDoorOrWindowChild(shape)

&& shapeName.startsWith("sweethome3d_light")
) {
return;
}
texCoordGeneration = appearance.getTexCoordGeneration();
appearanceName = "shader" + uuid;
boolean mirror = shapeName != null
&& shapeName.startsWith(ModelManager.MIRROR_SHAPE_PREFIX);
exportAppearance(appearance, appearanceName, mirror, defaultShininess, silkRendering);
}


I have tried several things, to let sweethome3d_light have its own exception rule but I'm soon starting my next course semester and hoped to get this finished before then. So rather than struggle by myself, [:(] I thought maybe it's best to ask for help.

Thank you in advance!

Good idea about also using 1.6.1 extension for the lights. [:)]

db4tech
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Easy 3D light bulb positioning

Post by Puybaret »

db4tech, you should use the || (or) operator.
Thus, the condition you want to change:

Code: Select all

          if (ignoreWindowPanes
              && shapeName != null
              && shapeName.startsWith(ModelManager.WINDOW_PANE_SHAPE_PREFIX)
              && isDoorOrWindowChild(shape)) {
            return;
          }
will become:

Code: Select all

          if (shapeName != null
              && ((ignoreWindowPanes
                     && shapeName.startsWith(ModelManager.WINDOW_PANE_SHAPE_PREFIX)
                     && isDoorOrWindowChild(shape))
                  || shapeName.startsWith("sweethome3d_light"))) {
            return;
          }
Good luck! [;)]
Emmanuel Puybaret, Sweet Home 3D creator
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Re: Easy 3D light bulb positioning

Post by db4tech »

Aw wow that works a treat! [:)]

I was trying to add the new exception as a separate 'if' statement.

Rather than just copy and paste your solution, I typed it in as thought that might help me learn the interactions between the various elements.

Thank you so much for your quick helpful reply! [:)]

db4tech
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Re: Easy 3D light bulb positioning

Post by db4tech »

After seeing this brilliant Sunflow render by a user called zeitmeister, (it has had some post processing done but) for this post I'm mainly looking at how amazingly realistic the back wall looks!

Image


With that in mind I've been desperately trying to get bump mapping to work for the next release of the Advanced rendering plugin, so people could use it for their scenes and of course not forgetting Emmanuel's image competition! Sadly, so far, I haven't been able to manage it! [:(]

Original source for the above image.

db4tech
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Easy 3D light bulb positioning

Post by Puybaret »

db4tech, I don't know how you tried bump mapping in the advanced rendering plugin, but each time you want to try a new feature of SunFlow, you should try this:
- Search the SunFlow feature you want in SunFlow wiki. For example, bump mapping is explained here.
- Look at its SunFlow syntax, for example:

Code: Select all

modifier {
   name bumpName
   type bump
   texture "C:\texturepath\mybump.jpg"
   scale -0.02
}

- View SCParser class, which contains all the Java calls matching a SunFlow feature.
- In this class, look for the syntax words found in the Wiki. Looking for "bump" will bring you to the line 613 in the parseModifier method.
- Reproduce the Java syntax in your program from the calls made on the api object. For bump mapping it seems to be this:

Code: Select all

this.sunflow.parameter("texture", [i]filePath[/i]);
this.sunflow.parameter("scale", [i]scaleAsFloat[/i]);
this.sunflow.modifier(appearanceName, "bump_map");
(not sure it should be appearanceName though).

I hope this will help you.
Emmanuel Puybaret, Sweet Home 3D creator
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Re: Easy 3D light bulb positioning

Post by db4tech »

Thank you for your quick reply! [:)]

That is where I looked (I mean the SunFlow wiki) and you can see where I was going wrong, this is what I typed in as a test.

this.sunflow.parameter("bump.texture", imagePath);
this.sunflow.parameter("modifier", "bump_mapping");
this.sunflow.parameter("scale", 1);

I got close! [:)]

db4tech

Edit:
Well okay after looking again, maybe I wasn't so close! [:D]

Thanks again!
db4tech
Posts: 223
Joined: Mon May 03, 2010 5:10 pm
Country: UK

Re: Easy 3D light bulb positioning

Post by db4tech »

Hi Emmanuel,

Originally I decided to use "bump_mapping" after looking through the SunFlow scr modifiers section, I then used your shader command structure (compared to the shader commands in the SunFlow scr) as a point of reference.

Sadly I've still not managed to get bump mapping to work, so rather than keep people waiting (I'll have to stop because of my course work) for the improved light positioning, I will release 1.6.1 now, then bump mapping can hopefully be added at a later stage.

After helping a couple of users who struggled with the new lighting, because they didn't understand or know how to rotate the lights, I thought a slight reword might help?

Use light angle as power knob.
Becomes
Light bulb angle controls brightness.

It's slightly longer but still fits well in the mini interface. Hopefully this will then help users know that, it is just the light bulbs that need rotating (not all lamps) and that rotating the light bulb affects just its brightness.

Please can you let me know what "Light bulb angle controls brightness" would be in French.


Thank you in advance for your help.

db4tech
User avatar
Puybaret
Posts: 9440
Joined: Mon Nov 07, 2005 12:00 pm
Country: Paris, France
Contact:

Re: Easy 3D light bulb positioning

Post by Puybaret »

I think the few words of the label will never be clear enough to explain a bizarre idea (using "angle" for "power" !?!), that anyway will be programmed better and differently once integrated in Sweet Home 3D photo creation dialog. So I won't change the French version "Utiliser angle des lumières comme variateur".
Emmanuel Puybaret, Sweet Home 3D creator
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 1 guest