Skip to content
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

[VFX] Direct Link Event & Multiple Per Frame #4457

Merged
merged 430 commits into from
May 17, 2021

Conversation

PaulDemeulenaere
Copy link
Contributor

@PaulDemeulenaere PaulDemeulenaere commented May 5, 2021

Purpose of this PR

Adding support of direct link event which also support multiple event within the same frame.

See JIRA

See this presentation : It only covers "Direct Link" until slide 16 ⬇️
29f84200-7b83-11eb-9d43-7bced3b23062
N.B.: In this view ⬆️, spawnCount should be a float (instead of UInt), it's always expressed as a float in eventAttributes.

⚠️ Require this C++ change : https://ono.unity3d.com/unity/unity/pull-request/125497/_/graphics/vfx/fix/multiple-event-per-frame


Testing status

Added two tests
c5d27f80-7b7c-11eb-9fb6-35e87c47cf1f

  • DirectLinkMix : Simulates several constant rate through simple code
  • DirectLinkRLE : SendEvent multiple event per frame drawing the content (there are 408 "chunk" in this image it leads to 20 SendEvent per frame)

@unity/gfx-qa-vfx This change can't really be tested without a test script, you can be inspired by these two ⬆️
However, there is one way of testing without script : the default spawnCount is now "1.0f"
a50d2880-7b82-11eb-9539-159afa96fed4


Comments to reviewers

First QA pass has been already be done in internal repository : See this report from @VitaSkruibyte


About side fixes (I will prepare an independent backport PR if needed)

⚠️ This PR also include this one : https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/160 (I changed the base to reduce file change) because I need to have a way to override the default spawnCount from 0.0f to 1.0f. See this change
Sum up here ⬇️

Purpose of this PR :

  1. Fix unexpected spawn context order of execution when graph isn't balanced
    image
  2. Add explicit access of spawnCount, it prevents workaround or custom spawner (see also this document)

