Advertisement
IRCSS

Fake3DPerlinNoiseSample

Dec 20th, 2018
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. // Samples a Noise function 3 time to fake a noise based on 3 dimensional.
  2. // BaseNoise Parmeter: xy are the panning speed of the first two noise sampleing along their uv. z is the tiling of the two sampels
  3. // timeDistorParameter: x is the tiling of the time distortion sampeling and y is the speed of switching between first sampeling and second samepling
  4. float Sampelfake3DNoise(const sampler2D noiseTexture, const float3 BaseNoiseParmeter, const float2 timeDistorParameter, const float2 uv) {
  5. float n1 = tex2D(noiseTexture, uv *BaseNoiseParmeter.z + _Time.yy *BaseNoiseParmeter.xy);
  6. float n2 = tex2D(noiseTexture, uv *BaseNoiseParmeter.z + float2(0.5, 0.5) + _Time.yy *BaseNoiseParmeter.xy);
  7. float timeDistoration = tex2D(noiseTexture, uv.xy *timeDistorParameter.xx);
  8. float t_v = abs(frac(_Time.y*timeDistorParameter.y + timeDistoration * 2. - 1.)*2. - 1.);
  9. return lerp(n1, n2, t_v);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement