Prerendered cut-scene

Hello! I have maybe a strange question, but can I add video in my scene in any way? Like prerended cut-scene…

Not right now, I’m afraid. We don’t have a support for “real” video playback in the engine. It is something you can implement on top, using existing engine API, though it will be some work.

What we have:

  • We have ways to play short videos (short because they will need to be loaded entirely to memory) by using special URLs like my_animation_@counter(1).png for MovieTexture X3D node or with engine classes like TGLVideo2D, TGLVideo3D.
  • Movie files (anything ffmpeg can handle) can also be loaded using ffmpeg command-line, by converting them to an image sequence under the hood.
  • See engine code in src/base_rendering/castleglimages_video.inc and example in examples/images_videos/simple_video_editor/

None of the above is suitable for “real” movies, because all the playback above is naively loading the entire “movie” (image sequence) into OpenGL textures. This is good for quick effects, like a short looping flame / smoke animation. This is not good for longer (and/or with larger resolution) movies, like for cutscenes.

For “real” movie playback, you will need

  • Likely integrate with some library capable of streaming video playback, like ffmpeg library.
  • Display the obtained image fast, either by transferring to OpenGL texture or relying on GPU special helpers for video rendering.

It is very possible we will implement this “natively” in the engine some day, but it’s not something done yet.

2 Likes