Skip to content

Vfx/docs/bulk review continued #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions com.unity.visualeffectgraph/Documentation~/ComponentAPI.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<div style="border: solid 1px #999; border-radius:12px; background-color:#EEE; padding: 8px; padding-left:14px; color: #555; font-size:14px;"><b>Draft:</b> The content on this page is complete, but it has not been reviewed yet.</div>

# Visual Effect component API

To create an instance of a [Visual Effect Graph](VisualEffectGraphAsset.md) in a Scene, Unity uses the [Visual Effect component](VisualEffectComponent.md). The Visual Effect component attaches to GameObjects in your Scene and references a Visual Effect Graph which defines the visual effect. This allows you to create different instances of effects at various positions and orientations, and control each effect independently. To control an effect at runtime, Unity provides C# API that you can use to modify the Visual Effect component and set [Property](Properties.md) overrides.
Expand Down
157 changes: 81 additions & 76 deletions com.unity.visualeffectgraph/Documentation~/Contexts.md

Large diffs are not rendered by default.

58 changes: 30 additions & 28 deletions com.unity.visualeffectgraph/Documentation~/Events.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
<div style="border: solid 1px #999; border-radius:12px; background-color:#EEE; padding: 8px; padding-left:14px; color: #555; font-size:14px;"><b>Draft:</b> The content on this page is complete, but it has not been reviewed yet.</div>
# Events

Events are the Processing Workflow inputs of a Visual Effect Graph. Through Events, a Visual Effect can :
Events define the inputs for a Visual Effect Graph's [**processing** workflow](GraphLogicAndPhilosophy.md#processing-workflow-(vertical-logic)). The Spawn and Initialize [Contexts](Contexts.md) use Events as their inputs. Through Events, a Visual Effect Graph can :

* Start and stop spawning particles,
* Read Attribute payloads sent from C#

