Mermaid graphing util for ShaderGraphs.#2790
Open
kwokcb wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
Open
Mermaid graphing util for ShaderGraphs.#2790kwokcb wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
kwokcb wants to merge 2 commits intoAcademySoftwareFoundation:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Utility Proposal
The graphs produced by shader generation are hard to debug / visualize as they are using a different data model.
The proposed change here is to be able to create a graph diagram using a
ShaderGraphfor aShader.In this case it will produce a Mermaid graph which can be viewed in various containers such as Markdown and HTML.
Modifications
ShaderGraph.Shaderclass asShaderGraphis hidden.Shaderlevel.generateshader.py.Tests
Sample Results
( Markdown wrappers are added as part of
generateshader.py)e.g. Velvet (no input expansion)
graph LR geomprop_Nworld["geomprop_Nworld"] geomprop_Tworld["geomprop_Tworld"] SR_velvet["SR_velvet"] Velvet["Velvet"] geomprop_Nworld --"out --> coat_normal"--> SR_velvet geomprop_Nworld --"out --> normal"--> SR_velvet geomprop_Nworld/space["space = 2"] --> geomprop_Nworld geomprop_Tworld --"out --> tangent"--> SR_velvet geomprop_Tworld/space["space = 2"] --> geomprop_Tworld geomprop_Tworld/index["index = 0"] --> geomprop_Tworld SR_velvet --"out --> surfaceshader"--> Velvet Velvet --"out --> out"--> Velvete.g. Tiled Brass (input expansion)
graph LR geomprop_Nworld["geomprop_Nworld"] geomprop_Tworld["geomprop_Tworld"] geomprop_UV0["geomprop_UV0"] NG_brass1/image_roughness["NG_brass1/image_roughness"] NG_brass1/image_color["NG_brass1/image_color"] SR_brass1["SR_brass1"] Tiled_Brass["Tiled_Brass"] geomprop_Nworld --"out --> coat_normal"--> SR_brass1 geomprop_Nworld --"out --> normal"--> SR_brass1 geomprop_Nworld/space["space = 2"] --> geomprop_Nworld geomprop_Tworld --"out --> tangent"--> SR_brass1 geomprop_Tworld/space["space = 2"] --> geomprop_Tworld geomprop_Tworld/index["index = 0"] --> geomprop_Tworld geomprop_UV0 --"out --> texcoord"--> NG_brass1/image_roughness geomprop_UV0 --"out --> texcoord"--> NG_brass1/image_color geomprop_UV0/index["index = 0"] --> geomprop_UV0 NG_brass1/image_roughness --"out --> specular_roughness"--> SR_brass1 NG_brass1/image_roughness --"out --> coat_roughness"--> SR_brass1 NG_brass1/image_roughness/file["file = ../../../Images/brass_roughness.jpg"] --> NG_brass1/image_roughness NG_brass1/image_roughness/default["default = 0"] --> NG_brass1/image_roughness NG_brass1/image_roughness/uvtiling["uvtiling = 1, 1"] --> NG_brass1/image_roughness NG_brass1/image_roughness/uvoffset["uvoffset = 0, 0"] --> NG_brass1/image_roughness NG_brass1/image_roughness/realworldimagesize["realworldimagesize = 1, 1"] --> NG_brass1/image_roughness NG_brass1/image_roughness/realworldtilesize["realworldtilesize = 1, 1"] --> NG_brass1/image_roughness NG_brass1/image_roughness/filtertype["filtertype = 1"] --> NG_brass1/image_roughness NG_brass1/image_roughness/frameoffset["frameoffset = 0"] --> NG_brass1/image_roughness NG_brass1/image_roughness/frameendaction["frameendaction = 0"] --> NG_brass1/image_roughness NG_brass1/image_color --"out --> coat_color"--> SR_brass1 NG_brass1/image_color/file["file = ../../../Images/brass_color.jpg"] --> NG_brass1/image_color NG_brass1/image_color/default["default = 0, 0, 0"] --> NG_brass1/image_color NG_brass1/image_color/uvtiling["uvtiling = 1, 1"] --> NG_brass1/image_color NG_brass1/image_color/uvoffset["uvoffset = 0, 0"] --> NG_brass1/image_color NG_brass1/image_color/realworldimagesize["realworldimagesize = 1, 1"] --> NG_brass1/image_color NG_brass1/image_color/realworldtilesize["realworldtilesize = 1, 1"] --> NG_brass1/image_color NG_brass1/image_color/filtertype["filtertype = 1"] --> NG_brass1/image_color NG_brass1/image_color/frameoffset["frameoffset = 0"] --> NG_brass1/image_color NG_brass1/image_color/frameendaction["frameendaction = 0"] --> NG_brass1/image_color SR_brass1 --"out --> surfaceshader"--> Tiled_Brass SR_brass1/base["base = 1"] --> SR_brass1 SR_brass1/base_color["base_color = 1, 1, 1"] --> SR_brass1 SR_brass1/diffuse_roughness["diffuse_roughness = 0"] --> SR_brass1 SR_brass1/metalness["metalness = 1"] --> SR_brass1 SR_brass1/specular["specular = 0"] --> SR_brass1 SR_brass1/specular_color["specular_color = 1, 1, 1"] --> SR_brass1 SR_brass1/specular_roughness["specular_roughness = 0.2"] --> SR_brass1 SR_brass1/specular_IOR["specular_IOR = 1.5"] --> SR_brass1 SR_brass1/specular_anisotropy["specular_anisotropy = 0"] --> SR_brass1 SR_brass1/specular_rotation["specular_rotation = 0"] --> SR_brass1 SR_brass1/transmission["transmission = 0"] --> SR_brass1 SR_brass1/transmission_color["transmission_color = 1, 1, 1"] --> SR_brass1 SR_brass1/transmission_depth["transmission_depth = 0"] --> SR_brass1 SR_brass1/transmission_scatter["transmission_scatter = 0, 0, 0"] --> SR_brass1 SR_brass1/transmission_scatter_anisotropy["transmission_scatter_anisotropy = 0"] --> SR_brass1 SR_brass1/transmission_dispersion["transmission_dispersion = 0"] --> SR_brass1 SR_brass1/transmission_extra_roughness["transmission_extra_roughness = 0"] --> SR_brass1 SR_brass1/subsurface["subsurface = 0"] --> SR_brass1 SR_brass1/subsurface_color["subsurface_color = 1, 1, 1"] --> SR_brass1 SR_brass1/subsurface_radius["subsurface_radius = 1, 1, 1"] --> SR_brass1 SR_brass1/subsurface_scale["subsurface_scale = 1"] --> SR_brass1 SR_brass1/subsurface_anisotropy["subsurface_anisotropy = 0"] --> SR_brass1 SR_brass1/sheen["sheen = 0"] --> SR_brass1 SR_brass1/sheen_color["sheen_color = 1, 1, 1"] --> SR_brass1 SR_brass1/sheen_roughness["sheen_roughness = 0.3"] --> SR_brass1 SR_brass1/coat["coat = 1"] --> SR_brass1 SR_brass1/coat_color["coat_color = 1, 1, 1"] --> SR_brass1 SR_brass1/coat_roughness["coat_roughness = 0.1"] --> SR_brass1 SR_brass1/coat_anisotropy["coat_anisotropy = 0"] --> SR_brass1 SR_brass1/coat_rotation["coat_rotation = 0"] --> SR_brass1 SR_brass1/coat_IOR["coat_IOR = 1.5"] --> SR_brass1 SR_brass1/coat_affect_color["coat_affect_color = 0"] --> SR_brass1 SR_brass1/coat_affect_roughness["coat_affect_roughness = 0"] --> SR_brass1 SR_brass1/thin_film_thickness["thin_film_thickness = 0"] --> SR_brass1 SR_brass1/thin_film_IOR["thin_film_IOR = 1.5"] --> SR_brass1 SR_brass1/emission["emission = 0"] --> SR_brass1 SR_brass1/emission_color["emission_color = 1, 1, 1"] --> SR_brass1 SR_brass1/opacity["opacity = 1, 1, 1"] --> SR_brass1 SR_brass1/thin_walled["thin_walled = false"] --> SR_brass1 Tiled_Brass --"out --> out"--> Tiled_Brass