[RELEASED] Timeflow Animation System for Unity

Hey, just found Timeflow and it looks amazing! Is it possible to render stereoscopic 360 PNG image sequences with transparency in HDRP/URP? Unity Recorder still doesn’t support this in SRPs, and every other asset I’ve tried has issues.

Unity Recorder has an “Include Alpha” checkbox for this when PNG is selected, but stereo only works in built-in pipeline.

Thanks!

1 Like

Fascinating stuff!
Wonder, can the Timeline editor be shown and used ingame too by any chance?

1 Like

Yes! With the right settings it is possible to render VR360 stereoscopic with alpha channel, in both URP and HDRP.

Here are some example renders:
https://axongenesis.com/images/forum/Timeflow_URP_V360_Stereo_Alpha.png
https://axongenesis.com/images/forum/Timeflow_HDRP_V360_Stereo_Alpha.png

One caveat is that you cannot use post processing with this setup.

For both URP and HDRP, double check that the render textures are set to R8G8B8A8_UNORM.

To configure the render scene, both left and right cameras need to be set with Background Type as Solid Color (or “Color” in HDRP), black with 0 alpha.

1 Like

Great question! The answer is no, unfortunately. The editor UI and functionality is highly dependent on the Unity editor.

While there is a fair amount of functionality at runtime to control playback and manage objects, most editing features are editor-only and excluded from builds to optimize runtime for playback.

1 Like

Thanks for getting back to me, sounds great! I’ve been struggling for years to get 360 stereoscopic out of HDRP for compositing purposes.

Yep I imagined post processing wouldn’t work with this setup. I assume you would use a default HDRP sky, and a volume with overrides for fixed exposure, and turning off bloom, vignette, chromatic aberration etc? This is how I set it up with the VR Panorama 360 asset, but the cubemap seams are still very noticeable.

1 Like

The best solution I’ve found so far, and the current setup used in the examples, is to apply post processing as a second render pass. It all happens during the same render frame and is about as fast as normal, but does require more memory. The first pass renders the stereoscopic image to an equirectangular render texture (without any post processing) and then a separate camera with post processing renders an image plane mapped with the render texture. Layers are used to separate each camera pass.

This setup also requires a render texture with the format R32G32B32A32_SFLOAT to preserve HDR so that bloom and other post processing filters work. Of course, any post processing filters that require depth won’t work.

I’ve found that I can get perfectly seamless renders by disabling post processing for the cubemap camera and avoiding the use of any shaders or 3rd party tools which don’t work with cubemap and/or stereo rendering. I test these things early on as I’m building a scene to make sure there are no issues.

1 Like

Thanks for helping me out so quickly on that Webgl issue Axon! I’ve been using Timeflow for a bit now and it’s very useful for being able to create detailed animations in such a shorter amount of time than I’m used to in Unity!

However I had a question about cutscenes. We have a game that is dependent on many small cutscenes within a single Unity Scene (about 60 in total with about 10 per scene). We’d like to use Timeflow for many of these. How would you recommend setting up a Scene hierarchy to handle this?

9224571--1288140--upload_2023-8-15_10-25-51.png

This is the hierarchy one of our scenes follows, with each cutscene and their assets/content being under the main “Cutscenes” gameobject. We’re more than willing to structure our hierarchy to make this work, we’re just curious to know what we would need to do to work with multiple cutscenes.

1 Like

Glad to help!

Great question! There are special considerations when working with multiple cutscenes in the same scene.

The scene hierarchy doesn’t matter so much if you are only using one Timeflow. However, it is generally recommended to place Timeflow on a parent group above all animated objects. This is because each TimeflowObject (per GameObject) can only belong to a single Timeflow instance, which it determines by looking up the hierarchy, or defaulting to the first active Timeflow if none is found in the hierarchy above it.

If there are objects animated with Timeflow which always remain animated regardless of cutscenes, then these could be in a separate instance.

For cutscenes, I recommend using one Timeflow and separating each cutscene in time using markers. Each marker region would need to be set up with adequate time and probably some extra padding to provide flexibility for later adjustment. So you would end up with a sequence of cutscenes ordered one after the other with some extra time padding between them. The markers then would be a list of all of the cutscenes. To play each one you would simply jump to and play the related marker region.

