Linear camera interpolation and python scripting

Dear ParaView developers,

I’m working on automating some of my ParaView visualizations, i.e. visualize some data over time based on a .pvsm file. The relevant simulation volume grows over time so I placed a camera (“Interpolate camera locations”) with beginning and end positions such that the important part is always visible. I exported the animation, it looked good, and I was happy.

To automate the procedure, I recorded the trace and expected the same outcome. However, when running the trace via pvpython, the resulting animation looks different because the camera moves in unexpected ways.

After digging through the trace, I figured that the end point of the camera looked a bit strange. I was able to fix the issue by recording the trace again, this time setting the desired endpoint as the start point and then copying the start point data from the new trace into the previous trace.

I wonder if the trace records the endpoint wrongly. I’m not a very experienced user so the chances that I did something wrong are not negligible, but I think it would be good to verify that this works correctly.

Thanks for your help!
Best, Tobias


Example: Setting a different start and end point and exporting the trace yields

# create a key frame
keyFrame14151 = CameraKeyFrame()
keyFrame14151.KeyTime = 0.0
keyFrame14151.KeyValues = [0.0]
keyFrame14151.Position = [-2.9318084716796875, -1.7506294250488281, 611.5486935119864]
keyFrame14151.FocalPoint = [-2.9318084716796875, -1.7506294250488281, -7.746269226074219]
keyFrame14151.ViewUp = [0.0, 1.0, 0.0]
keyFrame14151.ViewAngle = 22.37732656514382
keyFrame14151.ParallelScale = 160.285330892666
keyFrame14151.PositionPathPoints = [-2.9318084716796875, 0.21203231811523438, 502.7635803222656, 291.69520169538924, 0.21203231811523438, 407.0334616767721, 473.7847079823986, 0.21203231811523438, 156.40875731581025, 473.7847079823985, 0.21203231811523438, -153.38041411512648, 291.6952016953892, 0.21203231811523438, -404.0051184760882, -2.931808471679574, 0.21203231811523438, -499.7352371215817, -297.5588186387483, 0.21203231811523438, -404.00511847608834, -479.6483249257576, 0.21203231811523438, -153.38041411512668, -479.64832492575766, 0.21203231811523438, 156.4087573158099, -297.55881863874845, 0.21203231811523438, 407.03346167677154]
keyFrame14151.FocalPathPoints = [-2.9318084716796875, 0.21203231811523438, 1.5141716003417969]
keyFrame14151.PositionMode = 'Path'
keyFrame14151.FocalPointMode = 'Path'
keyFrame14151.ClosedFocalPath = 0
keyFrame14151.ClosedPositionPath = 1

# create a key frame
keyFrame14152 = CameraKeyFrame()
keyFrame14152.KeyTime = 1.0
keyFrame14152.KeyValues = [0.0]
keyFrame14152.Position = [-2.9318084716796875, -1.7506294250488281, 611.5486935119864]
keyFrame14152.FocalPoint = [-2.9318084716796875, -1.7506294250488281, -7.746269226074219]
keyFrame14152.ViewUp = [0.0, 1.0, 0.0]
keyFrame14152.ViewAngle = 22.37732656514382
keyFrame14152.ParallelScale = 160.285330892666
keyFrame14152.PositionPathPoints = [5.0, 0.0, 0.0, 5.0, 5.0, 0.0, 5.0, 0.0, 0.0]
keyFrame14152.FocalPathPoints = [0.0, 0.0, 0.0, 1.0, 0.0, 0.0]
keyFrame14152.PositionMode = 'Path'
keyFrame14152.FocalPointMode = 'Path'
keyFrame14152.ClosedFocalPath = 0
keyFrame14152.ClosedPositionPath = 0

# initialize the animation track
cameraAnimationCue1.TimeMode = 'Normalized'
cameraAnimationCue1.StartTime = 0.0
cameraAnimationCue1.EndTime = 1.0
cameraAnimationCue1.Enabled = 1
cameraAnimationCue1.Mode = 'Interpolate Camera'
cameraAnimationCue1.Interpolation = 'Linear'
cameraAnimationCue1.KeyFrames = [keyFrame14151, keyFrame14152]
cameraAnimationCue1.DataSource = None

where in my case i expected the latter keyframe to looks somewhat like that

# create a key frame
keyFrame14203 = CameraKeyFrame()
keyFrame14203.KeyTime = 0.0
keyFrame14203.KeyValues = [0.0]
keyFrame14203.Position = [-19.8793, -1.75063, 2837.85]
keyFrame14203.FocalPoint = [-2.93181, -1.75063, -7.74627]
keyFrame14203.ViewUp = [0.0, 1.0, 0.0]
keyFrame14203.ViewAngle = 22.3773
keyFrame14203.ParallelScale = 160.285
keyFrame14203.PositionPathPoints = [-2.9318084716796875, 0.21203231811523438, 502.7635803222656, 291.69520169538924, 0.21203231811523438, 407.0334616767721, 473.7847079823986, 0.21203231811523438, 156.40875731581025, 473.7847079823985, 0.21203231811523438, -153.38041411512648, 291.6952016953892, 0.21203231811523438, -404.0051184760882, -2.931808471679574, 0.21203231811523438, -499.7352371215817, -297.5588186387483, 0.21203231811523438, -404.00511847608834, -479.6483249257576, 0.21203231811523438, -153.38041411512668, -479.64832492575766, 0.21203231811523438, 156.4087573158099, -297.55881863874845, 0.21203231811523438, 407.03346167677154]
keyFrame14203.FocalPathPoints = [-2.9318084716796875, 0.21203231811523438, 1.5141716003417969]
keyFrame14203.PositionMode = 'Path'
keyFrame14203.FocalPointMode = 'Path'
keyFrame14203.ClosedFocalPath = 0
keyFrame14203.ClosedPositionPath = 1

Hi @TobiasDuswald

That looks like a bug, could you isolate it with a simple usecase so it can be reproduced ?

Best,

HI @TobiasDuswald Yes what Mathieu said. I tried it on a simple data set of mine, but nothing happened. Please supply a simple use-case.

-Phil