By JDHill
#366773
I am glad, anyway, that you seem to have found a somewhat reasonable compromise. Since I think the slow loading of references comes down to having so many objects to bring in with them, I will try to reduce it to a clear repro and bring that to the attention of the core guys; if that's really the problem, it seems like something that should not be difficult to optimize.
By JDHill
#367274
kami -- there are quite a few internal changes in the new 2.7.27 build pertaining to use with Bongo 2. It is still not to be considered as being a supported configuration, but at least for the time being, it should be useable. When you render an animation from Bongo, it is still the case that nothing will happen when it is finished -- this is because the plugin does not know that the animation is finished. The difference now is that you can click the End Animation toolbar button (in the Maxwell Animation toolbar), and have the plugin ask you if you want to render the exported frames. It is actually mandatory that you remember to do this, since as you may guess, if the plugin believes it is in the middle of an animation when it is not, you should expect to find it behaving pretty strangely. Beyond that, optimization has also been done regarding the detection of the need to export motion blur, and regarding the detection of the need to invalidate cached meshes; these things should reduce the export time in some cases.
By kami
#367525
Hey Jeremy
I am using a rhinoscript you once posted for a sun-study animation with maxwell and have a question concerning this. (I cannot remember where you posted it, so I'm copying my latest version of it).
Code: Select all
Option Explicit 
Sub Maxwell_SunStudy() 
	Dim Maxwell
        Dim x
	x=0
	' create the ScriptObject 
	Set Maxwell = CreateObject("Maxwell.Script.ScriptObject") 
	' successfully created? 
	If Maxwell Is Nothing Then
		Rhino.Print("Unable to create Maxwell.Script.ScriptObject.") 
		Exit Sub 
	End If 
	' successfully connected? 
	If Not Maxwell.IsConnected Then
		Rhino.Print("Unable to connect to the current Maxwell scene.") 
		Exit Sub 
	End If 
	' enable sun and set physical sky active 
	Maxwell.Environment.SunEnabled = True
	Maxwell.Environment.EnvironmentType = "PhysicalSky"
	' no objects will move, so cache meshes 
	Maxwell.PluginOptions.CacheMXSMeshes = True
	' loop vars 
	Dim endTime, frameLength 
	' set start time 
	Maxwell.DateAndTime.TimeOfDay = 17
	' set end time 
	endTime = 20
	' set frame interval 
	frameLength = .2
	' activate the plugin's animation loop 
	' Maxwell.Rendering.BeginAnimation() 
	' loop 
	While Maxwell.DateAndTime.TimeOfDay < endTime 
		' Bongo Tick
		Rhino.Command "_BongoSetCurrentTick " & x, False
		x = x + 1
		Rhino.Print(x) 
		Call Rhino.Sleep(0)
		' increment 
		Maxwell.DateAndTime.TimeOfDay = Maxwell.DateAndTime.TimeOfDay + frameLength 
		' write frame to disk 
		Maxwell.Rendering.RenderToMxs() 
	Wend 
	' done 
	' Maxwell.Rendering.EndAnimation() 
End Sub 
Maxwell_SunStudy
I added a few lines to have bongo animated as well (some moving objects for a timelapse).
As far as I understood, having the frameLength to "1" gives you one hour per frame.
Now, I somehow noticed that when I reduce the frame length to a very small amount (like .01) it did not change the sun at all and got hung up in an endless loop.
0.02 did work and I got 180 frames for the 3 hour interval which would be 1 minute per frame.
But when I rendered those out, some frames were identical to each other (like every 6th frame or so). Is this due to some rounding issues? I did not understand how I would need to use the Maxwell.DateAndTime.TimeOfDay to have it exactly every minute (or would it even be possible to move in seconds?). Or are these Scripting Values documented somewhere?

Thanks for more insights there
By JDHill
#367532
Perhaps this will work better for you:
Code: Select all
_NoEcho

_-RunScript (

  Sub Maxwell_Bongo2SunStudy()

    Set mw = CreateObject("Maxwell.Script.ScriptObject")   

    ' scene options
    
    mw.Environment.SunEnabled       = True
    mw.Environment.EnvironmentType  = "PhysicalSky"
    mw.PluginOptions.CacheMXSMeshes = True  

    ' animation options
    
    startTime  = 9.5  ' start @ 09:30
    endTime    = 12.5 ' end   @ 12:30
    startFrame = 0    ' start @ frame 0
    frameCount = 180  ' 1 minute per frame
    
    ' optionally, get options using the command prompt
    
    promptForValues = false
    
    if promptForValues Then
    
      startTime = Rhino.GetReal("Enter Start Time", 9.5, 0.0)
      if IsNull(startTime) Then Exit Sub ' cancelled
      
      endTime = Rhino.GetReal("Enter End Time", 12.5, startTime)
      if IsNull(endTime) Then Exit Sub ' cancelled
      
      startFrame = Rhino.GetInteger("Enter Start Frame", 0, 0)
      if Isnull(startFrame) Then Exit Sub ' cancelled
      
      frameCount = Rhino.GetInteger("Enter Frame Count", 180, startFrame)
      if IsNull(frameCount) Then Exit Sub ' cancelled
      
    End If 
    
    ' internal variables

    timeSpan      = endTime - startTime
    increment     = timeSpan / frameCount
    currentTime   = startTime
    endFrame      = startFrame + frameCount - 1
    currentFrame  = startFrame
    frameDuration = increment * 60.0
    cmdPrefix     = "_ClearUndo _BongoSetCurrentTick "
    
    ' abort if frame length is less than 1 minute
    
    If frameDuration < 1.0 Then
      Rhino.Print("Too many frames: minimum time per frame is 1 minute.")
      Exit Sub
    End If
    
    ' optionally, ensure timeline range is sufficient
    
    setTimelineRange = true
    
    If setTimelineRange Then
    
      rangeCmd = "-_BongoSetTimelineDisplayRange"
      rangeCmd = rangeCmd & " Start=" & startFrame
      rangeCmd = rangeCmd & " Stop="  & endFrame + 1
      rangeCmd = rangeCmd & " _Enter"
      Rhino.Command rangeCmd, false
      
    End If
    
    ' export the animation
    
    Rhino.Print("Maxwell_Bongo2SunStudy info:")
    Rhino.Print(" - time span:   " & startTime & "-" & endTime)
    Rhino.Print(" - frame range: " & startFrame & "-" & endFrame)
    Rhino.Print(" - frame time:  " & frameDuration & " min.")
    Rhino.Print("Exporting animation...")
    
    mw.Rendering.BeginAnimation()
    
    While currentTime <= endTime
    
      Rhino.Command cmdPrefix & currentFrame, false
      mw.DateAndTime.TimeOfDay = currentTime
      mw.Rendering.RenderToMxs() 
      currentFrame = currentFrame + 1
      currentTime  = currentTime  + increment
      
    Wend
    
    mw.Rendering.EndAnimation()
    
    Rhino.Print("Animation export done.")
    
  End Sub

  Call Maxwell_Bongo2SunStudy()

)
The plugin's TimeOfDay value is in fractional hours (e.g. 9.5 = 9:30), but underneath, Maxwell's time resolution is in minutes, not seconds, so if you try to export more than 60 frames for a given hour, some frames will end up being the same. This script will fail with an error if you use it to set up such an animation.

This script also has a couple of options that you can set to true/false to determine how you want it to behave: the first just lets you decide whether you want it to get options from the command line, and the second makes sure that the timeline range is sufficient (Bongo will stop with an error if you try to animate beyond the end). To ensure that you can't get into an infinite loop, it uses a temporary currentTime variable, rather than reading the current TimeOfDay value (it is not guaranteed to get out what you put in, since there is error-checking involved). It also gets rid of the Option Explicit and various error checks, just to make things more readable.

So give that a try and let me know what you think.
By kami
#367533
wow. that looks great! thank you very much.
I'm starting to like what you can do with scripting! Hopefully I can look a bit more into it soon and when all the necessary work is done, I'll try to implement an animated obj sequence into a bongo animation :D
By kami
#367655
Jeremy,
Are the commands to change the Date and Time in Maxwell via RhinoScript documented somewhere?
For a timelapse over several days, I'd like to modify the script so it can change the date as well. What is the command for that? And what kind of input needs it (number?)?
Best, Christoph
By JDHill
#367669
One way to do that is to use DateAndTime.SimpleDate:
Code: Select all
  Dim month, day, date
	
  For month = 1 To 12		
    For day = 1 To 30
      date = month & "/" & day & "/2013"
      mw.DateAndTime.SimpleDate = date
      Rhino.Print(mw.DateAndTime.SimpleDate)			
    Next		
  Next
As you see, this takes a string in the "month/day/year" format. This, and the animation script above are using the plugin's Maxwell.Script.dll, which is described near the end of the plugin manual. For simpler cases, you can also always just use a macro, and the Maxwell_DateAndTimeSettings command, which exposes control over these things via command-line options.
By kami
#367774
Thank you very much. That did work with one modification though:
For the correct date I had to input it via DD/MM/YYYY, not the american formatting.
Is that because of my region settings or is it a mistake in your script?

Is there also the possibility to input the date just with one number? So you could skip the day/month calculation?
For example 1 would stand for january 1st and 365 for december 31st?
By JDHill
#367775
Yes, you're right, it is using the regional settings to interpret the date format. As to your other question, you can use this:
Code: Select all
  Dim day
  	
  For day = 1 To 365
    mw.DateAndTime.DayOfYear = day - 1
    Rhino.Print(mw.DateAndTime.SimpleDate)
  Next
The index is zero-based, hence the subtraction of a day when using your desired 1-365 range
By kami
#372017
Hi Jeremy

Do you know if it would be possible with maxwell to render more sun positions than one each minute (60 per hour)? My client thinks this is a bit too fast and trying to time stretch it with after effects looks a bit weird ...

Best
Kami

PS: The final version of our first animation is online now: https://vimeo.com/67486126 :)
By JDHill
#372047
Great video, very engaging. I especially liked the shot starting at around 1:20.
kami wrote:Do you know if it would be possible with maxwell to render more sun positions than one each minute (60 per hour)?
In theory, yes (the number given to the SDK is floating point, 0.0-24.0), but making a quick test, it doesn't appear to work that way.
By kami
#372064
Thanks for the nice comments. It is not very high end, but for a first shot I'm quite happy. The sound was done externally, which was a good decision :)

In Studio it is possible to put in seconds for the sun, but I did not test, if it makes any difference ...
User avatar
By polynurb
#372066
kami wrote: In Studio it is possible to put in seconds for the sun, but I did not test, if it makes any difference ...

maybe your sun problem is somwhat related to this.
Help with swimming pool water

Hi Andreas " I would say the above "fake[…]

render engines and Maxwell

Other rendering engines are evolving day by day, m[…]