Skip to content

Commit

Permalink
VFX staging (Unity-Technologies#7212)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienf-unity authored Feb 22, 2022
1 parent 422593c commit 2762b43
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace UnityEditor.VFX.HDRP
{
[VFXInfo(experimental = true)]
class VFXDecalHDRPOutput : VFXAbstractParticleHDRPOutput
{
public override string name
Expand Down
3 changes: 3 additions & 0 deletions com.unity.visualeffectgraph/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Context labels where not displayed in the inspector except for outputs where it was always a letter, even if the user had given a custom label
- In `Output Particle` blocks, shader graph exposed properties order is consistent with shader graph blackboard
- Picking and Selection passes [Case 1382788](https://issuetracker.unity3d.com/product/unity/issues/guid/1382788/), [Case 1402283](https://issuetracker.unity3d.com/product/unity/issues/guid/1402283/)
- Reduce GC.Allocs in the SceneViewGUICallback. [Case 1305929](https://issuetracker.unity3d.com/product/unity/issues/guid/1305929/)
- HDRP Decals are not in experimental.
- Fix Motion vectors in XR. [Case 14003636](https://issuetracker.unity3d.com/product/unity/issues/guid/14003636/)

## [14.0.0] - 2021-11-17

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Visual Effect Graph preferences is a panel in the Unity Preferences window. To a
| **Verbose Mode for Compilation** | Enable Verbose logging in Console when Compiling Graphs. |
| **Experimental Shader Externalization** | Enable Externalizing Shaders (for Debugging purposes) in the [Visual Effect Graph Asset Inspector](VisualEffectGraphAsset.md) |
| **Force Compilation in Edition Mode** | Disables Graph Optimization when Saving Assets (for Debug Purposes Only) |
| **Main Camera fallback** | Specifies the camera source for the color and depth buffer that [MainCamera](Operator-MainCamera.md) Operators use when in the editor. The options are:<br/>&#8226; **Prefer Main Camera**: If the Game view is open, Unity uses the main Camera. If the Game view is not open, but the Scene view is, Unity uses the Scene view Camera.<br/>&#8226; **Prefer Scene Camera**: If the Scene view is open, Unity uses the Scene view Camera. If the Scene view is not open, but the Game view is, Unity uses the main Camera.<br/>&#8226; **No Fallback**: Uses the main Camera even if Unity does not render to it. |
| **Main Camera fallback** | Specifies the camera source for [MainCamera](Operator-MainCamera.md) Operators and [Blocks](Blocks.md) to use when in the editor. The options are:<br/>&#8226; **Prefer Main Camera**: If the Game view is open, Unity uses the main Camera. If the Game view is not open, but the Scene view is, Unity uses the Scene view Camera.<br/>&#8226; **Prefer Scene Camera**: If the Scene view is open, Unity uses the Scene view Camera. If the Scene view is not open, but the Game view is, Unity uses the main Camera.<br/>&#8226; **No Fallback**: Uses the main Camera even if Unity does not render to it. |
| **User Systems** | Specifies a path to a directory that stores VFX Graph Assets to use as templates for new effects. Any VFX Graph Asset in this folder appears in the visual effect Graph view context menu under **System**. |
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The SDF Bake Tool window includes default properties, which should suit most use
| **Desired Box Size** | The desired per-axis size of the [baking box](sdf-bake-tool.md#baking-box). |
| **Actual Box Size** | The actual per-axis size of the [baking box](sdf-bake-tool.md#baking-box). This might slightly differ from the Desired Box Size, to ensure that the voxels in the texture are cubic.|
| **Live Update** | Indicates whether to update the preview in real time. If you enable this property, the SDF Bake Tool rebakes the Mesh every time a property in this window changes. This can be a resource-intensive operation if you set the **Maximal Resolution** or **Sign Passes Count** to a high value. |
| **Lift Size Limit** | Enable this property to bake to a higher resolution than the default maximum of 256<sup>3</sup>. When you enable this property, the baked texture can have up to 512<sup>3</sup> voxels. A high resolution can be resource-intensive.<br/><br/> When the baking box is not a cube the **Maximal resolution** is the number of voxels along the longest axis. This means the maximal resolution can be higher than 512.<br/><br/>This property only appears if you [show additional properties](#properties).|
| **Baking Parameters** | When the input geometry does not explicitly separate an inside from the outside, for example, because of holes or self-intersection, the baking process can produce unwanted results. The properties in this **Baking Parameters** section of the Inspector can help to mitigate these cases.<br/><br/>The properties in this section only appear if you [show additional properties](#properties). |
| - **Sign Passes Count** | The number of neighboring texels that the SDF Bake Tool uses to calculate whether the current texel is inside or outside the Mesh. Increasing this value reduces artifacts caused by geometry that do not explicitly separate an inside from the outside (for example because of holes or self-intersection).<br/><br/>This property only appears if you [show additional properties](#properties). |
| - **In/Out Threshold** | The threshold from which the SDF Bake Tool considers voxels to be outside. To separate the insides of the geometry from the outside, each texel in the texture has a score that determines whether or not it is outside. Low values for this property mean the SDF Bake Tool considers more points as inside. High values for this property mean the SDF Bake Tool considers more points to be outside.<br/><br/>This property only appears if you [show additional properties](#properties). |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public override void OnGUI(string searchContext)
}
#endif

m_CameraBuffersFallback = (VFXMainCameraBufferFallback)EditorGUILayout.EnumPopup(new GUIContent("Main Camera fallback", "Specifies the camera source for the color and depth buffer that MainCamera Operators use when in the editor."), m_CameraBuffersFallback);
m_CameraBuffersFallback = (VFXMainCameraBufferFallback)EditorGUILayout.EnumPopup(new GUIContent("Main Camera fallback", "Specifies the camera source for MainCamera Operators and Blocks to use when in the editor."), m_CameraBuffersFallback);

var userTemplateDirectory = EditorGUILayout.DelayedTextField(new GUIContent("User Systems", "Directory for user-generated VFX templates (e.g. Assets/VFX/Templates)"), VFXResources.defaultResources.userTemplateDirectory);

Expand Down
52 changes: 33 additions & 19 deletions com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,56 +464,62 @@ protected virtual void SceneViewGUICallback()
if (effects.Count == 0)
return;

var buttonWidth = GUILayout.Width(52);
GUILayout.BeginHorizontal();
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Stop), buttonWidth))
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Stop), Contents.sceneViewButtonWidth))
{
effects.ForEach(x => x.ControlStop());
}
if (effects.All(x => x.pause))
{
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Play), buttonWidth))
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Play), Contents.sceneViewButtonWidth))
{
effects.ForEach(x => x.ControlPlayPause());
}
}
else
{
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Pause), buttonWidth))
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Pause), Contents.sceneViewButtonWidth))
{
effects.ForEach(x => x.ControlPlayPause());
}
}


