勾配の強弱を考えず、勾配の方向のみを可視化する
float dx = tex(0,0) - tex(1,0);//x方向の勾配ベクトル float dy = tex(0,0) - tex(0,1);//y方向の勾配ベクトル float rad = atan(dy,dx);//勾配の方向(ラジアン) float red = 0.5 + 0.5*cos(rad); float green = 0.5 + 0.5*sin(rad); float blue =1.0;
勾配の強弱を考えず、勾配の方向のみを可視化する
float dx = tex(0,0) - tex(1,0);//x方向の勾配ベクトル float dy = tex(0,0) - tex(0,1);//y方向の勾配ベクトル float rad = atan(dy,dx);//勾配の方向(ラジアン) float red = 0.5 + 0.5*cos(rad); float green = 0.5 + 0.5*sin(rad); float blue =1.0;