yggdrasil opened this issue on Mar 29, 2005 ยท 19 posts
yggdrasil posted Tue, 29 March 2005 at 4:31 PM
Added terrain (named T1) and populated with LOW density of bollards (160 instances).
Simple python script (below) and WAIT.
<br></br>def pyLightsCallback(k):<br></br><br></br> T = ObjectByName("T1")<br></br><br></br> Eco = GetEcosystemOnObject(T)<br></br><br></br> strong = 20<br></br><br></br> for i in range(0, Eco.GetInstanceCount()):<br></br><br></br> pos = Eco.GetInstancePosition(i)<br></br><br></br> l1 = AddPointLight()<br></br><br></br> l1.SetPosition(pos[0],pos[1],pos[2]+27)<br></br><br></br> l1.SetPower(strong)<br></br><br></br><br></br><br></br><br></br><br></br>T = ObjectByName("T1")<br></br><br></br>T.SetInitFrameCallback(pyLightsCallback)<br></br><br></br><br></br>
--
Mark
Mark
dlk30341 posted Tue, 29 March 2005 at 4:41 PM
oooo...do I see a python expert emerging ;). XLT work :)
Phoul posted Tue, 29 March 2005 at 4:50 PM
Wouaw. Cool concept. Thank you to share that srcipt.
dburdick posted Tue, 29 March 2005 at 4:52 PM
Awesome work - I salute you!
yggdrasil posted Tue, 29 March 2005 at 5:06 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.
Message edited on: 03/29/2005 17:07
Mark
Phoul posted Tue, 29 March 2005 at 5:10 PM
Phoul posted Tue, 29 March 2005 at 5:24 PM
yggdrasil posted Tue, 29 March 2005 at 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
lingrif posted Tue, 29 March 2005 at 6:06 PM
Incredible work. Looks like I'm going to have to start messing around with python
Phoul posted Tue, 29 March 2005 at 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...
yggdrasil posted Tue, 29 March 2005 at 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
sacada posted Tue, 29 March 2005 at 7:26 PM
Excellent script and way to make it work.
Phoul posted Wed, 30 March 2005 at 7:18 AM
Not work for me. I suppose I make something wrong. :-( Sorry.
Message edited on: 03/30/2005 07:18
ChileanLlama posted Wed, 30 March 2005 at 7:50 AM
Very cool. Thanks for sharing :)
yggdrasil posted Wed, 30 March 2005 at 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
Phoul posted Wed, 30 March 2005 at 5:10 PM
Wouaw! Thank you!
Phoul posted Wed, 30 March 2005 at 5:24 PM
yggdrasil posted Wed, 30 March 2005 at 6:36 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)
<br></br>T = ObjectByName("T1")
T.SetInitFrameCallback(pyLightsCallback)
--
Mark
Message edited on: 03/30/2005 18:38
Mark
yggdrasil posted Wed, 30 March 2005 at 7:29 PM
The two extra scripts have been added to the demo download.
Mark