Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type spatial;
- float height_at(float x, float z, float time) {
- float height = sin(0.25*x-time*0.75);
- return height + 1.0;
- }
- vec3 normal_at(float x, float z, float time) {
- float u = 0.01;
- float left = height_at(x - u, z, time);
- float right = height_at(x + u, z, time);
- float back = height_at(x, z - u, time);
- float fore = height_at(x, z + u, time);
- vec3 n = normalize(vec3(left - right, 2.0, back - fore));
- return n;
- }
- void vertex() {
- NORMAL = normal_at(VERTEX.x, VERTEX.z, TIME);
- VERTEX.y = height_at(VERTEX.x, VERTEX.z, TIME);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement