News:

All posts discussing pricing or where to buy TurboCAD will be deleted.

Main Menu

Flashing Lights

Started by AussieBloke, December 30, 2020, 07:29:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AussieBloke

There is no timer function in AL or not that Im aware of, so what other methods can I use to flash the police car lights? 


Andy H

I'll look at the file tomorrow, but its bed time now 03:30, so just a quick note

The timer is simply the frame number,  generally AVI is saved at 25 frames per second,  So if you wished each light to flash for one second you could have - (using commands).

Red - frame 0 to 0  turn on light.
        frame 25 to 25  turn off light.
        frame 51 to 51 turn on light
Blue - starts with light off
        frame 25 to 25  turn on light.
        frame 51 to 51  turn off light.

If the light will turn on / off a lot of times, Then. To save typing in lots of commands, I'd just write a very simple script.  But for only a few times, I'd just type commands.

Andy

AussieBloke

#2
Thanks Andy thats good advise to use the frame rates as a defacto counter.  ;D ;D ;D ;D

Edit: I guess I will have to experiment when I convert the avi to a suitable video format for youtube, but theres lots to do in the meantime.

Edit2: Yeah its only needed for about 5 seconds or so, at this stage.

AussieBloke

When writing scipts for al should I use vb scripting or vba scripting reference, or are they essentialy the same?

Andy H

#4
Quote from: Darryl W on December 30, 2020, 09:17:49 PM
When writing scripts for al should I use vb scripting or vba scripting reference, or are they essentially the same?

