Wed, Sep 18, 5:21 PM CDT

Renderosity Forums / Vue



Welcome to the Vue Forum

Forum Moderators: wheatpenny, TheBryster

Vue F.A.Q (Last Updated: 2024 Sep 17 9:46 am)



Subject: Proof of concept - Ecosystem of lights


yggdrasil ( ) posted Tue, 29 March 2005 at 4:31 PM · edited Wed, 18 September 2024 at 8:28 AM

file_210518.jpg

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.

<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 · edited Tue, 29 March 2005 at 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.

  1. The lights are added to the scene when you render. If 'tweaking' the script delete the lights between each test.
  2. Once the lights are populated into the scene they tend to completely flare out the OpenGL preview.
  3. And obviously the more lights, the longer the render times. Above example was 11 minutes at preview quality.
  4. The eco-system had zero size variation set to keep things simple.

Message edited on: 03/29/2005 17:07

Mark


Phoul ( ) posted Tue, 29 March 2005 at 5:10 PM

file_210519.jpg

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. ;-)


Phoul ( ) posted Tue, 29 March 2005 at 5:24 PM

file_210520.jpg

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;-).


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

www.lingriffin.com


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 · edited 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

file_210521.jpg

It is working! Thanks again. :-))) Every click to render lights are added; Is it wrong? How could I stop these additions? :-


yggdrasil ( ) posted Wed, 30 March 2005 at 6:36 PM · edited Wed, 30 March 2005 at 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)
<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


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.