Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Problems with GLOB_FRAME_NR

Anonymous
Not applicable
I am having a problem getting the results of using the GLOB_FRAME_NR parameter to show up in an animation. What I am trying to do is get lights to flash.

I have thoroughly checked the script and am sure that it is working properly. The light does go on and off according to the conditions I set. The animation process (Create Fly-Through) IS recalculating the model for each frame. (I checked this in the report window.) BUT...

The lights are modeled (on or off) according to the setting of the first frame in the animation and do not change after that. They should be flashing according to parameters I have set in the script. I have tried this in LightWorks and the internal engine with the same results. It seems that the recalculation (though reported) isn't actually having any effect on the parts.

I'm pretty sure I have done everything possible to make this work. So I am guessing I have run into some sort of bug, but just want to throw this out there in case there's something I'm missing. Or even if someone knows if this is a bug and of what sort.
20 REPLIES 20
Anonymous
Not applicable
How do you turn on / turn off the light in your script? With intensity level? Or with some on/off setting?

I'm not that familiar with lights in GDL, what parameters that could be set and so on. But in many other software where I need to turn off / turn on things, it won't work with on/off settings but if I change level it will work.
Anonymous
Not applicable
This is in the Master Script:
period			= ML_strobe_rate*ML_frame_rate
flash			= ML_strobe_dur*ML_frame_rate

IF ML_strobe_rate > 0 THEN
	IF GLOB_FRAME_NR MOD period < period - flash THEN
		strobe_switch = 0
	ELSE
		strobe_switch = 1
	ENDIF
ELSE
	strobe_switch = 1
ENDIF

...and this is the 3D:
IF strobe_switch = 0 THEN
	strobe_color = ML_strobe_off_mat
ELSE
	LIGHT D, E, F, 0,
		0.1, 40, 80, 1.0,
		0.1, 8.0,
		1.0 
	strobe_color = ML_strobe_on_mat
ENDIF
Anonymous
Not applicable
I normally use ( ) in code like IF (GLOB_FRAME_NR MOD period) < (period - flash) THEN but don't think that's the problem, even if it's the IF-row that often is the problem when I got bugs in my GDL-objects.

I'm a bit in a hurry so don't have time to check your code but have you tried to set a PRINT variable on each frame so you could check what value you got?


Matthew wrote:
This is in the Master Script:
period			= ML_strobe_rate*ML_frame_rate
flash			= ML_strobe_dur*ML_frame_rate

IF ML_strobe_rate > 0 THEN
	IF GLOB_FRAME_NR MOD period < period - flash THEN
		strobe_switch = 0
	ELSE
		strobe_switch = 1
	ENDIF
ELSE
	strobe_switch = 1
ENDIF

...and this is the 3D:
IF strobe_switch = 0 THEN
	strobe_color = ML_strobe_off_mat
ELSE
	LIGHT D, E, F, 0,
		0.1, 40, 80, 1.0,
		0.1, 8.0,
		1.0 
	strobe_color = ML_strobe_on_mat
ENDIF
Anonymous
Not applicable
Hi Matthew,

Or... Have you checked the LIGHT definitions?...

I tested yours:
LIGHT D, E, F, 0, 
      0.1, 40, 80, 1.0, 
      0.1, 8.0, 
      1.0
And it has no effect on the render...

HTH.
Anonymous
Not applicable
Matthew,

Attached a test on a lamp object.
In animation, blades turn, and light flashes.
You will have to calculate your own frequency for flashing.

I just added these lines to 3D script
!!! ---------- Flashing ----------
if bAnim and bFlash then
	if bittest (GLOB_FRAME_NR, 0) then 
		C = 1
	else
		C = 0
	endif
endif
Anonymous
Not applicable
Thanks for the replies guys.

Olivier, I will take a look at your part to see if it works where mine does not. Thanks for the example.

Braza, I have checked and the light does work. Of course D, E, F & G have to have appropriate values.

Turbo, I have never used parentheses in my conditionals and have no problems with them. Seems like it would be a good way to keep things clear in more complex ones, but then I usually pull the calcs out of those and assign them to variables in advance.

The thing is I don't think the problem is in the code. It executes properly in the first frame of the animation (on or off depending on how I adjust the script) but then it fails to change for the remainder. The slip seems to be that the animation process thinks it is recalculating the scripts but the model is not being updated.

Thanks again for the suggestions. I is looking more and more like a hardware/software glitch, but I'll try your part when I get a chance Olivier.

In the meantime I have a crude workaround. Fortunately it is a simple animation. Basically a fire alarm system test with only one animated variable (the strobe) and the lights are all synchronized so I can render twice and assemble the final from the frames. A bit of a pain but it works.
Karl Ottenstein
Moderator
Hi Matthew,

Do you have your animation set to rebuild the model for each frame?

I believe that is the issue I ran into in 2001 or so with a fireplace object that generated a flickering glow into the room, and which DNC encountered around then as well. If not, I can dig through my files to see what the issue was. (The write-up was on the old e-scribe list, which I do not believe is archived anywhere.)

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.3, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Here is a quick and dirty animation. Small size.
Karl Ottenstein
Moderator
I found my notes from 2001- the bug that DNC and I found in 7.0 is not relevant. It was that if 'rebuild' was checked, that each frame generated took longer and longer to render. So, the key was just to have "Rebuild Model for Each Frame" checked in the fly-through dialog.

Sample attached. (The fire had three lights that randomly varied their color and intensity within a warm range, as well as wobbled their directionality.)

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.3, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB

Start a new conversation!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!