ワタタク今回の記事の目的はProcessingの「directionalLight()関数」を理解し、自分なりに使ってみること。
目次
【Processing】directionalLight()関数について
directionalLight()関数について
directionalLight()は「方向性のある光」という意味directionalLight()関数は、3Dシーンで特定の方向から光を当てるために使う- 太陽の光のように、特定の方向から一様に照らす光
【Processing】directionalLight()関数の主な書き方【構文】
以下のように書きます。
directionalLight(色の赤成分, 色の緑成分, 色の青成分, 光の方向X, 光の方向Y, 光の方向Z);【Processing】directionalLight()関数の使い方【画像とコード】
xを1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 1, 0, 0);
translate(200, 200, 0);
sphere(120);xを-1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, -1, 0, 0);
translate(200, 200, 0);
sphere(120);
save("2.jpg");yを1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 0, 1, 0);
translate(200, 200, 0);
sphere(120);yを-1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 0, -1, 0);
translate(200, 200, 0);
sphere(120);zを1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 0, 0, 1);
translate(200, 200, 0);
sphere(120);zを-1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 0, 0, -1);
translate(200, 200, 0);
sphere(120);yを1, zを1に設定


size(400, 400, P3D);
background(0);
noStroke();
directionalLight(255, 165, 0, 0, 1, 1);
translate(200, 200, 0);
sphere(120);【Processing】directionalLight()関数はどんな表現で使えそうか
月とか太陽とかの表現で使える。
【Processing】directionalLight()関数を使ってみた感想
今回の記事のdirectionalLight()関数で、yを1, zを1に設定して描かれた月みたいなのが好きですね。



それでは今日もレッツワクワクコーディング。