if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Step), buttonWidth))
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Step), Contents.sceneViewButtonWidth))
{
effects.ForEach(x => x.ControlStep());
}
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Restart), buttonWidth))
if (GUILayout.Button(Contents.GetIcon(Contents.Icon.Restart), Contents.sceneViewButtonWidth))
{
effects.ForEach(x => x.ControlRestart());
}
GUILayout.EndHorizontal();


var playRates = effects.Select(x => x.playRate).Distinct().ToArray();
float playRate = playRates[0];
float playRate = effects[0].playRate;
bool mixedValues = false;
for (int i = 1; i < effects.Count; i++)
{
if (Math.Abs(effects[i].playRate - playRate) > 1e-5)
{
mixedValues = true;
break;
}
}

float playRateValue = playRate * VisualEffectControl.playRateToValue;

GUILayout.BeginHorizontal();
GUILayout.Label(Contents.playRate, GUILayout.Width(46));
EditorGUI.showMixedValue = playRates.Length > 1;
var newPlayRateVal = EditorGUILayout.PowerSlider("", (float)Math.Round(playRateValue), VisualEffectControl.minSlider, VisualEffectControl.maxSlider, VisualEffectControl.sliderPower, GUILayout.Width(124));
GUILayout.Label(Contents.playRate, Contents.playRateWidth);
EditorGUI.showMixedValue = mixedValues;
var newPlayRateVal = EditorGUILayout.PowerSlider("", (float)Math.Round(playRateValue), VisualEffectControl.minSlider, VisualEffectControl.maxSlider, VisualEffectControl.sliderPower, Contents.powerSliderWidth);
EditorGUI.showMixedValue = false;
if (playRate >= 0 && GUI.changed)
{
effects.ForEach(x => x.playRate = newPlayRateVal * VisualEffectControl.valueToPlayRate);
}