Relative to these changes :

  • Remove GetSpawnCount.cs and replace this by an explicit "Get Source Spawn Count".
  • Remove some hacks (and also dead code, see FillEventAttributeDescs), since spawnCount can be directly used.
  • Manual test for sanitize of GetSpawnCount (which can now explicitly be accessed)
  • Add editor test to check the behavior of previously incorrect CollectContextParentRecursively (at dda2404)
  • Debug manually content for Graphic Test using chaining
  • 20_SpawerChaining has been impacted : Both ordering are actually correct but since we are using random in spawnContext, it change a bit the rendering ⬇️
    Before
    image
    After
    image
  • 009_ReadAttribute is impacted, there was an untracked mistake on this one : the "debug" information was one frame behind (here represented by a green square, it's a kind of cursor) :
    image

julienf-unity and others added 30 commits October 20, 2020 17:16
* Fix missing doc & Deprecate VFXViewModicationProcessor

Unexpected public API

* *Revert unexpected change

* Fix several issue from @LewisJordan

- fix issue https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/143#discussion_r79397
- fix issue https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/143#discussion_r79398
* Fix case 1274790 : Use DestroyImmediate when editor isn't playing

* Fix case 1247230 : Avoid null exposed property

Property entry is modified by UX always not null, however, it requires a default value

* Fix case 1274788 : Missing null check in Hierarchy to Attribute Map

* Fix case 1248711 : Property window view wasn't working

Missing Update, it also fixes Undo/Redo

* *Update changelog

* Fix compilation when ENABLE_LEGACY_INPUT_MANAGER isn't enabled

Should be fix for 10.2

* Fix case 1279471 : Avoid OnMouseDown/Up/... declaration

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices." when building for Android/IOS
* Base refactor + Attempt to get position from AABox (not working for thickness ATM)

* Fixed cone syntax issues + correct computation of AABox direction

* Added Variant providers + Composition in Sequential

* Updated Variants for Shape Sequential Blocks

* Harmonized Namings + added composition to Position Depth

* Updated Changelog

* Fixes for PR

* Fixed Blend Composition in Sequential

* Added Direction to PositionSequential

* Fixes in Position Circle / Set Blend factor in shapes to 1.0 by default

* Used Absolute Box size as expression

* Propal for https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/44/files/e029bb9ec37555e70af21a97399774667030c031#r61533

Use case by case approach for direction of AABox

* *Temp add test data for graphicTest

* Fix ApplyAddressingMode : clamp & mirror was overflowing, mirror has also a wrong pattern

* Edit graphicTest

* Move 014 to common package

* Add 014_PositionBlock in editor test listing

* Precompute line_direction in PositionLine

Fix issue https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/44/files#r67908

* *Add reference images

* Fix editor test (wrong reference data)

* Fix issue introduced at 9c54056 : Looping correctly the circle

See also : https://unity.slack.com/archives/G1BTWN88Z/p1598508170069200?thread_ts=1598429838.039200&cid=G1BTWN88Z

* Probably uploaded the wrong image reference for standalone

* *Update reference images (I think I mess up twice, I should double check the change in motionVector)

* Fix build (VFXExpressionCondition now supports uint)

* *Temp* Delete motion vector reference image, should regenerate them from yamato.

* Readd reference image using yamato result at b9a04b7

* *Update changelog

Fix issue : https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/44#discussion_r70582

* Fix PositionTorus when used in vertex shader

* Fix multiple definition of UNITY_PI

* Fix changelog

bad automatic merge

* Fix incorrect volume

Base radius while computing volume factor on sphere & circle : use fix approach from https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/89 using name instead of index
See : https://github.cds.internal.unity3d.com/unity/vfx-graphics/pull/44#issuecomment-28990 & https://docs.google.com/document/d/1RAVkfmMQA9D_hKkJyt6PKOgRs8JHkjlYRhcfBtIU1Ag/edit?disco=AAAAJ7Z4S18

Co-authored-by: Thomas ICHÉ <peeweek@gmail.com>
Co-authored-by: Paul Demeulenaere <pauld@unity3d.com>
Co-authored-by: Julien Fryer <julienf@unity3d.com>
…eturn proper values (#141)

* Update VFXShaderGraphParticleOutput.cs

* Update CHANGELOG.md

Co-authored-by: Julien Fryer <julienf@unity3d.com>
* Diffusion profile has PropertyType.Float but isn't castable in Vector1ShaderProperty : safeprof code

* Unity serialization produced a beast with object.ReferenceEquals(null) != 0 and instanceID == 0 foolProof code for this

* Update CHANGELOG.md
* Prevent exceptions from making notification stay. Prevent exception in errors to potential break the ui

* Prevent list from being badly deserialized.
* Add missing filter in CanLink function

* Add editor test

* *Update changelog.md

* *Update comment

* *Update Comment
* Vfx/feature/strips improvements (#265)

* Add spanwIndexInStrip attribute

* Fix particleCountInStrip in Init

* Add OrientStrip block

* Remove some useless code

* Add From Target Position mode in Orient Strip

* Update changelog

* Fix SpawnOverDistance

* Fix reference images

* Fix changelog

* Merge Orient and OrientStrip blocks

* Remove FaceCameraPlane from strips

* Sanitize quad strip orientation

* Update VFX

* Update changelog

* Add error feedback

* Use IsPerspectiveProjection

* Fix GetStripTangent for lines

* Add subpixel AA to head and trails template system

* Add strip variant for intialize in menu

* Fix for errors not appearing after convert output

* Update graph version

* Fix ribbon VFX

* Fix spawnIndexInStrip (tooltip + init)

* Fix issue with inspector not triggering OnSettingChanged

* Check that a converted output could keep the same flow links.

Co-authored-by: Tristan Genevet <tristan@unity3d.com>
* Updated Changelog

* Updated Blocks with Fixes and Missing Workflows

* update VFX additions

Co-authored-by: Thomas Iché <peeweek@gmail.com>
…put Particle Mesh / Connected Attributes (#139)

* Reindex the TEXCOORD[n]

* Update CHANGELOG.md

Co-authored-by: Julien Fryer <julienf@unity3d.com>
julienf-unity and others added 9 commits March 25, 2021 16:13
- Need to reference SystemHasDirectLink (could be determined another statically in C++ but it's simpler and faster this way)
- Remove need of readsource
- Remove GenerateComputeSourceIndex
- Force add spawnCount in globalAttribute : it isn't an implicit need anymore
# Conflicts:
#	TestProjects/VisualEffectGraph_HDRP/ProjectSettings/EditorBuildSettings.asset
#	TestProjects/VisualEffectGraph_URP/ProjectSettings/EditorBuildSettings.asset
#	com.unity.visualeffectgraph/CHANGELOG.md
#	com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs
Copy link
Collaborator

@julienf-unity julienf-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the indexInSystem could be removed and simplify a lot. Here the way it is done makes supposely immutable data to be written to + it's error prone as some typos are apparently here

... but actually, we can't identify spawn context by VFXData (see the following commit)
This method is really specific to VFXDataParticle, it doesn't require any abstraction.
@PaulDemeulenaere
Copy link
Contributor Author

About the removal of indexInSystemDesc, it has been done by these two changes :

  • 3709c18 : Using VFXData as unique identifier
  • 5854147 : Using VFXContext as unique identifier (VFXData is shared amond chained spawn context)

Tested editor & playmode test.

Copy link

@VitaVFX VitaVFX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, found one insignificant issue but this can be looked into after the feature cut off. Here's the test doc

Missing change from revision : aa85881
# Conflicts:
#	com.unity.visualeffectgraph/CHANGELOG.md
#	com.unity.visualeffectgraph/Editor/Data/VFXDataParticle.cs
@PaulDemeulenaere
Copy link
Contributor Author

PaulDemeulenaere commented May 17, 2021

All nightly VFX verification are 🟢 at this revision : c71c695
Awaiting for the formatting job before merging ⏳

@PaulDemeulenaere PaulDemeulenaere marked this pull request as ready for review May 17, 2021 11:28
@PaulDemeulenaere PaulDemeulenaere merged commit 405f572 into master May 17, 2021
@PaulDemeulenaere PaulDemeulenaere deleted the vfx/fix/multiple-event-per-frame branch May 17, 2021 11:57
PaulDemeulenaere added a commit that referenced this pull request Sep 29, 2021
PaulDemeulenaere added a commit that referenced this pull request Oct 18, 2021
* Fix incorrect condition for GPUEvent

Mistake introduced at #4457

* *Add some editorTest

* Add some test to covers corners case

See https://unity.slack.com/archives/G1BTWN88Z/p1632919330247400

* *WIP* Improve incorrect connection handling

* Fix multiple type in output of initialize part

* Fix Update to Update which is actually allowed

* *Update changelog.md

* Fix missing case for VFX.Update tyep

* Rename confusing "primaryType"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants