Skip to content

[Shadergraph] Master Stacks [Skip CI] #571

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 1,955 commits into from
Jun 8, 2020
Merged

Conversation

elizabeth-legros
Copy link
Contributor

alt text

Purpose of this PR

Problem

Currently, the master node definition is too rigid and defined via leaky abstractions. This gives the the following problems:

  • Large list of individual master nodes. Changing master node means reconnecting all edges.
  • Many HDRP features require HDRP specific master nodes. This prevents the shader from compiling in URP.
  • Users cannot define new master nodes without internal Shader Graph access.
  • Ports from different stages are mixed into the same master node, this is confusing for users.

There are other problems involved but these are the main concerns because they seriously inhibit our ability to open up our API to customers (internal right now, external later). As Shader Graph adoption grows, this problem continues to get worse.

Solution

We propose a solution where, instead of providing a collection of master nodes, we provide a single, extensible stack. Users will enable and disable shader features, per render pipeline, in the Inspector. These features provide input ports on the stack, where the user then connects graph edges to provide data for those features. Different render pipelines then build a shader using the input data they support, based on the pipeline configuration. This ensures all features are available, but the shader is always in a valid state.

Goals

  • All features available from any render pipeline, still compiles on all render pipelines by ignoring unsupported features.
  • UX concepts applied meaningfully, and in line with other graph products.
  • Extensible design language for future feature work

What do these mean in practice?

  • No more master node explosion, all features should be available from one stack
  • All HDRP features must be available, and this shader should always have a fallback on URP
  • Better parity with VFX and VS, using the same visual language as their stack implementations
  • Better visual distinction between vertex and fragment stages.
  • Lay the foundations for…
    • Custom interpolators
    • Public “master node API”
    • Layering/custom passes

TODO

  • Fix remaining red tests
  • Fix known issues
  • Add new tests (edit/graphics)
  • Test for performance regressions in graph
  • Add changelog entries

Testing status

PR Template:

  • Opened test project + Run graphic tests locally
  • Built a player
  • Checked new UI names with UX convention
  • Tested UI multi-edition + Undo/Redo + Prefab overrides + Alignment in Preset
  • C# and shader warnings (supress shader cache to see them)

General Graph usage

  • Fill this out...

Upgrade Tests:

  • Upgrading V0 > V2
  • Upgrading V1 > V2
  • All master nodes
    • Various ports connected
    • Various settings enabled
    • Ports that require settings and connected
    • Default port values changed
  • PBR specular/metallic (only add one block)
  • Alpha clip upgraded from slot logic > bool (PBR/Unlit)
    • Alpha clip value changed
    • Alpha clip connected
  • Multiple master nodes
  • Master position > Context position
  • Sprite masters result in SpriteColor block (legacy)
    • If BaseColor or Alpha are added SpriteColor is ignored
    • SpriteColor cannot be readded
  • AxF shaders in URP package
  • Upgrading VFX SGs used in VFX graphs

Automated Tests:

  • To add. See TODO checklist.

Any test projects to go with this to help reviewers?
Upgrade graphs can be found at https://easyupload.io/rbhlsn (pw: unity)

Test document:
https://docs.google.com/document/d/1O_wnqsQ8zsnsl-QJ83byZJbLk5O8Od740LRASyj_VP0/edit?usp=sharing

Comments to reviewers

Kink3d and others added 30 commits April 22, 2020 10:34
* Refresh widgets in play mode. Added doc. Reduced refresh rate

* Changelog

* Added some code doc

* Fix refresh rate and scroll over hidden volumes in play mode

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
# Conflicts:
#	com.unity.shadergraph/Editor/Drawing/MaterialGraphEditWindow.cs
#	com.unity.shadergraph/Editor/Drawing/PreviewManager.cs
#	com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs
… error (case 1238155) (#215)

* fix bug 1238155

* Update CHANGELOG.md

* Update HDRenderPipeline.cs

* Update HDRenderPipelineAsset.cs
sebastienlagarde and others added 15 commits June 1, 2020 01:04
… CI] (#685)

* Fix upgrade of unlit and PBR master node

* Update MaterialPostProcessor.cs

* Update MaterialPostProcessor.cs

* Update MaterialPostProcessor.cs

* Apply upgrade only when metadata say it

* Fix issue with material upgrade process

* Update UniversalTarget.cs
* Added clear coat setting in HD Lit target

* Rename coatmask to clearcoat

* Remove "Enable" in front of clear coat setting
…#703)

* Add  protection in migration when rendering pass was set to background

* Fix rendering pass migration for unlit

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
@cinight cinight self-requested a review June 3, 2020 09:35
Copy link
Contributor

@TomasKiniulis TomasKiniulis left a comment

Choose a reason for hiding this comment

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

Posting feedback here to wrap up findings on HDRP side.
Some cases with “Requesting non existent keyword” exceptions pop up:

Use Shadow Threshold and Alpha To Mask options are not grouped with Alpha Clipping, meaning options are always present instead of popping up when enabling Alpha Clipping, which was the behaviour before. Mentioned here: https://docs.google.com/document/d/1O_wnqsQ8zsnsl-QJ83byZJbLk5O8Od740LRASyj_VP0/edit#heading=h.ahmv0fr71bp0

Similar case with StackLit material type where Anisotropy is not indented and does not appear as part of Material Core Features section, but instead it seems that Anisotropy related with the rest of core features
https://docs.google.com/document/d/1O_wnqsQ8zsnsl-QJ83byZJbLk5O8Od740LRASyj_VP0/edit#heading=h.d1b8k0nympxn

Some other UI issues:

@sebastienlagarde sebastienlagarde merged commit d726c50 into 9.x.x/release Jun 8, 2020
@sebastienlagarde sebastienlagarde deleted the sg/master-stack branch June 8, 2020 23:39
@sebastienlagarde sebastienlagarde restored the sg/master-stack branch June 9, 2020 12:53
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.