Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. float noise( float3 x )
  2. {
  3. // The noise function returns a value in the range -1.0f -> 1.0f
  4.  
  5. float3 p = floor(x);
  6. float3 f = frac(x);
  7.  
  8. f = f*f*(3.0-2.0*f);
  9. float n = p.x + p.y*57.0 + 113.0*p.z;
  10.  
  11. return lerp(lerp(lerp( hash(n+0.0), hash(n+1.0),f.x),
  12. lerp( hash(n+57.0), hash(n+58.0),f.x),f.y),
  13. lerp(lerp( hash(n+113.0), hash(n+114.0),f.x),
  14. lerp( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement