+function get_fade_scene(state, signals, t, width, height, input_resolution)
+ local scene = fade_scene
+ setup_fade_input(state, scene.input0, signals, state.transition_src_signal, width, height)
+ setup_fade_input(state, scene.input1, signals, state.transition_dst_signal, width, height)
+
+ local tt = calc_fade_progress(t, state.transition_start, state.transition_end)
+ scene.mix_effect:set_float("strength_first", 1.0 - tt)
+ scene.mix_effect:set_float("strength_second", tt)
+
+ -- The commentator output has no overlay on it.
+ local extra_alpha_factor = 1.0
+ if not simple_signal_has_overlay(state.transition_src_signal) and
+ not simple_signal_has_overlay(state.transition_dst_signal) then
+ extra_alpha_factor = 0.0
+ elseif not simple_signal_has_overlay(state.transition_src_signal) then
+ extra_alpha_factor = tt
+ elseif not simple_signal_has_overlay(state.transition_dst_signal) then
+ extra_alpha_factor = 1.0 - tt
+ end
+
+ -- If fading between two live inputs, the overlay is put on top.
+ -- If fading between the static picture and a live input,
+ -- the overlay is put on the live input.
+ scene.input0.overlay.overlay_effect:disable()
+ scene.input1.overlay.overlay_effect:disable()
+ scene.overlay.overlay_effect:disable()
+ if state.overlay_enabled then
+ local input0_live = (state.transition_src_signal ~= STATIC_SIGNAL_NUM)
+ local input1_live = (state.transition_dst_signal ~= STATIC_SIGNAL_NUM)
+ if input0_live and not input1_live then
+ scene.input0.overlay.overlay_effect:enable()
+ prepare_overlay_live(state, scene.input0, t, extra_alpha_factor)
+ elseif input1_live and not input0_live then
+ scene.input1.overlay.overlay_effect:enable()
+ prepare_overlay_live(state, scene.input1, t, extra_alpha_factor)
+ else
+ scene.overlay.overlay_effect:enable()
+ prepare_overlay_live(state, scene, t, extra_alpha_factor)
+ end
+ end
+ return scene.scene