Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [4.0.3] - 2024-05-22
### Changed
- Disallow `ActiveCamera` from being selected with SRP-based projects as a camera source.
- Display an error message and prevent Recorder from starting if MainCamera is selected while the main camera is missing from the project.
- Display an error when a Recorder is set to capture from a Targeted Camera in a project using URP 2D Renderer.
- Prevent reset on HDCameras history when there is no change of resolution.
- Output resolution `Match Window Size` is now labeled `Use Game View resolution` to reflect the associated behavior. It also shows the current resolution of the Game View.
- Show a warning when the requested `Output Resolution` conflicts with the current Game View resolution as Recorder needs to force change the `Output Resolution` of the Game View for the recording.

### Fixed
- Ensure that camera's rotation is retained when recording monoscopic 360 views.
- Ensure an alpha channel is added when the Editor targets a mobile platform.
- FFmpeg sample: prevent performance issue during a recording when the CPU main thread takes longer than usual to process a frame. This can happen when the Play Mode is paused or when a scene is being loaded.
  • Loading branch information
Unity Technologies committed May 22, 2024
1 parent 9dc4cee commit b59e5a6
Show file tree
Hide file tree
Showing 27 changed files with 221 additions and 90 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.0.3] - 2024-05-22
### Changed
- Disallow `ActiveCamera` from being selected with SRP-based projects as a camera source.
- Display an error message and prevent Recorder from starting if MainCamera is selected while the main camera is missing from the project.
- Display an error when a Recorder is set to capture from a Targeted Camera in a project using URP 2D Renderer.
- Prevent reset on HDCameras history when there is no change of resolution.
- Output resolution `Match Window Size` is now labeled `Use Game View resolution` to reflect the associated behavior. It also shows the current resolution of the Game View.
- Show a warning when the requested `Output Resolution` conflicts with the current Game View resolution as Recorder needs to force change the `Output Resolution` of the Game View for the recording.

### Fixed
- Ensure that camera's rotation is retained when recording monoscopic 360 views.
- Ensure an alpha channel is added when the Editor targets a mobile platform.
- FFmpeg sample: prevent performance issue during a recording when the CPU main thread takes longer than usual to process a frame. This can happen when the Play Mode is paused or when a scene is being loaded.

