⌚
Timeflow
  • ⌚Introduction
  • 📗User Guide
    • â–ļī¸Getting Started
      • ✅Requirements
      • âŦ‡ī¸Installation
      • 🚀Quick Start
      • âœī¸Workflow
      • đŸŽŦRender Pipeline
      • â¯ī¸Editor vs Runtime
      • đŸĻŋHow it Works
      • â›‘ī¸Potential Issues
      • ⚡Optimization
      • 🔨3rd Party Tools
      • đŸ”ĸUpgrading Guide
    • â„šī¸Timeflow Editor
      • đŸŽ›ī¸Menu Bar
      • â˛ī¸Time
      • Local Time Scope
      • 🧰Work Area
      • âš™ī¸Settings
      • âŗUpdate Settings
      • đŸ“ēDisplay Lists
      • đŸ”ģMarkers
      • đŸ”ĩObject
      • 🏭Managed Objects
      • ⚡Quick Select Objects
      • âš’ī¸Tools
    • đŸŽŦTimeflow View
      • 🔩Toolbar
        • 🔑Auto Keyframing
        • â¯ī¸Play Controls
        • đŸĨ…Work Area
        • â¯ī¸Current Time
        • đŸŽŧMusical Timing
        • 🌐Grid and Snap
        • 🔸Keyframe Values
        • đŸ”ģMarkers
      • â˛ī¸Timeline
      • 📐Time Navigation
      • Local Time Scope
      • 🎏Track View
      • â†˜ī¸Selection
      • 📰Object Panel
      • đŸ“ēDisplay Lists
      • 🍱Channels
      • đŸŖProperties
      • 🔗Channel Link
      • đŸšĨSwitches
      • 📅Values Column
      • đŸ›¤ī¸Tracks
      • 🔸Keyframes
      • đŸ“ļAlignment Tools
      • ⌛Time Offset
      • đŸ”ĸInfo Panel
      • 📉Graph View
      • âœ‚ī¸Keyframe Tools
    • 🍰Menus & Shortcuts
      • 📃Context Menus
        • â†–ī¸Select Menu
        • 📰Object Menu
        • 🍱Channel Menu
        • đŸ›¤ī¸Tracks Menu
        • 🔸Keyframes Menu
        • đŸ”ģMarkers Menu
        • 📰View Menu
        • 📰Events Menu
        • đŸĨ…Work Area Menu
      • đŸ—ƒī¸File Menu
      • âš’ī¸Timeflow Menu
        • đŸ•ēAdd Behavior
        • đŸ”ļAnimation
        • 🍱Composition
        • đŸ“ēDisplay
        • ⏊Jump To
        • 👨‍đŸ‘Ļ‍đŸ‘ĻHierarchy
        • 🌐Mesh
        • 👉Select
        • 📚Tracks
        • 🌈Track Colors
        • â†”ī¸Transform
        • đŸ‘ī¸Visibility
        • đŸ› ī¸Editor
      • đŸ”ĩGame Objects Menu
      • đŸŽ›ī¸Presets
      • âš™ī¸Preferences
        • Assets
        • ⌛Time
        • đŸŗī¸â€đŸŒˆTracks
        • âšĒObjects
        • 🧮Channels
        • đŸ”ļKeyframes
        • 🔠Input
        • đŸ“ĨImport
        • đŸ–ŧī¸Rendering
        • đŸŽ›ī¸Overrides
        • 🍱Extras
      • *ī¸âƒŖKeyboard Shortcuts
        • Managing Shortcuts
      • âœ´ī¸Quick Menu
  • Reference
    • đŸ”ĩTimeflow Object
      • đŸĸTracks
      • 🏭Behaviors
      • ⏰Events
      • đŸ—ƒī¸Channels
    • 💃Timeflow Controller
      • đŸŽžī¸Timeflow Playback
    • đŸĒ„Behaviors
      • đŸŽžī¸Animation
        • 🔸Keyframer
        • â†”ī¸Tween
        • 🔀Blend
        • đŸŽĸMotion Path
        • đŸ‘¯Animation Clips
        • 🌴Animator Blend Trees
        • 😁Blend Shapes
      • 🤖Automation
        • 🛸Auto Bank
        • 🧭Auto Rotate
        • 📐Distance
        • ⏰Event
        • đŸ›Šī¸Flyby
        • 🏃Follow
        • 👀Look At
        • đŸŽ¯Look At Target
        • 🎲Noise
        • 🚊Place On Path
        • đŸī¸Place On Surface
      • 🔊Audio
        • 🔊Audio Track
        • đŸŽŧAudio Spectrum
        • đŸŽĩAudio Sample
        • đŸŽ™ī¸Audio Reactive
      • 🎹MIDI
        • 🎹Midi File
        • đŸĨMidi Tween
        • 📡Midi Receiver
          • đŸŽ›ī¸Minis Setup (New Input System)
          • đŸšĨMidiJack Setup (Legacy Input)
      • 🏁Rendering
        • đŸŽžī¸Render To Disk
        • 📋Render Queue
        • đŸ“Ŋī¸Video Encoding
        • 💡Tips & Optimizations
        • âēī¸Unity Recorder
      • 🔧Tools
        • â„šī¸Animator Info
        • 🧮Align Children
        • đŸ’ŦComment
        • #ī¸âƒŖFPS Counter
        • 📈Graph
        • 🔗Property Link
        • 🔄Rotator
        • ✨Particle System Update
        • 🌈Trail Renderer Update
        • đŸ“ēVideo Player Update
    • đŸ—ƒī¸Precomposing
    • 🏭Prefabs
    • đŸŽ›ī¸Editor Overrides
      • 🏹Transform Editor Override
    • 🔌Integrations
      • đŸ§™â€â™‚ī¸Adventure Creator
      • đŸŽ›ī¸MIDI Jack | Minis
      • đŸ¤ēSpine Animation
      • đŸ“Ŋī¸Unity Timeline
      • ➰Unity Splines
    • đŸĒSamples
      • đŸ•šī¸Demo App
      • đŸŽžī¸Cutscenes
      • 🏓Physics
      • 🍧Shader Properties
      • ⚡Visual Effect Graph (VFX)
    • 📖Glossary
    • 📗Scripting
    • đŸ“ŖPublished Works
    • âš ī¸Known Issues
    • 🆘Support
    • đŸ§ĒBeta
    • Roadmap
    • đŸ”ĸVersion History
    • ÂŠī¸Terms & Privacy
