Search Unity

[Shader Graph] - Creating a custom node based on 3d noise

Discussion in 'Scripting' started by Artikodin93, May 10, 2019.

  1. Artikodin93

    Artikodin93

    Joined:
    May 10, 2019
    Posts:
    1
    Hi guys,

    For a project I needed to realise a blob to do that I use Unity's Shader graph feature. I apply a random ( actually 2d noise ) transformation on vertex position. Everything work correctly but I've got a mirror effect on my blob due to 2d noise.

    Not a big deal, I just need to replace it by a 3d noise but there is no 3d noise node in Shader graph. I've decided to create a custom one. I read documentation about custom node and I decided to use this 3d noise into my custom node.

    I copy / paste the 3d noise into that method :

    Code (CSharp):
    1.  
    2. static string MyCustomFunction(
    3.         [Slot(0, Binding.None)] DynamicDimensionVector A,
    4.         [Slot(1, Binding.None)] DynamicDimensionVector B,
    5.         [Slot(2, Binding.None)] out DynamicDimensionVector Out)
    6.     {
    7.         return @"
    8.        {
    9.            // Here is where I copy / pasted the code <----------
    10.        }
    11.        ";
    12.     }
    13.  
    Obviously that didn't work.

    I've realised I can't declare functions in this return so I tried to split the 3d noise code but without success. I check the custom node doc and I didn't find any complex exemple -Just some easy exemple like how to add two input together-.

    If someone know where I can find further example / documentation about custom node in shader graph I will be thankful.