Essentially, when Timeflow is playing it takes over the game objects for cutscene playback, and when stopped it relinquishes control back to gameplay. Only the properties animated are affected. In some cases, smooth transitions can be animated into and out of each cutscene, for example to smoothly move objects or the camera to a specific position.

During cutscenes it may also be a good idea to disable the relevant user input to avoid conflicts. Most games I have played do this and give the player the ability to skip the cutscene by pressing a button.

This workflow is something I intend to improve. In my past projects I used a state machine to control Timeflow based on the game state. I often used one Timeflow continually playing for environment animations and background music, and another Timeflow for animating scene objects with transitions in and out of gameplay.

That code is not production ready and needs to be rebuilt, however I would like to help you further by providing a simplified solution to use in the interim. I will follow up here shortly with a script and example which you can use with Unity events or via scripting to easily integrate with your own setup.

If you have any other questions or want me to clarify anything, let me know!

1 Like

Hi @acMacav

As promised, here is a controller script and example scene. This depends on the Timeflow example assets using URP and includes some scripts for basic gameplay. This will all be included in the next update and I may refine it some more, but in the meantime please import this package (for use with Timeflow 1.1.0).
https://www.dropbox.com/scl/fi/san9s8yg9e5xnevsm6tke/TimeflowController_v1.1.0.unitypackage?rlkey=fvdc6fqww3jo17b1orgiz8a3b&dl=0

I plan to make a video walking through this example and will share it when ready. Until then, hopefully you are able to look through the scene and understand what is going on so you can get things going in your project.

To test it, open the Cutscenes scene and enter play mode. Use the WASD keys to move the player (blue capsule) to any of the the 3 colored pads. As soon as the player touches one, it triggers the corresponding cutscene animation. Additional logic is also performed by Unity Events configured in the editor.

All of the cutscenes are animated with the same instance of Timeflow, separated by marker regions. Each region is defined by a start and end marker, with extra time padding between them. The padding is a bit overkill in this example, but I thought it would be useful as a starting point.

With this setup it is easy to preview and edit animations in edit mode. Double-clicking on a marker sets the work area and frames the region in time. You can also use the arrow icons in the upper right to step through markers.

The TimeflowController script provides a useful interface to manage the playback of Timeflow and uses Unity Events to setup custom logic without additional coding, though it can certainly be used via script too. In the screenshot below, you can see that the SkipButton UI element is shown or hidden based on whether a cutscene is playing. Pressing the Skip button causes the time to fast forward to the end of the cutscene with an optional outro time (Skip Duration).


You’ll also notice that the events in the above screenshot also enable/disable the player input controller, so that the player cannot move while the cutscene is playing.

Each of the pads has a trigger collider and a simple TriggerEvent script which uses Unity Events to notify the TimeflowController. The OneShot mode is best suited for a cutscene and means that the marker region plays just once through and when it reaches the end playback stops automatically.

For the Player object, I setup a Follow behavior which is animated in each cutscene to reposition the player at the designated positions with a transition controlled by Follow.OverallBlend in a keyframe channel. When the blend value is at 0 the Follow behavior has no effect, and at a value of 1 it is fully on target. Animating the blend value form 0 to 1 transitions the player from wherever it is in the scene to the desired location.

There are of course many things that could be improved, but hopefully this gives you a decent starting point. I’d love any feedback and any ideas to make it easier and/or more robust. I plan on creating a more sophisticated cutscene manager in the future.

Let me know if you have any questions or run into problems.

P.S. You may have to go to Preferences>Timeflow to enable Expose All Properties as I noticed that the Follow behavior was not being listed in the context menu when adding a new animation channel (making its parameters inaccessible). This will be fixed in the next update.

Best,
Axon

1 Like

Following up on this great question from @acMacav on creating cutscenes, I’ve published a new tutorial video. Please make sure you update to the latest version of Timeflow 1.2.1, now available!

For a complete list of all the updates, please see the release notes here:

Get Timeflow in the Unity Asset Store: Timeflow Animation System | Animation Tools | Unity Asset Store

1 Like

Timeflow v1.3.0 is now available!