Events are used in the graph as inputs for Spawn Contexts and Initialize
* Start and stop spawning particles.
* Read [Event Attribute payloads](#eventattribute-payloads) sent from C# scripts.

## Creating Events

![](Images/EventContexts.png)

You can Create Events using Event Contexts. These contexts have no Flow input and connect to Spawn or Initialize Contexts.
In general, an Event is just a string that represents the Event's name. To receive an Event in the Visual Effect Graph, create an Event [Context](Contexts.md) and type the name of the Event you want to receive in the **Event Name** property. Event Contexts have no input flow slots and can only connect their output flow slot to Spawn or Initialize Contexts.

To create an Event Context:

In order to Create an Event Context, right click in an empty space of the Workspace and select Create Node, then Select **Event (Context)** from the Node Creation menu.
1. In the [Visual Effect Graph window](VisualEffectGraphWindow.md), right-click in an empty space.
2. From the menu, click **Create Node**.
3. In the Node Creation menu, click **Contexts > Event (Context)**.
4. In the **Event Name** input field, type the name of your Event.

## Default Events

Visual Effect Graphs provide two Default Events that are implicitly bound to the Start and Stop Flow Inputs of the Spawn Contexts:
The Visual Effect Graph provide two default Events:

* `OnPlay` for the intent *Enabling the Spawn of Particles*, is implicitly bound to the Start Flow input of any Spawn Context.
* `OnStop` for the intent of *Stopping the Spawn of Particles*, is implicitly bound to the Stop Flow input of any Spawn Context.
* **OnPlay**: To enable the spawning of particles. If you do not assign an Event to a Spawn Context's **Start** input flow slot, the Visual Effect Graph implicitly binds this Event to that input flow slot instead.
* **OnStop**: To disable the spawning of particles. If you do not assign an Event to a Spawn Context's **Stop** input flow slot, the Visual Effect Graph implicitly binds this Event to that input flow slot instead.

Connecting Event Contexts on the Start and Stop Flow inputs of a Spawn Contexts will remove the implicit binding to the `OnPlay` and `OnStop` Events
If you connect an Event Context to a Spawn Context's **Start** or **Stop** input flow slot, this removes the implicit binding to the **OnPlay** and **OnStop** Events respectively.

## Custom Events

Custom Events can be created inside Visual Effect Graphs using Event Contexts.
If you do not want to use the default Events, you can use an Event Context to create your own custom Event.

In order to create a custom event, create an event using the **Create Node** menu, then change its name in the **Event Name** field
To do this, first [create an Event Context](#creating-events), then type the name of your custom Event in the **Event Name** property.

## EventAttribute Payloads
## Event Attribute Payloads

Event Attribute payloads are attributes attached on one event. You can set these attributes in Visual Effect Graph using the **Set [Attribute] Event Attribute>** Blocks in Spawn Contexts, but you can also attach them to events sent from the scene using the [Component API](ComponentAPI.md#event-attributes) .
Event Attribute payloads are attributes that you can attach to an Event. To set these attributes in a Visual Effect Graph, you can use the **Set [Attribute]** Blocks in Spawn Contexts, but you can also attach them to Events you send from C# scripts. For information on how to do that latter, see [Component API](ComponentAPI.md#event-attributes) .

EventAttribute Payloads are attributes that will implicitly travel through the graph from Events, through Spawn Systems, and that can be caught in Initialize Contexts using **Get Source Attribute Operators** and **Inherit [Attribute] Blocks**
Event Attribute Payloads are attributes that implicitly travel through the graph from Events, through Spawn Contexts, and eventually to an Initialize Context. To catch a payload in an Initialize Context, use **Get Source Attribute** Operators or **Inherit [Attribute]** Blocks.

## Default VisualEffect Event
## Default Visual Effect Event

The default Visual Effect Event defines the name of the event that is implicitly sent when a `Reset` is performed on a [Visual Effect](VisualEffectComponent.md) instance (this can happen at first start or any restart of the effect).
The default Visual Effect Event defines the name of the Event that the Visual Effect Graph implicitly sends when a [Visual Effect](VisualEffectComponent.md) instance **Resets**. This happens when the effect first starts, or when the effect restarts.

Default VisualEffect Event is defined in the [Visual Effect Graph Asset Inspector](VisualEffectGraphAsset.md) but can be overridden in any [Visual Effect Inspector](VisualEffectComponent.md) for any instance in the scene.
You can define the default Visual Effect Event for each [Visual Effect Graph Asset](VisualEffectGraphAsset.md) independently. You can also override this value for every instance of the Visual Effect Graph Asset. To override the default Visual Effect Event for an instance, see **Initial Event Name** in the [Visual Effect Inspector](VisualEffectComponent.md).

## GPU Events

GPU Events is an **Experimental feature** of Visual Effect Graph : It enables particle spawn based on other Particles. You can enable this option in [Visual Effect Preferences](VisualEffectPreferences.md) .
GPU Events are an **Experimental feature** of the Visual Effect Graph. They allow you to spawn particles based on other particles. To enable this option, enable the **Experimental Operators/Blocks** checkbox in the [Visual Effect Preferences](VisualEffectPreferences.md) .

![](Images/GPUEvent.png)
GPU Events are Event Contexts that rely on data sent from other systems, for example, when a particle dies. The following Update Blocks can send GPU Event Data:

GPU Events are Event Contexts that relies on Data sent from other Systems, for instance when a particle dies, or other conditions. The following Update Blocks can send GPU Event Data:
* **Trigger Event On Die**: Spawns N Particles on another system when a particle dies.
* **Trigger Event Rate**: Spawn N Particles per second (or per distance travelled), based on a particle from a system.
* **Trigger Event Always**: Spawns N Particles every frame.

* **Trigger Event On Die** : Spawns N Particles on another system when a particle dies
* **Trigger Event Rate** : Spawn N Particles per second (or per distance travelled), based on a particle from a system
* **Trigger Event Always** : Spawns N Particles every Frame.
These Blocks connect to a **GPUEvent** Context. This Context does not handle any Blocks, but instead connects to an Initialize Context of a child system.

These Blocks connect to a **GPUEvent** Context. This context does not handle any Blocks but instead connects to a Initialize Context of a child system.
To gather data from the parent particle, a child system must refer to [Source Attributes](Attributes.md) in its Initialize Context. To do this, a child system can use a **Get Source Attribute** Operator, or an **Inherit Attribute** Block. For a visual example, see the image below.

In order to gather data from the parent particle, the child system must refer to [Source Attributes](Attributes.md) in its Initialize Context, by using **Get Source Attribute Operator**, or **Inherit Attribute Block**,as shown as in the example above : The child System inherits the source position of the particle that created it, and inherits roughly 50% of its speed.
![](Images/GPUEvent.png)*In this example, the child System inherits the source position of the particle that creates it. It also inherit roughly 50% of the parent particle's speed.*
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ To preview an effect, you can:

This lets you edit parameters directly in the Scene, see the lighting on your effect, and use the [Target GameObject Panel](VisualEffectGraphWindow.md#target-visual-effect-gameobject) features for the specific target instance of your effect.

## Manipulating Graph Elements
## Manipulating graph elements
When you open an Asset inside the Visual Effect Graph window, you can see and edit the graph for that specific Asset.

A Visual Effect Graph contains [Operator Nodes](Operators.md) and [Blocks](Blocks.md). Each Node is in charge of processing its input properties. You can link Nodes together to perform a series of calculations. All Nodes end up connecting into a Block (or a context) : A Block defines an operation on an effect, based on its input properties.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Visual Effect Graph uses two distinct workflows:
## Processing workflow (vertical logic)
The processing workflow links together a succession of customizable stages to define the complete system logic. This is where you can determine when the spawn, initialization, updating, and rendering of the particles happen during the effect.

The processing workflow connects Contexts using their **Flow Slots** located at the top and the bottom of the Context Node.
The processing workflow connects Contexts using their **flow slots** located at the top and the bottom of the Context Node.

The processing logic defines the different stages of processing of a visual effect. Each stage consists of a large colored container called a [Contexts](Contexts.md). Each Context connects to another compatible Context, which defines how the next stage of processing uses the current Context.

Expand All @@ -23,13 +23,13 @@ The Visual Effect Graph comes with a large Block and Node library that you can t

To customize how particles behave, you can connect horizontal Nodes to a Block to create a custom a mathematical expression. To do this, use the **Create Node** context menu to add Nodes, change their values, then connect the Nodes to Block properties.

## Graph Elements
## Graph elements

A Visual Effect Graph provides a workspace where you can create Graph Elements and connect them together to define effect behaviors. The Visual Effect Graph comes with many different types of Graph Elements that fit into the workspace.
A Visual Effect Graph provides a workspace where you can create graph elements and connect them together to define effect behaviors. The Visual Effect Graph comes with many different types of graph elements that fit into the workspace.

### Workspace

A Visual Effect Graph provides a **Workspace** where you can create Graph Elements and connect them together to define effect behaviors.
A Visual Effect Graph provides a **Workspace** where you can create graph elements and connect them together to define effect behaviors.

![The vertical workflow contains Systems, which then contain Contexts, which then contain Blocks. Together, they determine when something happens during the “lifecycle” of the visual effect.](Images/SystemVisual.png)

Expand Down Expand Up @@ -74,7 +74,7 @@ While the graph elements are different, their contents and behavior tend to be t

#### Settings

Settings are Fields that you cannot connect to using the property workflow. Every Graph Element displays settings:
Settings are Fields that you cannot connect to using the property workflow. Every graph element displays settings:

* In the **Graph** : Between the Title and the property container in the Graph.
* In the **Inspector** : When you select a Node, the Inspector displays additional, advanced settings.
Expand All @@ -85,7 +85,7 @@ If you change the value of a setting, you need to recompile the Graph to see the

[Properties](Properties.md) are Fields that you can edit and connect to using the property workflow. You can connect them to other properties contained in other graph elements.

## Other Graph Elements
## Other graph elements

### Groups

Expand Down
2 changes: 1 addition & 1 deletion com.unity.visualeffectgraph/Documentation~/Properties.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div style="border: solid 1px #999; border-radius:12px; background-color:#EEE; padding: 8px; padding-left:14px; color: #555; font-size:14px;"><b>Draft:</b> The content on this page is complete, but it has not been reviewed yet.</div>
# Properties

Properties are editable fields that you can connect to graph elements using [Property workflow](GraphLogicAndPhilosophy.md). They can be found on Graph Elements such as [Contexts](Contexts.md), [Blocks](Blocks.md) and [Operators](Operators.md).
Properties are editable fields that you can connect to graph elements using [Property workflow](GraphLogicAndPhilosophy.md). They can be found on graph elements such as [Contexts](Contexts.md), [Blocks](Blocks.md) and [Operators](Operators.md).

## Using Properties

Expand Down
46 changes: 46 additions & 0 deletions com.unity.visualeffectgraph/Documentation~/StickyNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Sticky Notes

Sticky Notes are objects in a graph view that you can write in. They are the graph view equivalent of a comment in code, and consist of a title and body. You can create as many as you want in the graph, and use them for a variety of purposes, for example:

- To describe how a section of your graph works.
- To leave notes for yourself or others collaborating in your Unity Project.
- As a to-do list that includes tasks to complete at a later date.

## Using Sticky Notes

To create a Sticky Note, right-click an empty space in the graph view and, in the context menu, click **Create Sticky note**. You can now customize and add content to the new Sticky Note. There are two text areas that you can write to:

- **Title**: The text area at the top of the Sticky Note is the title. Here you can concisely describe what the Sticky Note contains in its body text area. For example, this could be the name of the graph section the Sticky Note describes.
- **Body**: The larger text area below the title area is the body. You can write the full contents of the note here.

### Controls

This section describes how to edit text, move and resize the Sticky Note, and perform other actions.

#### Editing text

To edit text on a Sticky Note, double-click on a text area. This also selects all of the text in the area so be sure to move the text cursor before you edit the text.

#### Moving and resizing

You can move Sticky Notes anywhere on the graph. For information on how to do this, see [manipulating graph elements](VisualEffectGraphWindow.md#moving-elements).

You can also resize Sticky Notes. You can resize the Sticky Note manually or the Sticky Note can resize itself automatically to fit its contents. For information on how to make the Sticky Note resize itself, see the **Fit To Text** option in the [Context menu](#context-menu). For information on how to resize the Sticky Note manually, see [manipulating graph elements](VisualEffectGraphWindow.md#moving-elements).

#### Duplicating

You can also cut, copy, paste, and duplicate Sticky Notes. For information on how to perform these actions, see [duplicating elements](VisualEffectGraphWindow.md#copy-cut-and-paste-and-duplicate-elements).

#### Context menu

To open the context menu for the Sticky Note, right-click anywhere on the Sticky Note. The options in the context menu are as follows.

| **Option** | **Description** |
| -------------------------- | ------------------------------------------------------------ |
| **Dark Theme/Light Theme** | Toggles the color theme of the Sticky Note between light theme and dark theme. |
| **Text Size** | Resizes the font in the text areas to the following values: |
| Small | Title: 20<br/>Body: 11 |
| Medium | Title: 40<br/>Body: 24 |
| Large | Title: 60<br/>Body: 36 |
| Huge | Title: 80<br/>Body: 56 |
| **Fit To Text** | Resizes the Sticky Note so that it precisely fits the text areas.<br/>**Note**: If your title spreads over more than a single line, this horizontally resizes the Sticky Note to the smallest size where the title text fits on a single line. |
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [Attributes](Attributes.md)
* [Subgraph](Subgraph.md)
* [Blackboard](Blackboard.md)
* [Sticky Notes](StickyNotes.md)
* [Project Settings](VisualEffectProjectSettings.md)
* [Preferences](VisualEffectPreferences.md)
* [The Visual Effect Component](VisualEffectComponent.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The navigation controls for the Node Workspace are similar to those that other g
* **Duplicate**: Ctrl+D.
* **Duplicate with edges**: Ctrl+Alt+D.

### Adding Graph Elements
### Adding graph elements

To add graph elements, you can use any of the following methods:

Expand Down