Advertisement
TheNosiriN

Mountain without noise function

Feb 9th, 2021
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float mountain(vec3 x)
  2. {
  3.     vec2 p = x.xz * 0.05;
  4.     float t = 0.0, a = 1.0;
  5.     float dist = smoothstep(0.9, 1.0, 1.0-(length(p)-0.1));
  6.     for (int i=0; i<3; i++){
  7.         float n = (textureLod(iChannel0, p, 0.0).r);
  8.         t += mix(n, dist+n, dist) * a;
  9.         p = mat2(0.8,-0.6,0.6,0.8)*p*2.0+dist*0.3;
  10.         a *= 0.5;
  11.     }
  12.     return max(length(x)-5.0, x.y-t);
  13. }
  14. //link to texture: https://cdn.discordapp.com/attachments/658085531397128207/808748224227573850/8979352a182bde7c3c651ba2b2f4e0615de819585cc37b7175bcefbca15a6683.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement