Render a composition at a specific time (SDK)

Hi,

looking for a method similar to a QCRenderers renderAtTime:withArguments method to request/render a frame at a specific, but did not find anything in the SDK documentation about this. Is this possible or do you have any plans for doing this?

Thanks,
Tamas

So, as I found, if you start a VuoRunner, then it start to rendering in the background, and if I need a frame, I need ask for a VuoImage from a publish output port. So, after I start a VuoRunner, I won’t know, where is it heading actually, right?

When you call VuoRunner::start(), the composition becomes ready to process events. If the composition has internal event sources, these event sources start firing.

But compositions that would be used as image filters or image generators for 3rd-party applications typically will not have internal event sources; they will only execute when they receive an event from a published input port.

So, your app should set data on the relevant ports using VuoRunner::setPublishedInputPortValue(). Then, once the data is set, it should fire an event using VuoRunner::firePublishedInputPortEvent(), to set the frame in motion.

You can then either implement VuoRunnerDelegate to asynchronously wait for the event to come out the other side, or you can synchronously call VuoRunner:waitForAnyPublishedOutputPortEvent().

Once the event has arrived, you can query its value using VuoRunner::getPublishedOutputPortValue().


Vuo does not have an implicit notion of a single composition-wide time (like there is in QC).

In the more distant future (Vuo 0.8, early 2015) we’re planning to implement Protocols, which provide a well-defined set of inputs and outputs for compositions. So your app would want to call an API that gives a list of all the compositions implementing a specific protocol (e.g., the Image Filter protocol), then you can be sure that the composition will (for example) take an image and time as input, and provide an image as output.

In the meantime, I recommend using an informal protocol: expect an image filter composition to have the following ports:

  • Input ports:
    • image
    • time
  • Output ports:
    • outputImage

Any additional input ports would be user-controllable parameters.

Thanks Steve for the great explanation, now I understand that Vuo uses strictly event based rendering.

But what remains a little non-clear, what are the event sources inside the composition. There are a couple of situation where you don’t have a published input, for example, I just want to render a Vuo composition which only rotates a cube for example with an LFO or something like that, so when the LFO changing its value inside the composition, that is an event in this context?

An other interesting scenario could be when you want to render a Vuo composition offline to build a movie from it, which requires to know to which frame to render, in my opinion.

@lov: Good questions. Sorry I’ve been slow to get back to you.

when the LFO changing its value inside the composition, that is an event in this context?

In Vuo, the equivalent of Quartz Composer’s LFO would be to feed a time source (either from the Render Scene to Window node’s requestedFrame port, or as a published time input port) to the Wave node.

So if the user is building a standalone composition, the event comes from the Render Scene to Window node inside the composition; if the user is building an image generator composition for use in a VJ host app, the host app calls VuoRunner::firePublishedInputPortEvent() each frame, and the event comes in to the composition via the published time input port.

render a Vuo composition offline to build a movie from it, which requires to know to which frame to render

In order to ensure consistent rendering at various framerates, to render a frame the composition would either need to know the desired render time, or it would need to know the framenumber and the framerate. In Vuo, we’re using the first option — the same way Quartz Composer and Kineme QuartzCrystal work. The difference is that in Quartz Composer time is built into the framework, whereas in Vuo it’s a published input port.

(If the composition needs a framenumber for some reason, it could increment the Count node every time the published time input port receives an event. Are you thinking of a use case where the composition would need to know the exact framenumber and just knowing the desired render time wouldn’t be sufficient?)