Jump to content

Grab sequence of screenshots from code


photo

Recommended Posts

Hi,
I'm trying to implement function that will basicaly do the same thing as Video Grabber in editor - I'm trying to grab screenshots frame-by-frame and join them to make video. I don't want it to work in realtime.

What I have now: every 1/30 of second I'm reading camera transformation and recording this information to my "record list". Since I've got on scene some dynamic objects I'm trying to store somehow their animation state during that "recording session" - I'm using getTime for ObjectMeshSkinned and WorldTransformPath and putting this in my "record list" too.
Then I'm trying to iterate through this record list every 1/30 of second, grab a screenshot and put that screenshot in video.
Hovewer I'm having trouble with synchronization of dynamic objects. Camera transformations and WorldTransformPath (with setTime) seems working fine, but ObjectMeshSkinned have it's animation playing wrong (like out of sync, skipping some frames or playing very fast). There are some more problems - I have ObjectGrass and ObjectWaterMesh - this doesn't even have getTime/setTime methods and all of them looks like totally out of  sync with the rest of animated objects.

All of this brings me to conclusion that I'm going to some strange and wrong directions trying to make this working.
In Game class I see methods like setFrame/getFrame/setFTime/getFTime/setIFps/getIFps - I think some part of this might be vital to make this, but I can't put this together.

Any advice how can I make this working properly?

Edited by arzezniczak
Link to comment

Why don't you try just setting

Game::get()->setIFps(1.0f / 30.0f);


and take the necessary frames using the Render class

Render::get()->renderImage2D(<camera with which it is necessary to capture>, result_image, ...);

in the update() method without stopping the logic?
Then make video from all images received as result_image.
 

Link to comment

Hi,

do you mean I should call this renderImage2D every frame in realtime? I will test this out, but as I wrote in my post - I don't want it to work in realtime becuase it will drop the framerate.

I want to create smooth video even if user struggles to maintain stable FPS, that's why I want to record camera and objects animation states and then "rewind" and "play" them during recording - frame-by-frame. And with this last part - "rewind and play" I have problems where animated objects are not in the same place and time where were during recording.

Link to comment
×
×
  • Create New...