Using the UVFunc node
In this recipe, we use the UVFunc node with the Texture2D node to scale and pan the icon.svg
picture using visual shaders.
Getting ready
For this recipe, click + to the right of the Billboard scene we just completed to add a new scene. In the Scene tab, click 2D Scene. Click on Scene in the top-left corner next to Project, then select Save Scene As, and name it UVFunc
.
How to do it…
We will move the icon.svg
file into the scene and then add a ShaderMaterial in the CanvasItem property:
- Left-click and hold the left mouse button, then drag
icon.svg
anywhere in the viewport. - In the CanvasItem section of the Inspector, left-click on Material.
- Click on <empty> to the right of Material and select New ShaderMaterial.
- Left-click on ShaderMaterial to the right of Material.
- Click on <empty> to the right of Shader and select New Shader.
- To the right of Type, select Visual Shader.
- To the right of Mode, select...