Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Is there anyway to convert the .shadergraph file in HDRP to code file like .hlsl?

Discussion in 'High Definition Render Pipeline' started by Middle-earth, Oct 9, 2023.

  1. Middle-earth

    Middle-earth

    Joined:
    Jan 23, 2018
    Posts:
    76
    I just begin to learn HDRP.When looking over the shader in HDRP package,I don't get used to the nodes in shadergraph,and I prefer to writing code like hlsl in URP.
     
  2. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    751
    If you'd rather write code instead of using the SG node, you can attach a hlsl file with function in the custom node in the shader graph.
    If you meant writing your own shader from scracth in HDRP without using shader graph, it's not impossible, but it's clearly not recommanded as it requires an extensive knowledge of HDRP pipeline and shaders.
     
  3. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    309
    I know this isn't answering your question... but you are far better off learning the nodes and becoming efficient with shader graph, than to embark on a path of hand-written shaders... this will be infinitely more complex to write and maintain over time.
     
    chap-unity likes this.
  4. OlavAketun

    OlavAketun

    Joined:
    Aug 4, 2021
    Posts:
    44
    Here's a thread about writing custom shaders.
    https://forum.unity.com/threads/hdrp-custom-shaders-examples.678931/

    As for the question of taking a shadergraph "shader" and converting that to hlsl, it's not impossible but impractical.
    But what you can do is get something like Amplify Shader Editor as it compiles to regular shader files.