Release Notes:
UPDATE NOTICE: Please remove the previous version of Timeflow before installing this update to ensure a clean install, as file names and structures may have changed.

Examples by default use the built-in render pipeline. Additional packages are included for URP and HDRP.

New Features

  • Render To Disk:

  • Fully revamped!

  • Optimized render speed with much faster render times!

  • Use RenderToDisk to render any scene even when not using Timeflow.

  • Video encoding is now supported!

  • Encodings automatically run in the background using ffmpeg.

  • Fully customizable settings for any encoding type using scriptable objects.

  • Queue any number of renders and encodings to be processed in order.

  • Stereoscopic rendering is now supported for all render modes.

  • Implemented post processing for VR180 and fulldome stereoscopic modes with examples included.

  • Revamped all examples in Timeflow/Examples/Scenes/Rendering.

  • All render setups now have camera rig prefabs that can easily be added to any scene.

  • Rendering now automatically sets the game view to the correct size and scale.

  • Added drop down menu with common render sizes for quick setup.

  • Replaced TextMeshPro overlay options with property mappings for use with any display type.

  • Directory paths can now be defined using the wildcards $PROJECT or $ASSETS to create paths relative to the current Unity project, or $CUSTOM to define your own path in the Timeflow Preferences.

  • Realtime fulldome and fisheye camera rigs are now included as prefabs

  • Optimized Behaviors: Added updating option to only update when Timeflow is playing (instead of always updating).

Fixes

  • RenderToDisk:

  • Fulldome Shader: Fixed alpha values rendered in soft edge mask.

  • Improved fulldome rendering by reducing texture memory allocation.

  • Improved render quality with reduced banding by setting all render textures to float space.

  • Fixed Cubemap Faces mask dropdown menu to select which directions are rendered.

  • Improved inspector GUI layout and information display.

  • Automatically sets Game View scale to avoid scaling issues with renders.

  • Fixed render Pause button.

  • Fixed estimated completion time displayed in console log.

  • Timeflow View:

  • Fixed null reference errors in Timeflow view when the only active instance is deactivated.

  • Fixed issue with keyframes set to linear not being draggable in the graph view.

  • Fixed channel loop state not being saved when set on prefab objects.

  • Fixed bug with TimeflowObject component being added to prefabs when opened to edit.

  • Visual Effect Graph: Fixed missing int and bool property mappings.

  • Fixed initialization issue with objects outside of Timeflow hierarchy not updating in editor upon scene opening.

  • Renamed AxonGenesis assembly definition to Timeflow and moved it in the Timeflow folder.

1 Like

Timeflow v1.3.1 is now available!

Release Notes:
New Features

  • Render To Disk:

  • Added EXR and TGA image formats for render output.

  • Added HDR option to use floating point render textures for output (supported by EXR).

  • Added Stop and Stop All buttons when encoding videos to kill current or all processes. This will abort the encoding in progress.

Fixes

  • Render To Disk:

  • Removed the Dome Resolution option since the render textures and output size determine the final resolution (use any supported by your graphics card)

  • Fixed Cubemap Faces drop down - was only showing for stereoscopic setups

  • Fixed Metadata field - was not allowing direct input when Auto checkbox is off.

1 Like

1.4.0 Released!

New Features

  • Timeflow Context Menu:

  • Added options to set keyframe tangents Linear Left and Linear Right.

  • RenderToDisk:

  • Time ranges can now be set with multiple options including markers, seconds, and more.

  • Increased fulldome tilt range from 0 to 360 degrees.

  • Game view size is only set if the component is enabled and active in the hierarchy.

  • Added filename prefix and option to use scene name.

  • Added Edit Mode Resolution to reduce the resolution of the game view when not rendering.

  • Added ability to chain RenderToDisk instances to render multiple setups in the same scene, by assigning the Render Next field.

Fixes

  • Render To Disk:

  • Fixed memory leak when using Screen Capture mode - image buffer was not being disposed of properly resulting in eventual crash.

  • Fixed bug with starting frame numbers being offset by 1.

  • TimeValue:

  • Changed name of timing mode ‘Never’ to ‘End’ (used for repeating operations such as Tween).

  • Added ‘Frames’ mode to enter specific frame numbers.

  • Fixed modes ‘Object Start’ and ‘Object End’ to save TimeflowObject reference.

  • Delete Time Global:

  • Fixed bug with marker times being adjusted incorrectly.

  • Channel Links:

  • Links now re-enable when selecting a link mode other than ‘Off’.

