PDA

View Full Version : free lscript: autolightcreate



Svenart
01-15-2010, 05:24 AM
hi everbody,

some weeks ago I worked on a scene with a lot of buildings. I decided, to put lights into every building, but I had to recognize that it way too complicated to place 400+ lights precisely into the buildings in Layout, not at least because of the slow opengl (3million polygons in scene).

So I started to write this simple script. The script is placing lights into your selected object (and all objects with same name), using the polygon positions of your "lightobject" as reference.

How it works:

At first, load your object in modeler and create a small polygon on every position where you want the script
to place a light. Use small polygons, the script will use the first point of the polygon as position.

Cut your „lightpolygons“ and paste them into a new blank object. Now, save the object with the same name
as your main object + „_lights“. So, if your main object is called „lamp.lwo“, your light object should be called „lamp_lights.lwo“.

Go into layout and load your main object. Now you can clone, move and rotate your object like you want.

Start the script, enter the values for the light and click ok. The script will now place all the lights in your selected
object and all objects with the same name.


You can download the script here:

http://svenart.de/plugins/autolightcreate.zip

Lewis
01-15-2010, 05:58 AM
Sounds interesting but i wonder how is this different than current modeler--layout workflow of converting to Luxigons ? Any video maybe to show us workflow difference/advantage over Luxigons :).

Thanks for plugin, it's always nice to have helpers on big projects :).

Svenart
01-15-2010, 06:37 AM
thank you...

I dont know so much about luxigons, only tried them 1-2 times years ago. Now I see this would also be a good way. The only difference I can see at the moment is that my script is working on the selected object and on all objects with same name in scene. Also, you can move and rotate your objects before starting script, wich is not possible with luxigons at the moment (I guess).

However, the script is really basic, I just needed 20minutes to write it so its useful for me in this situation. If anyone likes to use it maybe I will add some more options (variations for lightcolor+intensity for example) in future...

Lewis
01-15-2010, 06:55 AM
Don't get me wrong it's good to have it i just wondered about differences since I used Powergon/Luxigon tool when i needed it before :). If i had this script then I'd probably use it :). As for more features in future it's nice idea to maybe have random seed on intensity/color and similar stuff what is always nice with Instancing 'coz you can do many things with few clicks :) :).

Thanks

Svenart
01-16-2010, 01:47 AM
no problem, Im glad you have mentioned that :)

Serling
01-24-2011, 05:11 AM
Sounds like this is the kind of feature Newtek should consider adding to subsequent versions of LightWave: the ability to create lighting arrays in Layout as exists in Modeler for objects.

For some reason, I can't get the Convertluxigon plug-in to create lights from my luxigons.

One more thing: on another thread, someone mentioned that LW9.6 comes with a bunch of IES presets, but I can't find these. Anyone know where they are in either LW9.6 or 10?

Thanks again, guys.

nickdigital
01-24-2011, 06:03 PM
I don't think I'm using this lscript right. When I convert my "_lights" object into lights they're not where I expect them to be.

When I convert to lights the lights look to respect the heading of my object but none of the other rotations.

Also when I have the "Parent to Item" box checked no lights get generated but the "lights" object disappears.

[edit]
Now I'm getting a "Line 85, illegal arithmetic operation on data type" error.

Svenart
01-24-2011, 09:07 PM
@ nickdigital:

I have created a small examplescene. Just load it, start the script and it should work.

Please note:

1. before starting the script make sure you have selected an object (doesnt matter wich). If you have selected a camera, the script will not run (i fix this soon as possible).

2. Make the lightpolys as small as possible and use triangles, not quads or ngons.

3. You DONT need the lightobjects (for example: blahblah_lights.lwo) in scene!

If you still have problems using the script just let me know. You also can sent me your scene/objects, and I check it.


are you using a mac? Lw 9.6 or lw10?

nickdigital
01-24-2011, 11:12 PM
Thanks, I'll play with this tomorrow and let you know how it goes.

I'm using a PC, both 9.6 and 10.0.

OnlineRender
01-25-2011, 05:24 AM
mind if I add this to 3Djunkies.net Database ? I am starting to pull content and I would like for permission to url forward your work ?

http://3djunkies.net/mod/form/my_forms.php?form_view=all&id=280

OnlineRender
01-25-2011, 05:37 AM
svenart forgot your a member , if you want you can create your own content , if you upload your file it will automaticly store it in your personal storage .

nickdigital
01-25-2011, 10:50 AM
Thanks for the test scene. I have a better understanding of how your script works but it's still not doing what I think it should be doing. It's possible that the script is working right and I'm just expecting different results.

If I rotate my object the lights still don't show up where I expect them to be. I've attached the files that I'm testing with. The box is rotated. I would expect the lights to be oriented so they're along the faces of the box.

Also is it possible for the light selection drop down to include 3rd party lights?

Svenart
01-25-2011, 11:54 AM
@ nickdigital:
Aligning lights to poly direction is not working in this version. I know how to align to normals of polys in modeler, but unfortunately not in layout, so this is a problem at the moment :(

Wich other 3rd party lights would you like to use?

Svenart
01-25-2011, 12:00 PM
svenart forgot your a member , if you want you can create your own content , if you upload your file it will automaticly store it in your personal storage .

Hi,

I will add all my lscripts in the next few days on your site. :thumbsup:

nickdigital
01-25-2011, 12:01 PM
@ nickdigital:
Aligning lights to poly direction is not working in this version. I know how to align to normals of polys in modeler, but unfortunately not in layout, so this is a problem at the moment :(

Wich other 3rd party lights would you like to use?

So is it best to use this script if the objects are only moved in Layout. Don't rotate them?
[edit] Actually setting the lights to parent to the object makes them line up with the rotated object. I'm slowly getting the hang of this script. 8)

Here's all the lights that I have:

OnlineRender
01-25-2011, 12:02 PM
Hi,

I will add all my lscripts in the next few days on your site. :thumbsup:

awesome , I have uploaded a temp one for now !goes straight to your website , but I would much rather preffer the author does it :) . . .

I will be working on making the DB more effecent and more pleasing to the eye sometime next week .

nickdigital
01-25-2011, 12:13 PM
Would it be possible to add a requester so we can change the name of the light?

Also what about adding an option to specify a target object for the light?

Using 1-point polys works too. It doesn't have to be triangles right?

Svenart
01-25-2011, 01:06 PM
I wrote this script quickly a year ago to place all the lights (more than 300) in this image:

http://www.newtek.com/forums/showthread.php?t=104836&highlight=wintermarket

Because I only needed pointlights in this case, I disregarded the other light types. But I will try to add more light types and aligning to normals soon if possible.

@ nickdigital: requester and targeting should be possible, I will try that. You are right, its orienting on the first point of every triangle, so actually you only need one point (at this moment).

@ onlinerender: great to hear :)

Svenart
01-25-2011, 01:13 PM
So is it best to use this script if the objects are only moved in Layout. Don't rotate them?
[edit] Actually setting the lights to parent to the object makes them line up with the rotated object. I'm slowly getting the hang of this script. 8)

Here's all the lights that I have:

you should be able to move and rotate the models in layout without problems, even if you not usw parent.