Powered by GitBook
On this page
  • Material Animation
  • Material Instancing
  • Linking Materials Using Channel Link
  • Global Shader Properties
  • Mapping Channel Values to Global Shader Properties
  1. Reference
  2. Samples

Shader Properties

Methods for animating material shader properties

PreviousPhysicsNextVisual Effect Graph (VFX)

Last updated 2 years ago

There are two primary methods for animating material shader properties using Timeflow: direct material animation, and global shader properties. Each has its usage and caveats as explained in more detail below.

Please see the example scene included:

Assets/AxonGenesis/Timeflow/Examples/Scenes/Animation/ShaderProperties.unity

Material Animation

The most direct way of animating materials on an object is to target the material property using any Timeflow behavior, such as or . Right click on an object in the Timeflow view to select a material property. The context menu shows a full list of available properties for each material on the object.

Material Instancing

When using this method of animating materials, it is important to understand how Unity performs material instancing since that directly affects behavior at runtime which differs from working in edit mode.

In edit mode, all materials are referenced through a shared material reference directly relating to the material asset. However, at runtime each object is assigned an instance of the original material which no longer shares a connection with the original.

When material properties are animated, they only affect the object they are applied to. In edit mode, objects with the same shared material may appear to have the same animation, however upon entering runtime only the single object material is affected. This may appear to be a bug to anyone unaccustomed to the behavior of materials in Unity.

To work around this issue, one solution is to replicate the material animation on each object. This is fine if there are not many objects, however it is not the most efficient way.

Beware of Cross-Scene Material References

Whenever you have the same material used in multiple places throughout a project, animating the material could cause issues if in one context material values are set and in another they are not.

For example, animating the color of a material in one scene (while working in the editor) will change the color of the material used in any other scenes. If changes are only made at runtime, this isn't a problem, however since Timeflow works mostly in edit mode it could cause confusion when working with shared materials.

The solution to this dilemma is to be intentional about the use of materials, especially when animated. It helps to have a clear method of organization and may be advisable to duplicate materials where they need to be animated differently.

Linking Materials Using Channel Link

At runtime, each object instantiates a material instance and these mappings then propagate the animation. This process may be repeated on as many objects as needed, as well as mapping from one property to an entirely different one.

Global Shader Properties

A more efficient way to animate material properties across multiple objects with little to no additional overhead or management of links and channels is to use global shader properties. These are properties defined in shaders with the global keyword and not exposed in the material inspector.

There is also an option for Set Shader Frame which as the name indicates sends the frame number, instead of time in seconds.

There are many potential uses for this in Shader Graph and generally _TimeflowTime can be used instead of the built-in Time node to drive shader behaviors. Below is an example showing how it can be used to control the speed of a texture offset.

Mapping Channel Values to Global Shader Properties

Besides the above method of setting time and frame numbers, most channels in Timeflow also have the option for setting a global shader value, which can be exposed in the channel settings on the Timeflow Object or parent behavior.

In the above example, the _Beat01 variable was added to shader graphs with the intention of it being used to drive audio-reactive behaviors. Of course, global shader properties can be named anything you like, so long as it is unique and won't get confused with other shader properties.

The best part of using global shader properties is that you can drive material animation on unlimited numbers of objects across different materials without adding any additional channels or behaviors to the scene.

Additional properties may be created to add user control to determine animation behavior on a per material basis, simply by setting the values as desired in the material inspector. Below is an example of how _Beat01 is controlled by BeatInfluence and BeatIntensity.

These shaders are included in the Timeflow package for further inspection and can be modified, or using this knowledge you may create your own global shader behaviors for unlimited possibilities and special effects.

Another approach using Timeflow is to use to connect the original animated properties to other objects. Each linked object can have the same or a different material, so long as the property names match.

The main advantage to this approach is that the global property only needs to be set once per frame and affects all objects which use the shader. In the example shown above, "_TimeflowTime" is the default name set in Timeflow by enabling Set Shader Time in the .

đŸĒ
🍧
Channel Link
Keyframer
Tween
Settings
Material properties are listed alphabetically and organized into sub menus to reduce clutter.
To quickly link properties across objects, drag and drop the object onto the channel link well of the source object.
Matching channel names are added, mapping to the corresponding property on the current object's material.
Be sure to check the info panel for any properties that don't get assigned. This will occur if the object doesn't have a matching property to the one linked to, so will need to be assigned manually.
Using Shader Graph, any property with Exposed unchecked can be assigned globally.
Each material can define its own settings and influence from the global data provided by _Beat01
Showing how BeatIntensity and BeatInfluence are implemented in Shader Graph