| Author | Message |
|---|
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Tue, Mar 29, 2005 4:31 pm, Edited Wed, Mar 30, 2005 7:29 pm |


Created a simple bollard out of 3 stacked cylinders, one with a milky glass type material, and saved as vob.
Added terrain (named T1) and populated with LOW density of bollards (160 instances).
Simple python script (below) and WAIT.
def pyLightsCallback(k):
T = ObjectByName("T1")
Eco = GetEcosystemOnObject(T)
strong = 20
for i in range(0, Eco.GetInstanceCount()):
pos = Eco.GetInstancePosition(i)
l1 = AddPointLight()
l1.SetPosition(pos[0],pos[1],pos[2]+27)
l1.SetPower(strong)
T = ObjectByName("T1")
T.SetInitFrameCallback(pyLightsCallback)
--
Mark
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
dlk30341

Joined: 14 Feb 2003 Posts: 4240 Last Post: 29 Apr 09
[homepage]
|  | Posted Tue, Mar 29, 2005 4:41 pm |
 oooo...do I see a python expert emerging ;). XLT work :) |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Tue, Mar 29, 2005 4:50 pm |
 Wouaw. Cool concept. Thank you to share that srcipt. |
| Back to Top | [quote] [print] [save] |
 |
dburdick

Joined: 25 Feb 2004 Posts: 628 Last Post: 07 Dec 09
[homepage]
|  | Posted Tue, Mar 29, 2005 4:52 pm |
 Awesome work - I salute you! |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Tue, Mar 29, 2005 5:06 pm, Edited Tue, Mar 29, 2005 5:07 pm |
 Thanks folks. I don't know about 'expert' dlk, maybe dedicated dabbler?
Some notes: 1)The +27 in the SetPosition line is specific to the size of the bollard I created, and would need to be adjusted for use with another object. 2) The lights are added to the scene when you render. If 'tweaking' the script delete the lights between each test. 3) Once the lights are populated into the scene they tend to completely flare out the OpenGL preview. 4) And obviously the more lights, the longer the render times. Above example was 11 minutes at preview quality. 5) The eco-system had zero size variation set to keep things simple.Message edited on: 03/29/2005 17:07
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Tue, Mar 29, 2005 5:10 pm |


I am trying it... Just populate. I am making a pause to show you a little trick to have quickly a very low density. Check Variable density. And edit filter... move down the upper key. See capture. ;-) |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Tue, Mar 29, 2005 5:24 pm |


Later... Well. I miss something. But I don't know what. yep... That is not working for me. But it is not your script. It's me the problem! I am dumb with python. I'll try again later (after sleep a few;-). |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Tue, Mar 29, 2005 6:06 pm |
 Thanks for the tip about the density filter. I keep forgeting about filters for some reason - too keen to play with the 'new' features I guess :)
I'm not sure if this works from console (as your image suggests you were doing.) I was testing with an external .py file, and just reloading it after each edit.
Another possibility is if the light is inside the solid part of the bollard.
The bottom cylinder in my example was 25 units high, with 5 unit glass and 5 unit cap. So an offset of +27 in SetPosition puts the light near the middle of the glass.
Also I set direction to surface at 0 (vertical) so I wouldn't have to take angles of rotation into account either.
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
lingrif

Joined: 11 Jun 2003 Posts: 604 Last Post: 07 Jul 08
[homepage]
|  | Posted Tue, Mar 29, 2005 6:06 pm |
 Incredible work. Looks like I'm going to have to start messing around with python
____________________ www.lingriffin.com |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Tue, Mar 29, 2005 6:14 pm |
 I've created a py file too. When you launch one, you can see it in the console. It is because you see the console on the capture. Well, may be I should check the vob. I'll do it tomorrow (tired now. very late here). Thanks again.
PS about the capture about filter. The filter filter box is in front of the value of %. I put 1%. With 1% I had too many vob. So I edit the filter... |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Tue, Mar 29, 2005 6:25 pm |
 Yes, 1% is still pretty dense for this isn't it? My original image was 1% also. Considered using a mixed material to thin it out a bit, but in the end, I decided to see how long 160 lights would take.
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
sacada

Joined: 24 Apr 2003 Posts: 265 Last Post: 04 Nov 06
[homepage]
|  | Posted Tue, Mar 29, 2005 7:26 pm |
 Excellent script and way to make it work. |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Wed, Mar 30, 2005 7:18 am, Edited Wed, Mar 30, 2005 7:18 am |
 Not work for me. I suppose I make something wrong. :-( Sorry.Message edited on: 03/30/2005 07:18 |
| Back to Top | [quote] [print] [save] |
 |
ChileanLlama
Joined: 21 Oct 2004 Posts: 42 Last Post: 15 Jul 05
[homepage]
|  | Posted Wed, Mar 30, 2005 7:50 am |
 Very cool. Thanks for sharing :) |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Wed, Mar 30, 2005 5:06 pm |
 Attached Link: http://www.aelfheim.co.uk/Vue/Demos/Eco-lights.htm
I've now posted a quick flash tutorial and zip of bollard object and script at the above address.
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Wed, Mar 30, 2005 5:10 pm |
 Wouaw! Thank you! |
| Back to Top | [quote] [print] [save] |
 |
Phoul
Joined: 27 Feb 2001 Posts: 616 Last Post: 05 Jul 07 Location: Charlotte NC
[homepage]
|  | Posted Wed, Mar 30, 2005 5:24 pm |


It is working! Thanks again. :-)))
Every click to render lights are added; Is it wrong? How could I stop these additions? :-\ |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Wed, Mar 30, 2005 6:36 pm, Edited Wed, Mar 30, 2005 6:38 pm |

At the moment the script is set up as a callback at the start of each frame render.
Simply rearranging it to:
T = ObjectByName("T1")
Eco = GetEcosystemOnObject(T)
strong = 20
for i in range(0, Eco.GetInstanceCount()):
pos = Eco.GetInstancePosition(i)
l1 = AddPointLight()
l1.SetPosition(pos[0],pos[1],pos[2]+27)
l1.SetPower(strong)
means that it will run just once when loaded, creating the lights immediately. If you then modified the ecosystem you would have to remove the lights and rerun the script
Alternatively, for an animated ecosystem (candles bobbing in the waves?) a few lines of code could be added to erase the existing light set before recreating the new one.
def pyLightsCallback(k):
T = ObjectByName("T1")
Eco = GetEcosystemOnObject(T)
strong = 20
DeselectAll()
SelectByType(VuePython.VUEBasicObject.VOT_PointLight)
Delete()
for i in range(0, Eco.GetInstanceCount()):
pos = Eco.GetInstancePosition(i)
l1 = AddPointLight()
l1.SetPosition(pos[0],pos[1],pos[2]+27)
l1.SetPower(strong)
T = ObjectByName("T1")
T.SetInitFrameCallback(pyLightsCallback)
--
Mark
Message edited on: 03/30/2005 18:38
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |
yggdrasil
Joined: 21 Nov 1999 Posts: 676 Last Post: 21 Apr 06
[homepage]
|  | Posted Wed, Mar 30, 2005 7:29 pm |
 The two extra scripts have been added to the demo download.
____________________ Mark |
| Back to Top | [quote] [print] [save] |
 |