- Home /
Easy way to make a custom toon water shader
Hey all, Is there an easy way to make a custom (toon) water shader?
What do you mean by "toon water" shader? Do you mean something like this? Water
Answer by MrRandomFella · Apr 07, 2014 at 12:56 AM
Alrighty then! Here's how I made a pretty similar effect in Unity:
Step 1: create a plane, re-size it to whatever you want. (or use a mesh/gameobject)
Step 2: assign your water texture to the plane Example (Make the material "Unlit/Texture")
Step 3: tile the texture a bit (til you're happy with it) and add this script:
using UnityEngine;
using System.Collections;
public class AnimatedUVs : MonoBehaviour
{
public int materialIndex = 0;
public Vector2 uvAnimationRate = new Vector2( 1.0f, 0.0f );
public string textureName = "_MainTex";
Vector2 uvOffset = Vector2.zero;
void LateUpdate()
{
uvOffset += ( uvAnimationRate * Time.deltaTime );
if( renderer.enabled )
{
renderer.materials[ materialIndex ].SetTextureOffset( textureName, uvOffset );
}
}
}
Step 4: set the animation of the texture to "0.05" in any direction you want (It will roll smoothly)
If you want the mesh to deform into waves, then you might want to look into noise deformation to deform the plane.
So, this is as close as I can get to the wind waker water effects. I hope it helps! :D
Thanks! Works great! I was having performance issues, the normal water shaders were interfering with my other toon shaders, so this is a perfect solution. Can I use that image in my game (I intend to sell it eventually)? If not thats cool, I'll make up my own.
Your answer
Follow this Question
Related Questions
Water on a non-planar mesh 0 Answers
Using custom tree shaders? 1 Answer
Silhouette Toon Shader 0 Answers
Water4 with Refraction 0 Answers
Unity - Simple Water 3 Answers