Help using vertex offset

Your feedback is very important to us. We are listening.

Help using vertex offset

Postby noeinz » Wed Jan 09, 2019 3:07 pm

Hello Amplify,

I have a shader here that is supposed to collapse towards a reference point, like a worm hole. So far I have the vertex offset pulling towards the point properly and the collapse happens but the numbers go beyond 1 and it starts inverting the collapse of the mesh. I cannot figure out how to collapse towards the object and stay collapsed without inverting.

Here is my node setup

Image

Image

I am trying to recreate this shader from this post:
https://deepspacebanana.github.io/deeps ... der-Effect

Image
noeinz
 
Posts: 2
Joined: Wed Jan 09, 2019 2:52 pm

Re: Help using vertex offset

Postby Amplify_Borba » Thu Jan 10, 2019 10:18 am

Hello, thank you for getting in touch and for your support!

The example you posted roughly translates to this:

Image

The float values will have to be tweaked specifically for Unity, and the _Position global variable is receiving the transform position of the orbiting sphere through a script that is attached to it:

Code: Select all
[ExecuteInEditMode]
public class Test : MonoBehaviour
{
    public Renderer Renderer = null;

    private Material m_instancedMaterial;
    private Material InstancedMaterial
    {
        get { return m_instancedMaterial; }
        set { m_instancedMaterial = value; }
    }

    private void Awake()
    {
        InstancedMaterial = Renderer.material;
    }

    // Update is called once per frame
    void Update()
    {
        InstancedMaterial.SetVector("_Position", transform.position);
    }
}


On the Renderer parameter in the inspector of this script you'll have to drag the other sphere, which has the shader assigned to it.

Image

Please let me know if this helps!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Help using vertex offset

Postby noeinz » Thu Jan 10, 2019 2:11 pm

Thank you so much. It works! :mrgreen:

I feel like I had this answer but I missed some combination in my setup. Maybe I had the nodes hooked up wrong in the lerp.
noeinz
 
Posts: 2
Joined: Wed Jan 09, 2019 2:52 pm

Re: Help using vertex offset

Postby Amplify_Borba » Thu Jan 10, 2019 3:56 pm

No worries, glad I was able to help!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, every bit helps and your feedback is extremely valuable to us.

Feel free to get back in touch if you have further issues or questions, thanks!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests