By kami
#372257
Hi Jeremy

I got another weird thing.
The following code is a combination of some scripts you wrote. The first part exports a timelapse animation of 2 hours (120 minutes) in 120 frames. The next parts is a bongo time line animation with a camera movement.
I now rendered out the first part and it is not smooth. When checking frame by frame, sometimes the sun jumps further, sometimes there is no change inbetween the frames. I double checked the MXS files in studio, to rule out that the network render did mess up the resulting images. And inbetween some mxs is a difference of several minutes, sometimes no difference at all and sometimes it even jumps back in time.... Do you have an idea how that is even possible?

For example, the following frames show these times in studio when I open the mxs files:
68 - 17:02
69 - 17:03
70 - 17:06
71 - 17:07
72 - 17:03
73 - 17:04

It looks something like this:
https://vimeo.com/77335512
Code: Select all
Option Explicit

Dim mw, startTime, endTime, startFrame, frameCount, startMove, finalMove, timeSpan, increment, currentTime,endFrame, currentFrame, frameDuration, cmdPrefix
Dim promptForValues, setTimelineRange, RangeCmd

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 = 16.0  ' start 
	endTime = 18.0 ' end   
	startFrame = 0    ' start @ frame 0 for the sun-Animation
	frameCount = 120  ' 1 minute per frame
	startMove = 0
	finalMove = 250
  
	
	' 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
      
	' 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 "_ClearUndo"
		mw.DateAndTime.TimeOfDay = currentTime
		Rhino.Print("Exporting Time:  " & currentTime)

		mw.Rendering.RenderToMxs()
		currentFrame = currentFrame + 1
		currentTime = currentTime + increment
     
	Wend
   
	
	While startMove <= finalMove
   
		Rhino.Command cmdPrefix & startMove, False
		Rhino.Print("Exporting Bongo Frame: " & startMove)
		mw.Rendering.RenderToMxs()
		startMove = startMove + 1
	     
	Wend
	
	
	
	'	mw.Rendering.EndAnimation()
   
	Rhino.Print("Animation export done.")
   
End Sub

Call Maxwell_Bongo2SunStudy()
By JDHill
#372258
I can reproduce that, but can't really tell you what might be happening, since it is inside the engine. I'll try to make a simplified repro for the engine guys.
By JDHill
#372275
Using pymaxwell, you could manually post-process the files, directly setting the sun direction by vector, rather than going by date & time. And if the only thing moving is the sun, then you could just export a single mxs instead, and generate the rest from that one, using pymaxwell.
By kami
#372295
while thinking of it... do you have any idea why this happens? or is there an easy way to avoid it by calling the time differently?
does this also happen for still image renderings, that he changes the time for the rendering?
the weird thing is, that I rendered the timelapse sequence before and it did not have those errors ...
By JDHill
#372297
No, I don't currently know why, and therefore can't theorize about any potential workaround. Keep in mind that I can't necessarily come to any solid conclusion on something like this in a period of hours (if I even can at all).

However, your last comment suggests something important to consider: if you have rendered this sequence successfully in the past, and are not doing so now, it would seem that some factor has changed; in other words, what I am looking at, and what you are looking at, may not be perfectly equivalent (specifically, I note that I have yet to see time actually moving backward between frames, as you suggest -- I see some problem with a particular time being used twice in succession, where that is unexpected), and it may be that you have some variables on your end for which you need to account. I mean things like installing a different version of the plugin, Maxwell, Rhino, or Bongo, or rewriting or using a different script.
By kami
#372308
I re-exported the frames yesterday and rendered them overnight again. It looks smoother now, especially since it does not have any jumps back in time.
The fact that it is sometimes increasing time by 1 minute and sometimes 0 or 2 minutes could be some kind of rounding error? The script shows the time value is has exported and for the last frame that should be 18 it shows "17.9999999999999". Is there another way to export the time instead of a number? for example being able to control the output in hours and minutes like 18h 0m? not sure if that would change anything though ...
I think I was wrong about the fact that it did export right at one point, because I think those mini jumps of 1 minute have always been there. I just did not notice them so strongly because I never rendered it to a high SL and with the grain you don't see it so clearly.