The main thing to remember with VBS. is that all variables are of variant type (same as PPM's).  So when using  Dim to declare variable we just use the variable name.  i.e. Dim A  And once declared, the variable can hold any type.  String, Number, Date.

In VB / VBA.  One would have used, for example Dim A as String. Dim B as Long.  A lot of the syntax in VBS is the same as VBA.  There are some things which may not work as expected, but for animation purposes, all the normal stuff works, If / Then,  For / Next,  Arrays etc. 

Looking at your file. I just realised, I have no idea of the lighting sequence, timings etc.  But I am assuming your not going to animate every single LED though.  Now that would be quite a challenge , and keep your busy for a while. ;D

Tim Stewart

Quote from: Darryl W on December 30, 2020, 09:17:49 PM
When writing scipts for al should I use vb scripting or vba scripting reference, or are they essentially the same?
Yes.

But, to avoid anymore grey hairs, I would recommend staying with AL commands and Key Frame editing, if you can.
It's simple but tedious for long animations.
I believe all those lights are fired sequentially.
That should be fun!
Regards Tim

You can design without engineering, but you cannot engineer without design.
Windows 10 Pro (19043.1165) 64-bit, TurboCAD Designer 2017-2020 and Pro. Plat. 2018-2020 + LW (64-bit) + AnimationLab 6
Intel i5 2500@3.3GHz 8GB Ram NVIDIA Quadro K2200

AussieBloke

Quote from: Tim Stewart on December 31, 2020, 07:00:12 AM
But, to avoid anymore grey hairs, I would recommend staying with AL commands and Key Frame editing, if you can.
It's simple but tedious for long animations.
I believe all those lights are fired sequentially.
That should be fun!

Yep but I edited the lights just to simplify things. Timing sequence from an electronics website.

Lighting sequence guide
red on blue off
red off blue off
red on blue off
red off blue off
red off blue on
red off blue off
red off blue on
red off blue off
100 ms wait time

Not sure what to do with the centre white coloured lights yet, your guess is?

AussieBloke

So heres a simple animation of lights from a 911 porsche, think I got this from grabcad as a demo of lighting sequence. Its way to complex for what I need, its just an example only.

Andy H

Quote from: Darryl W on December 31, 2020, 01:32:29 PM
Not sure what to do with the centre white coloured lights yet, your guess is?

Just checked the internet for Australian lights, and it seems to differ a lot.  Some have nothing in middle.  Some have the word Police, and some have a white light. 

So I'll not bother guessing.  Your on your own at deciding what to use.   ;D ;D 

AussieBloke

#9
Quote "But, to avoid anymore grey hairs, I would recommend staying with AL commands and Key Frame editing, if you can.
It's simple but tedious for long animations.
I believe all those lights are fired sequentially.
That should be fun!"

What Im thinking is to break the animation into sequences or sections based on some animations done in the scenario and others in the keyframes editor like you say Tim.

Also that rather than create 1 seamless animation ( saves rendering time etc ) Im gunna have a pause  screen with some explanation text that holds on screen for say 10 seconds or so.

Therefore I can use the Montage editor to add those explanation screens. Albeit that I can also use my movie editor Movavi as well. Does that make sense Tim/Andy?

Edit: Andy are you still assisting with lights sequence?

AussieBloke

Andy any lighting sequece is acceptable.

Tim Stewart

Quote from: Darryl W on December 31, 2020, 03:59:15 PM
Quote "But, to avoid anymore grey hairs, I would recommend staying with AL commands and Key Frame editing, if you can.
It's simple but tedious for long animations.
I believe all those lights are fired sequentially.
That should be fun!"

What Im thinking is to break the animation into sequences or sections based on some animations done in the scenario and others in the keyframes editor like you say Tim.

Also that rather than create 1 seamless animation ( saves rendering time etc ) Im gunna have a pause  screen with some explanation text that holds on screen for say 10 seconds or so.

Therefore I can use the Montage editor to add those explanation screens. Albeit that I can also use my movie editor Movavi as well. Does that make sense Tim/Andy?

Edit: Andy are you still assisting with lights sequence?

Whether you animate the whole as one, or in sections, is probably immaterial.

Montage editor can add those explanation screens, but is only useful for basic stuff.

Titling, explanatory text, effects, cutting and splicing are more easily done in any decent third-party editor.
Regards Tim

You can design without engineering, but you cannot engineer without design.
Windows 10 Pro (19043.1165) 64-bit, TurboCAD Designer 2017-2020 and Pro. Plat. 2018-2020 + LW (64-bit) + AnimationLab 6
Intel i5 2500@3.3GHz 8GB Ram NVIDIA Quadro K2200

Andy H

#12
Quote from: Darryl W on December 31, 2020, 03:59:15 PM
Edit: Andy are you still assisting with lights sequence?

Sure.  The Cyclic Gif  below uses 0 to 15 frames numbers.  It could have been done with 0 to 7 but I ran it twice just to ensure it worked correctly. Obviously AVI doesn't really have a cyclic option, So One needs to calculate the required number of frames. 

In the script below.  The bit what says  [ If fm / 2 = Int(fm / 2) then ].  Is just for Gif as its saved at 15 frames per second.  it gives a rough wait time of 130ms,  For AVI it should be changed to [ fm / 3 ]. to get a similar wait time.   Basically the number can be whatever one wishes.   I did it this way as it is a simple way to step code, i.e. it only executes the code every 2 frames, 3 frames or whatever.


Dim r '  (red light)
Dim b '  (blue light)
Dim i '  (on / off)
Dim cr '  (case counter)
Dim fm '  (frame number)

Sub StepCustomAction

If StepNum = 0 then '(this initialises the variable to avoid errors)
r = 0
b = 0
i = 0
cr = 1
End If

fm = StepNum   

If fm / 3 = Int(fm / 3) then

If i = 0 then
r = 0
    b = 0
i = 1
Else
i = 0

Select case cr
Case 1
    r = 1
    b = 0
cr = 2
Case 2
    r = 1
    b = 0
cr = 3
Case 3
    r = 0
    b = 1
cr = 4
Case 4
    r = 0
    b = 1
cr = 1
End Select

End If
End If

End sub


NOTE.  The above is just an example of what could be done.  Not saying its the best way.  Just that it works.

## Edit ##   Oh, I should have added, that I set the commands for the Red light to --  Frame 0 to 15 LightSwitch r  And Blue light to --  Frame 0 to 15 LightSwitch b  (r and b are the variables, passes to turn the light on or off)  ##End Edit ##

AussieBloke

#13
That looks really well done Andy, so thankyou.

What type of lights did you use?

Can you post the source/tcw?

Edit: Im a newbie with the scripting of al and getting all to work.

Edit 2: What material did you use on those lights?

Did you use lights or a luminance?

AussieBloke

I took some time away and the questions I asked Andy came to me a little later. I did do an al test with the lightswitch but saw no lights flash, that was due to my materials I used, so I will redo it again with a better material and improve my design.

Thanks for your contributions Andy. :)

AussieBloke


Andy H

Quote from: Darryl W on January 02, 2021, 05:40:14 AM
So heres mine to date.