1.4.1 Released!

New Features

  • RenderToDisk:

  • Added ‘Perfect Loop’ option which skips rendering the last frame for perfect loop animations to prevent rendering duplicate frames (when the first frame matches the last frame).

  • Added button ‘Abort After Current Render’ to stop rendering after the current range finishes. This also stops the RenderQueue from continuing. Use this to interrupt a render while allowing the current range to finish.

Fixes

  • Fixed potential stack overflow when re-initializing Timeflow in edit mode.

  • Fixed a memory leak with internal object lists.

  • Fixed issue with irregular update potentially causing jitter in edit mode playback.

  • Fixed crash that occurs entering play mode on a demo app scene. A warning is displayed in the console if the demo app scenes have not been configured properly.

  • Render To Disk:

  • Fixed bug with disabled render range still rendering if it is first in the range.

  • Fixed repeated ‘Render Queue Finished’ log entries when waiting for video encodings at end of render.

  • Animation Clips:

  • Channel value is now properly displayed in the values column.

  • Motion Path:

  • Fixed Velocity channel calculation and output value.

2 Likes

1.4.3 Released!

New Features

  • Command key (instead of Control) can now be used on macOS for Timeflow window shortcuts.
  • Added preference ‘Scroll Time Without Alt Key’ to allow scrolling the time view without the scroll wheel alone.
  • Added MidiCloner, and experimental feature for cloning prefabs based on MIDI channel data.

1.4.4 Released!

Fixes

  • Fixed a bug causing the info panel and display list to disappear when clicking the foldout icon.

New Features

  • Added an example scene ‘AudioToKeyframes’ showing how to convert audio amplitude to keyframes using Audio Sample and channel link.

Love the audio cables between properties.

How would you trigger events to be beat of a non midi audio track? Something like beat saber where spawning the object must happen N seconds before the beat so it reaches you on-beat?

Glad to hear you like the property linking features!

Timeflow has the ability to drive animation from audio amplitude and frequency, however it happens in the moment and cannot anticipate the incoming audio ahead of time without some additional setup.

To create an effect like Beat Saber, where each object is spawned in the distance and travels to meet the player in sync to the music, each object would have to be instantiated from a prefab with its velocity based on the distance and time it needs to travel, which would require some scripting.

Assuming you’re working with an audio file (not mic input) you could create a copy of the audio track and shift it earlier in time. You can then use Audio Sample to generate amplitude data from the audio and then observe the amplitude values in a custom script to generate discreet events. Basically, when the amplitude reaches a certain threshold, it fires off an object (via instantiation, or object pool would be better). Your script would also need to set limits on how many objects fire at a time.

However, you’ll likely find that audio is messy to deal with and not very accurate. It will be challenging to find sampling settings that fire objects with the exact timing and frequency desired. Using midi or pre-choreographing the objects to the audio would be more accurate and reliable.

In case you want to know more, see the pages on Audio Sample and Audio Reactive.
https://axongenesis.gitbook.io/timeflow/reference/behaviors/audio/audio-sample

I hope that helps!

I see in your video the foldout animation and it hurts my eyes. If you’re like me and like instant, here’s the script that turns off animation.

Can it generate ticks to the beat? Something that i can snap values to, on a spawn track.

9763030–1398406–DisableTreeviewFoldoutAnimationTransitionEditor.cs (622 Bytes)

Thanks for the tip!

Yes! Timeflow has musical timing as a built-in option with snapping capability. It allows you to specify a time signature for the grid display and snapping. It makes it easy to snap keyframes and tracks in time to music. Here’s more info:
https://axongenesis.gitbook.io/timeflow/user-guide/timeflow-view/toolbar/musical-timing#bpm

The Tween behavior also has BPM settings to create pulsing, oscillating, and repeating motions in time to music:
https://axongenesis.gitbook.io/timeflow/reference/behaviors/animation/tween