Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Demo 62 - Pseudo Random

tonynogo Jul 6th, 2017 1,817 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. Shader "Custom/Noise/PseudoRandom"
  2. {
  3.     Properties
  4.     {
  5.         _Factor1 ("Factor 1", float) = 1
  6.         _Factor2 ("Factor 2", float) = 1
  7.         _Factor3 ("Factor 3", float) = 1
  8.     }
  9.  
  10.     SubShader
  11.     {
  12.         Tags { "RenderType"="Opaque" }
  13.  
  14.         Pass
  15.         {
  16.             CGPROGRAM
  17.             #pragma vertex vert_img
  18.             #pragma fragment frag
  19.            
  20.             #include "UnityCG.cginc"
  21.            
  22.             float _Factor1;
  23.             float _Factor2;
  24.             float _Factor3;
  25.  
  26.             float noise(half2 uv)
  27.             {
  28.                 return frac(sin(dot(uv, float2(_Factor1, _Factor2))) * _Factor3);
  29.             }
  30.  
  31.             fixed4 frag (v2f_img i) : SV_Target
  32.             {
  33.                 fixed4 col = noise(i.uv);
  34.                 return col;
  35.             }
  36.             ENDCG
  37.         }
  38.     }
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top