Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Convert shader code to shader graph for curved world

Discussion in 'Shaders' started by ShottaPanda, Nov 8, 2018.

  1. ShottaPanda

    ShottaPanda

    Joined:
    Jul 26, 2017
    Posts:
    1
    Hello everybody,

    I'm trying to make a curved world with shader graph and I found on internet a shader script which works very well with my objects. But I'm a newbie in shader and shader graph helps me to have a good graphic feelings.



    Thus, I would like to know how can I convert this simple shader code in shader graph :

    void vert(inout appdata_full v) {
    v.vertex = mul(unity_ObjectToWorld, v.vertex);
    float dist = distance(_WorldSpaceCameraPos, v.vertex);
    v.vertex.y -= pow(dist, _Curvature) * _Trimming / 100;
    v.vertex = mul(unity_WorldToObject, v.vertex);
    }

    with _Curvature and _Trimming are two properties.

    I tried to convert this code into nodes but I totally failed.

    Someone can help me ??

    Thank you.

    Best regards,

    ShottaPanda