## [4.0.2] - 2023-10-24
### Changed
- Removed resolution automatic rounding to the nearest even number when Movie Recorder uses MP4 codec and "Match Window Size" output resolution.
Expand Down
Binary file modified Documentation~/Images/RecorderClip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation~/Images/RecorderImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation~/Images/RecorderMovie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation~/Images/RecorderWindow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Documentation~/InclCaptureOptionsGameView.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ These properties appear when you set **Source** to **Game View**.
>**Note:**
>* If you have multiple Game Views in your project, the Recorder captures only the last one you selected in the Editor.
>* If you are using more than one Recorder to capture Game View, they must all use the same resolution settings.
>* If the Output Resolution and/or Aspect Ratio in the Recorder is different than the Game view resolution, the Recorder switches the Game view to the Recorder's resolution before starting the recording. After the recording ends, the Game view does not automatically revert to its previous resolution.
>* If the Output Resolution and/or Aspect Ratio in the Recorder is different than the Game view resolution, the Recorder switches the Game view to the Recorder's resolution before starting the recording. After the recording ends, the Game view does not automatically revert to its previous resolution. If you need to revert this change afterward, use the **Aspect ratio** dropdown menu in the [Game view control bar](https://docs.unity3d.com/Manual/GameView.html).
>* Recording the Simulator view is [not supported](KnownIssues.md#simulator-view-recording-not-supported).
![](Images/CaptureOptionsGameView.png)

|Property||Function|
|-|-|-|
| **Output Resolution** || Allows you to set the dimensions of the recorded view using different methods. |
| | Match Window Size | Matches the resolution and aspect ratio of the currently selected Game View. |
| | Use Game View Resolution | Matches the resolution and aspect ratio of the currently selected Game View. |
| | _[PRESET RESOLUTIONS]_ | Choose from several standard video resolutions such as FHD (1080p) and 4K (2160p).<br/><br/>The numeric value represents the image height. To set the image width, you must select a specific **Aspect Ratio**. |
| | Custom | Uses custom width and height values that you supply in the **W** and **H** fields. |
| **Aspect Ratio** || Specifies the ratio of width to height (w:h) of the recorded view when you set the **Output Resolution** to a preset resolution. |
Expand Down
6 changes: 4 additions & 2 deletions Documentation~/InclCaptureOptionsTargetedCamera.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
These properties appear when you set **Source** to **Targeted Camera**.

>**Note:** If the Output Resolution and/or Aspect Ratio in the Recorder is different than the Game view resolution, the Recorder switches the Game view to the Recorder's resolution before starting the recording. After the recording ends, the Game view does not automatically revert to its previous resolution.
>[!NOTE]
>* If the Output Resolution and/or Aspect Ratio in the Recorder is different than the Game view resolution, the Recorder switches the Game view to the Recorder's resolution before starting the recording. After the recording ends, the Game view does not automatically revert to its previous resolution. If you need to revert this change afterward, use the **Aspect ratio** dropdown menu in the [Game view control bar](https://docs.unity3d.com/Manual/GameView.html).
>* You can't capture images from a Targeted Camera if you are using a URP 2D Renderer, due to a [known limitation](KnownIssues.md#targeted-camera-recording-is-not-available-with-urp-2d-renderer). As an alternative, you can capture from the Game View or from a Render Texture Asset.
![](Images/CaptureOptionsTargetedCamera.png)

Expand All @@ -12,7 +14,7 @@ These properties appear when you set **Source** to **Targeted Camera**.
| | TaggedCamera | A camera tagged with a specific [Tag](https://docs.unity3d.com/Manual/Tags.html).<br/><br/>If you select this option, you must enter a value in the **Tag** field. |
|**Tag** | | Specifies which Camera Tag to look for when you set **Camera** to **Tagged Camera**.|
| **Output Resolution** || Allows you to set the dimensions of the recorded view using different methods. |
| | Match Window Size | Matches the resolution and aspect ratio of the currently selected Game View. |
| | Use Game View Resolution | Matches the resolution and aspect ratio of the currently selected Game View. |
| | _[PRESET RESOLUTIONS]_ | Choose from several standard video resolutions such as FHD (1080p) and 4K (2160p).<br/><br/>The numeric value represents the image height. To set the image width, you must select a specific **Aspect Ratio**. |
| | Custom | Uses custom width and height values that you supply in the **W** and **H** fields. |
| **Aspect Ratio** || Specifies the ratio of width to height (w:h) of the recorded view when you set the **Output Resolution** to a preset resolution. |
Expand Down
26 changes: 26 additions & 0 deletions Documentation~/KnownIssues.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This page lists some known issues and limitations that you might experience with

**Workaround:** The recommended use case is to limit yourself to one Movie recording at a time. Ensure that you have only one active Movie Recorder in the Recorder window and no Movie Recorder Clips in Timeline, or vice-versa. If you need to keep concurrent recordings for some reason, you can still set up lower resolutions or try different encoders.

#### Targeted Camera recording is not available with URP 2D Renderer
**Limitation:** Recorder cannot capture images from a Targeted Camera in URP 2D projects. A capture pass that Recorder requires is missing in the renderer.

**Workaround:** As an alternative, you can capture from the Game View or from a Render Texture Asset.

#### ActiveCamera recording not available with SRPs

**Limitation:** The use of a Scriptable Render Pipeline ([SRP](https://docs.unity3d.com/Manual/ScriptableRenderPipeline.html)) in your project prevents you from setting ActiveCamera as the source of the recording in the [Movie Recorder](RecorderMovie.md#targeted-camera-source-properties) and the [Image Sequence Recorder](RecorderImage.md#targeted-camera-source-properties). This render pipeline limitation applies to all SRPs including Unity's High Definition Render Pipeline ([HDRP](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest)) and Universal Render Pipeline ([URP](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest)). For the same reason, the [AOV Recorder](RecorderAOV.md#source-camera), which requires HDRP, doesn't include the ActiveCamera option by design.
Expand Down Expand Up @@ -58,6 +63,14 @@ This page lists some known issues and limitations that you might experience with

**Workaround:** Before building a project, make sure to delete or disable any Recorder tracks present in Timeline.

#### Recorder does not capture any custom cursors

**Known issue:** When you record a video where you use a custom cursor set with [Cursor.SetCursor](https://docs.unity3d.com/ScriptReference/Cursor.SetCursor.html), the cursor doesn't appear in the recordings.

**Workaround:** To make sure that the Recorder captures your custom cursor, you have to:
- Set the **Input Source** to **GameView**.
- Call `Cursor.SetCursor` with [`CursorMode.ForceSoftware`](https://docs.unity3d.com/ScriptReference/CursorMode.ForceSoftware.html).

#### Simulator view recording not supported

**Limitation:** The Movie Recorder and Image Sequence Recorder can only record the Unity Editor output rendering view in its _Game_ state, and not in its _Simulator_ state. If the Simulator view is selected when you start recording the Game View, the source window automatically switches to Game view.
Expand Down Expand Up @@ -101,3 +114,16 @@ Limitations to path tracing in HDRP also apply to path tracing in Accumulation.
**Limitation:** Recording accumulation while anti-aliasing is enabled in HDRP may have unintended effects on image quality.

**Workaround:** Disable anti-aliasing in HDRP before recording with Accumulation. Enable **Anti-aliasing** in Accumulation instead.

#### Different Cameras with different Display targets lead to black output

**Known issue:** Certain camera outputs are black when cameras have different TargetDisplays. This occurs when you set up recorders with **Targeted Camera** as the **Input Source**.
The Game view triggers the render loop of all cameras that target the same Display number. If no Game view is configured for a specific Display number that is set on a Camera, it does not render.

**Workaround:** Open another Game view and set it to the Display number that you need to capture.

#### Impossible to capture multiple Game views at the same time

**Known issue:** Recorder does not handle a configuration with mutiple Game views as **Input Source**. Recorder assumes that there is only one Game view and gets the one that has the focus at the moment the Editor enters the Play Mode.

**Workaround:** Set the **Input Source** to **Targeted Camera** or **Render Texture Asset**.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ When Accumulation is enabled, the image that is rendered on each frame is based

>**Notes:**
>* Sub frames that precede the first frame, as defined by the Start Frame property, are not captured on the first frame. Accumulation begins in the interval before the second frame.<br/>
>* The number of samples (sub frames) in the diagram below is for illustration only. Hundreds of samples may be needed to produce a smooth motion-blur trail; thousands of path-tracing samples may be needed to converge on a clean image.
![Image shows that the interval between one frame and the next is divided into sub frames, shutter interval starts immediately after the last frame and contains a number of the sub frames; the shutter profile is fully contained in the interval, and the sub frames in the interval are recorded on the following frame.](Images/recorder-accumulate-properties.png)
Expand Down
2 changes: 1 addition & 1 deletion Documentation~/RecorderWindowRecordingProperties.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Use the general recording properties to simultaneously start or stop recordings
| **Recording Mode** ||Allows you to specify the frames or time interval to record.|
||_Manual_ |Start or stop recording when you manually click **Start Recording** or **Stop Recording**, respectively.|
|| _Single Frame_ |Record a single frame. Use the **Target Frame** property to specify this frame.|
|| _Frame Interval_ |Record a set of consecutive frames during Play mode. Use the **Start** and **End** properties to specify when to start and stop.|
|| _Frame Interval_ |Record a set of consecutive frames during Play mode. Use the **Start** and **End** properties to specify when to start and stop.<br/><br/>**Important**: if you set **Start** to a value greater than zero, the Editor still plays all the frames from the beginning when entering Play Mode before starting to record the specified frame range. The Editor needs to compute and render all these frames to ensure determinism, for example when the playback involves physics simulation or procedural noise. Notice the _skipped frames_ mention during the playback of the non-recorded frames.|
|| _Time Interval_ |Record a specific duration, in seconds, during Play mode. Use the **Start** and **End** properties to specify when to start and stop.|
| **Target Frame** ||Specifies the number of the frame to capture when in **Single Frame** mode.|
| **Start**/ <br/> **End** ||• In **Frame Interval** mode, these values specify the range of frames to capture.<br/>• In **Time Interval** mode, these values specify the time, in seconds, to start and stop recording.|
Expand Down
4 changes: 2 additions & 2 deletions Documentation~/RecordingAccumulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Use Accumulation to:
Accumulation automatically applies a filter to reduce artifacts in spotlight shadows. This filter requires HDRP 14.0.2 or later.

>**Notes:**
* Recording Accumulation while anti-aliasing is enabled in HDRP may have unintended effects on image quality. Disabling anti-aliasing in HDRP before recording is recommended. Enable Anti-aliasing in Accumulation instead.
* Similarly, before you record motion blur using Accumulation, disable motion blur in HDRP.
>* Recording Accumulation while anti-aliasing is enabled in HDRP may have unintended effects on image quality. Disabling anti-aliasing in HDRP before recording is recommended. Enable Anti-aliasing in Accumulation instead.
>* Similarly, before you record motion blur using Accumulation, disable motion blur in HDRP.
## Requirements

Expand Down
4 changes: 2 additions & 2 deletions Documentation~/RecordingAccumulationPathTracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ HDRP and Recorder accumulate samples differently:
You can configure Recorder to accumulate [path tracing and motion blur](RecordingAccumulationPathTracing.md#configure-path-tracing-accumulation-with-motion-blur) or to accumulate [path tracing without motion blur](RecordingAccumulationPathTracing.md#configure-path-tracing-accumulation-without-motion-blur).

>**Notes:**
* If a scene contains an “Exposure” post-process in an automatic mode and Adaptation is set to Progressive, the resulting image may be too bright when path tracing is accumulated. For more information, see [Overexposed frames when accumulating path tracing](KnownIssues.md#overexposed-frames-when-accumulating-path-tracing).<br/><br/>
* Limitations to path tracing in HDRP also apply to path tracing in Accumulation. See Path tracing [limitations](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/Ray-Tracing-Path-Tracing.html%23limitations).
>* If a scene contains an “Exposure” post-process in an automatic mode and Adaptation is set to Progressive, the resulting image may be too bright when path tracing is accumulated. For more information, see [Overexposed frames when accumulating path tracing](KnownIssues.md#overexposed-frames-when-accumulating-path-tracing).<br/><br/>
>* Limitations to path tracing in HDRP also apply to path tracing in Accumulation. See Path tracing [limitations](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/Ray-Tracing-Path-Tracing.html%23limitations).
## Requirements
A number of specific conditions must be met to use path-tracing accumulation in your recording. See [Requirements](RecordingAccumulation.md#requirements).
Expand Down
7 changes: 5 additions & 2 deletions Documentation~/RecordingVideo.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ Input properties define the source of the recording and its visual parameters.

3. For **Aspect Ratio**, select **16:9 (1.7778)**.

>[!NOTE]
>If the Output Resolution and/or Aspect Ratio in the Recorder is different than the Game view resolution, the Recorder switches the Game view to the Recorder's resolution before starting the recording. After the recording ends, the Game view does not automatically revert to its previous resolution. If you need to revert this change afterward, use the **Aspect ratio** dropdown menu in the [Game view control bar](https://docs.unity3d.com/Manual/GameView.html).
## Configure the Output Format properties

The Output Format properties define the media format to save the recorded frames in.
>**Notes:**
>* The alpha channel is available for some encoders subject to the following conditions:
* The render pipeline is High Definition Render Pipeline (HDRP) or Built-in render pipeline.
* The source is not Game View. The other sources can support alpha.
> * The render pipeline is High Definition Render Pipeline (HDRP) or Built-in render pipeline.
> * The source is not Game View. The other sources can support alpha.
>* To enable recording when Include Audio is selected, in **Project Settings** > **Audio** > **Default Speaker Mode**, ensure that **Mono** or **Stereo** is selected.
In H.264 MP4, you can include audio, but alpha is not available.
Expand Down
28 changes: 28 additions & 0 deletions Editor/Sources/Helpers/UnityHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#if HDRP_AVAILABLE
using UnityEngine.Rendering.HighDefinition;
#endif
#if URP_AVAILABLE
using UnityEngine.Rendering.Universal;
#endif
using UnityObject = UnityEngine.Object;

namespace UnityEditor.Recorder
Expand Down Expand Up @@ -187,6 +190,31 @@ internal static bool UsingURP()
return usingURP;
}

internal static bool UsingURP2DRenderer()
{
#if URP_AVAILABLE && UNITY_2023_2_OR_NEWER
var urp = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;

if (urp == null)
return false;

foreach (var renderer in urp.renderers)
{
if (renderer == null)
continue;

if (renderer.GetType().FullName.Contains("Renderer2D"))
return true;
}
return false;
#elif URP_AVAILABLE && !UNITY_2023_2_OR_NEWER
var urp = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
return urp.scriptableRenderer.GetType().FullName.Contains("Renderer2D");
#else
return false;
#endif
}

/// <summary>
/// Are we currently using the Legacy Render Pipeline.
/// </summary>
Expand Down
10 changes: 8 additions & 2 deletions Editor/Sources/ImageHeightSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ImageHeightSelector
{ ImageHeight.x720p_HD, "HD - 720p" },
{ ImageHeight.x480p, "SD - 480p" },
{ ImageHeight.x240p, "240p" },
{ ImageHeight.Window, "Match Window Size" },
{ ImageHeight.Window, "Use Game View Resolution" },
{ ImageHeight.Custom, "Custom" }
};

Expand Down Expand Up @@ -57,7 +57,13 @@ void BuildPopup(int max)
for (int i = 0; i < count; ++i)
{
var e = ordered[i];
m_ToName[i] = s_HeightToName[e];
if (e == ImageHeight.Window)
{
Input.GameViewSize.GetGameRenderSize(out var w, out var h);
m_ToName[i] = s_HeightToName[e] + $" ({w}x{h}) ";
}
else
m_ToName[i] = s_HeightToName[e];
m_ToEnumValue[i] = (int)e;
m_ToIndex[e] = i;
}
Expand Down
Loading

0 comments on commit b59e5a6

Please sign in to comment.