Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Convert shader code to shader graph for curved world

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

  1. ShottaPanda


    Jul 26, 2017
    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,