Concerning the jumps in time, I think they are kind of a different nature.
I'm wondering if the network render might have caused them in the previous run... This does not make much sense either, but I remember that I had to restart the network render several times and restart some missing frames afterwards. It has happend before that the network render messed up jobs and frames before, for example when a new machine is turned on and is joining the process. For example for the last movie I did with a camera animation done with bongo, there were a few fames "off". Usually it was just one frame that was wrong. For example frame 71 would have the same camera position as frame 65 and frame 72, 73, 74ff would be correct again. If I would just rerender the MXS of frame 71 it would still turn out wrong, but if I reexported that frame and rendered it, it would be correct. I have now idea how the the network render could mess up mxs files, but it sometimes makes sense for of these cases, so let's forget them for now ...
By kami
#372331
I did try the python-script way, but it turns out to have exactly the same problems :(
For animating the sun using the vector, my mathematical background as well as my python experience are not enough...

For future refence, that is the python script I used.
Code: Select all
################################################################
# Edit physical sky. Create a sequence animating the sun.
################################################################

from pymaxwell import *

def edit_physical_sky():
	# Read the scene from disk
	mxspath = 'S:/TESTRENDER/12213 ANIMATION/python-test/sundown.mxs';
	start = 16.0;
	end = 18.0;
	scene = Cmaxwell(mwcallback);
	ok = scene.readMXS(mxspath);

	
	if ok == 0:
		print("Error reading scene from file");
		return 0;
	
	# Get sky type. We need physical sky.
	skytype = scene.getActiveSky();
	if skytype == 'PHYSICAL':
		
		# Get sun position
		longitude,latitude,sm,dayofyear,timeofday = scene.getSunLongitudeAndLatitude();
		
		# Animate the sun. 24 frames, one per hour.
		timecounter = float(960);

		for time in range(start*60,end*60,1):
			hour = float(timecounter / 60);
			timecounter = timecounter + 1;
			print(hour);
			# Set new sun position (hour)
			scene.setSunLongitudeAndLatitude(longitude,latitude,sm,dayofyear,hour);
			
			# Set frame file name and write it to disk
			framename = mxspath+'{0:0>4d}'.format(time)+'.mxs';
			ok = scene.writeMXS(framename);
			if ok == 0:
				print("Error saving frame " + framename);
				return 0;
			else:
				print("Frame " + framename + " saved successfully");


edit_physical_sky();
By JDHill
#372336
kami wrote:For animating the sun using the vector, my mathematical background as well as my python experience are not enough...
Not sure if it might help, but this could be of interest: Pysolar.
By kami
#372349
Thanks. If I really want to go deep into that subject, that might be very helpful! But for the moment I don't have time since the deadline is approaching...
I tried manually changing the mxs but found out, that even if I put in 16:01 by hand in studio, it'll change back to 16:00 the next time I open it, so the problem is worse than I was hoping for. So I have no other possibility than to use the non-smooth animation this time.
By kami
#378861
So I started some new tries with Bongo2 and Maxwell v3. Not sure if Bongo is officially supported now, but why not test it anyway.
I wanted to try two things: motion blur and camera motion blur.

For camera motion blur, I just enabled motion blur on the camera and set the shutter to 1/60 second. That seemed to have worked fine, except that the first frame had a weird motion blur in it. I think this was because I had a different camera position selected (and rendered) before starting the animation.

I exported the animation via the bongo interface which worked fine. The only issue with that was, that I would have to select 'cancel animation' after the export of the animation, so that I was able to do any test renders with that scene afterwards.

For the object motion blur I animated an object and activated 'linear motion blur' in its properties, which did the trick.

Nice to have all of that working :)
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[…]