var eventType = Event.current.type;
if (EditorGUILayout.DropdownButton(Contents.setPlayRate, FocusType.Passive, GUILayout.Width(40)))
if (EditorGUILayout.DropdownButton(Contents.setPlayRate, FocusType.Passive, Contents.playRateDropdownWidth))
{
GenericMenu menu = new GenericMenu();
foreach (var value in VisualEffectControl.setPlaybackValues)
Expand All @@ -529,19 +535,19 @@ protected virtual void SceneViewGUICallback()
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Show Bounds", GUILayout.Width(192));
VisualEffectUtility.renderBounds = EditorGUILayout.Toggle(VisualEffectUtility.renderBounds, GUILayout.Width(18));
GUILayout.Label("Show Bounds", Contents.showToggleLabelsWidth);
VisualEffectUtility.renderBounds = EditorGUILayout.Toggle(VisualEffectUtility.renderBounds, Contents.showToggleWidth);
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Show Event Tester", GUILayout.Width(192));
VFXEventTesterWindow.visible = EditorGUILayout.Toggle(VFXEventTesterWindow.visible, GUILayout.Width(18));
GUILayout.Label("Show Event Tester", Contents.showToggleLabelsWidth);
VFXEventTesterWindow.visible = EditorGUILayout.Toggle(VFXEventTesterWindow.visible, Contents.showToggleWidth);
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
if (GUILayout.Button(new GUIContent("Play()")))
if (GUILayout.Button(Contents.play))
effects.ForEach(x => x.Play());
if (GUILayout.Button(new GUIContent("Stop()")))
if (GUILayout.Button(Contents.stop))
effects.ForEach(x => x.Stop());
GUILayout.EndHorizontal();
}
Expand Down Expand Up @@ -1424,8 +1430,16 @@ protected static class Contents
public static readonly GUIContent resetInitialEvent = EditorGUIUtility.TrTextContent("Default");
public static readonly GUIContent setPlayRate = EditorGUIUtility.TrTextContent("Set");
public static readonly GUIContent playRate = EditorGUIUtility.TrTextContent("Rate");
public static readonly GUILayoutOption playRateWidth = GUILayout.Width(46);
public static readonly GUILayoutOption showToggleLabelsWidth = GUILayout.Width(192);
public static readonly GUILayoutOption showToggleWidth = GUILayout.Width(18);
public static readonly GUILayoutOption powerSliderWidth = GUILayout.Width(124);
public static readonly GUILayoutOption sceneViewButtonWidth = GUILayout.Width(52);
public static readonly GUILayoutOption playRateDropdownWidth = GUILayout.Width(40);

public static readonly GUIContent graphInBundle = EditorGUIUtility.TrTextContent("Exposed properties are hidden in the Inspector when Visual Effect Assets are stored in Asset Bundles.");
public static readonly GUIContent play = new GUIContent("Play()");
public static readonly GUIContent stop = new GUIContent("Stop()");

static readonly GUIContent[] m_Icons;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ private GameObject meshPrefab
set { m_Settings.m_MeshPrefab = value; }
}

private bool liftSizeLimit
{
get { return m_Settings.m_LiftSizeLimit; }
set { m_Settings.m_LiftSizeLimit = value; }
}

private Mesh mesh
{
get { return m_Settings.m_Mesh; }
Expand Down Expand Up @@ -186,6 +192,7 @@ protected void OnGUI()
bool fitPaddingChanged = false;
if (m_ShowAdvanced)
{
liftSizeLimit = EditorGUILayout.Toggle(Contents.liftSizeLimit, liftSizeLimit);
m_FoldOutParameters = EditorGUILayout.BeginFoldoutHeaderGroup(m_FoldOutParameters, Contents.bakingParameters);
EditorGUI.BeginChangeCheck();
if (m_FoldOutParameters)
Expand Down Expand Up @@ -277,8 +284,10 @@ protected void OnGUI()
m_MeshPreview = new SdfBakerPreview(mesh);
m_RefreshMeshPreview = false;
}

if (mesh == null || (estimatedGridSize > UnityEngine.VFX.SDF.MeshToSDFBaker.kMaxGridSize) || InternalMeshUtil.GetPrimitiveCount(mesh) == 0)
if (mesh == null ||
!liftSizeLimit && estimatedGridSize > MeshToSDFBaker.kMaxRecommandedGridSize ||
estimatedGridSize > MeshToSDFBaker.kMaxAbsoluteGridSize ||
InternalMeshUtil.GetPrimitiveCount(mesh) == 0)
{
GUI.enabled = false;
}
Expand Down Expand Up @@ -659,6 +668,7 @@ static class Contents
internal static GUIContent previewChoice = new GUIContent("Preview Object");
internal static GUIContent bakeSource = new GUIContent("Model Source");
internal static GUIContent liveUpdate = new GUIContent("Live Update", "When enabled, every modification to the settings will trigger a new bake of the SDF, and the preview will be updated accordingly.");
internal static GUIContent liftSizeLimit = new GUIContent("Lift Size Limit", "When enabled, it is possible to bake SDF at higher resolutions, provided that your GPU has enough memory to execute the baking command.");

internal static GUIContent signPass = new GUIContent("Sign passes count",
"Increasing the number of sign passes can help refine the distinction between the inside and the outside of the mesh." +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class SdfBakerSettings : ScriptableObject
internal GameObject m_MeshPrefab;
[SerializeField]
internal Mesh m_Mesh;
[SerializeField]
internal bool m_LiftSizeLimit;

[SerializeField]
internal PreviewChoice m_PreviewObject = PreviewChoice.MeshAndTexture;
Expand Down Expand Up @@ -71,6 +73,7 @@ internal void ResetToDefault()
m_MeshPrefab = null;
m_SelectedMesh = null;
m_Mesh = null;
m_LiftSizeLimit = false;
}

internal void ApplySelectedMesh()
Expand Down
Loading

0 comments on commit 2762b43

Please sign in to comment.