Hi Darryl.  I'm not sure if you still wanted to look the the file or not.  Anyway.  If not someone else may want to look. I did the original using RedSDK.  so had to alter things a bit, to get it to use lightworks.  It will not be exactly the same as the one I posted. 

For the actual animation on the vehicle.  I'd probably use a point light.   Your animation flashes well, but the red light actually flashes one time than the blue.  which shows up in the animation. 

AussieBloke

Yes Andy I did compare yours and mine, yours is better than mine. Might be because of your experiences with al v my lack of experience. :D

I did try the same lights as what you used, just didnt set the wattage up high enough to see the difference and theb discarded those lights. :(

In that chm helpfile for al 5.2, you talk about changing luminances inside a drawing, does that slow down rendering much, Ive got an older pc system?

Other than that last question everything else is pretty much straight forward, at least Im hoping anyway.  ;D

Andy H

Quote from: Darryl W on January 02, 2021, 04:24:08 PM

In that chm helpfile for al 5.2, you talk about changing luminances inside a drawing, does that slow down rendering much, Ive got an older pc system?

Other than that last question everything else is pretty much straight forward, at least Im hoping anyway.  ;D

With luminance it differs a lot depending on the scene.  Also I use RedSDK, and the luminance is quite different to Lightworks.  For many circumstance it may not make much difference.  The reasons I chose a point light, rather than luminance, is because Luminance does not have an on / off switch command in AL.  RedSDK has an Activated property for turning the luminance on / off.  But I don't know if Lightworks has a similar property.  Though one can always just turn the power un and down. 

When I used to use just Lightworks, I tended not to use Luminance.  I do use it more in RedSDK.  So I'm not the best person to advise on Lightworks luminance.

John R

Quote from: Andy H on January 02, 2021, 06:16:48 PM
Quote from: Darryl W on January 02, 2021, 04:24:08 PM

In that chm helpfile for al 5.2, you talk about changing luminances inside a drawing, does that slow down rendering much, Ive got an older pc system?

Other than that last question everything else is pretty much straight forward, at least Im hoping anyway.  ;D

With luminance it differs a lot depending on the scene.  Also I use RedSDK, and the luminance is quite different to Lightworks.  For many circumstance it may not make much difference.  The reasons I chose a point light, rather than luminance, is because Luminance does not have an on / off switch command in AL.  RedSDK has an Activated property for turning the luminance on / off.  But I don't know if Lightworks has a similar property.  Though one can always just turn the power un and down. 

When I used to use just Lightworks, I tended not to use Luminance.  I do use it more in RedSDK.  So I'm not the best person to advise on Lightworks luminance.

With LightWorks, would assigning a luminance to an object that is assigned to its own Layer work? Then have Animation Lab turn that layer on and off, to create the flashing effect.
John R.

V17—V21, 2015—2025
Designer, Deluxe, (Basic, Expert, Professional), Platinum
RedSDK enabled
Windows 11 Pro (25H2), 64-bit

AussieBloke

Good point John, I will give it a go shortly.

Andy H

Quote from: John R on January 03, 2021, 01:36:42 PM
With LightWorks, would assigning a luminance to an object that is assigned to its own Layer work? Then have Animation Lab turn that layer on and off, to create the flashing effect.

That is a very good point John.  And would certainly work,  better than messing with properties.

Tim Stewart

Regards Tim

You can design without engineering, but you cannot engineer without design.
Windows 10 Pro (19043.1165) 64-bit, TurboCAD Designer 2017-2020 and Pro. Plat. 2018-2020 + LW (64-bit) + AnimationLab 6
Intel i5 2500@3.3GHz 8GB Ram NVIDIA Quadro K2200

Andy H


AussieBloke

Hey Tim thats a nice siren sound, where did you get it?

Tim Stewart

Quote from: Darryl W on January 04, 2021, 11:55:02 AM
Hey Tim thats a nice siren sound, where did you get it?
It's been on the HD for a few years.
There are probably many .wav examples, now available for download.
Regards Tim

You can design without engineering, but you cannot engineer without design.
Windows 10 Pro (19043.1165) 64-bit, TurboCAD Designer 2017-2020 and Pro. Plat. 2018-2020 + LW (64-bit) + AnimationLab 6
Intel i5 2500@3.3GHz 8GB Ram NVIDIA Quadro K2200