Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feature Request Visual preview of graphs in forums and web

Discussion in 'Shader Graph' started by andrzej_, Apr 9, 2019.

  1. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    I'd like to propose a forum feature that could be expanded to other web content (blogs, tutorial pages, Unity connect .. ) that would allow a graphical representation of the shader graph 'code'.
    If you select and copy any part of the graph in shader graph you already get a formated piece of 'code'
    something like:

    Code (Boo):
    1. _DisplayName\\\": \\\"Occlusion\\\",\\n    \\\"m_SlotType\\\": 0,\\n    \\\"m_Priority\\\": 2147483647,\\n    \\\"m_Hidden\\\": false,\\n    \\\"m_ShaderOutputName\\\": \\\"Occlusion\\\",\\n    \\\"m_StageCapability\\\": 2,\\n    \\\"m_Value\\\": 1.0,\\n    \\\"m_DefaultValue\\\": 1.0,\\n    \\\"m_Labels\\\": [\\n        \\\"X\\\"\\n    ]\\n}\"\n        },\n        {\n            \"typeInfo\": {\n                \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n            },\n            \"JSONnodeData\": \"{\\n    \\\"m_Id\\\": 7,\\n    \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n    \\\"m_SlotType\\\": 0,\\n    \\\"m_Priority\\\": 2147483647,\\n    \\\"m_Hidden\\\": false,\\n    \\\"m_ShaderOutputName\\\":  
    But this isn't readable obviously, so posting this when asking for help, or sharing tips with others wouldn't make sense. On the other hand a screen shot of your graph clear to read, but recreating it inside Unity takes a lot of time and is prone to errors. If we could have the option to paste a special snippet of the 'shader graph ' code that would get 'rendered' into the visual representation of the shader graph, but at the same time retain the code and allow to copy it, that would make sharing of resources and knowledge much easier.

    'code' -> graph image -> 'code'

    This could be expanded to other graphs, like visual effects graph and visual scripting which I understand is on the road map as well.
     
    pauliusuza likes this.
  2. pauliusuza

    pauliusuza

    Joined:
    Nov 1, 2016
    Posts:
    7
    This could be implemented by community as an opensource Javascript based parser.
     
    andrzej_ likes this.
  3. Kink3d

    Kink3d

    Unity Technologies

    Joined:
    Nov 16, 2015
    Posts:
    45
    This is a cool idea, but I'm afraid we really don't have resources available to work on something like this. Be aware also that the data model for the different graphs (Shader Graph/VFX/etc) have almost nothing in common (the core serialization model is different) so this would be almost impossible to implement in a way where it works for all graphs. :(
     
  4. 479813005

    479813005

    Joined:
    Mar 18, 2015
    Posts:
    58
    When we implement it, we will further require support for preview nodes, carrying textures, and so on. In the end, our return will be significantly lower than our work. Maybe we just want ShaderGraph to support exporting images.
     
  5. andrzej_

    andrzej_

    Joined:
    Dec 2, 2016
    Posts:
    81
    'Community' project is an option, but I would be worried about the long term support with a feature that is changing constantly.
    @Kink3d
    This is a naive question, but how complicated is the part of the editor that does the graph 'rendering'. Is it something that could potentially be run on a server, or locally in a browser?
    I do hope that sooner or later this happens one way or the other :)