0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

SeExprプロシージャル生成入門 サンプルスクリプト20個

0
Last updated at Posted at 2026-02-07

SeExprのサンプルスクリプト

01.

$red=[1,0,0];
$green=[0,1,0];
$a=linearstep($u,0.4,0.4);
mix($red,$green,$a)

output.png

02.

$red=[1,0,0];
$blue=[0,0,1];
$a=linearstep($v,0.7,0.3);
mix($red,$blue,$a)

output2.png

03.

$p1 = 0;
$p2 = 1;
$p3 = 0.10121;
$p4 = 1;
$p5 = 0;
spline([$u,$v,0],$p1,$p1,$p2,$p3,$p4,$p5,$p5)

output3.png

04.

$red=[1,0,0];
$green=[0,1,0];
$blue=[0,0,1];
$fuzz=0.1;
$center=[0.5,0.5,0];
$here=[$u,$v,0];
$dist=length($center-$here);
$inDisk=1-smoothstep(0.25-$fuzz,0.25+$fuzz,$dist);
$Ct = (1-$inDisk) * $red + $inDisk *$blue;
$Ct

output4.png

05.

from Essential RenderMan. Thanks.

$repeatcount=6; #0, 100;
$ss=$u+noise([$u,$v,0]*5)*0.5;
$tt=$v+noise([$u,$v,0]*5+[100,100,100])*0.5;
ccellnoise([$ss*$repeatcount,$tt*$repeatcount,0])

output5.png

06.

Layering two effect,from Essential RenderMan. Thanks.

$red=[1,0,0];
$green=[0,1,0];
$blue=[0,0,1];
$fuzz=0.06557;
$fuzz2=0.03643;

$inTop=smoothstep(0.5-$fuzz,0.5+$fuzz,$v);
$Ct=mix($green,$red,$inTop);
$dist=abs($u-0.5);
$inLine=1-smoothstep(0.1-$fuzz2,0.1+$fuzz2,$dist);
mix($blue,$Ct,$inLine)

output6.png

07.

$val = curve($v,0,0,3,.5,1,3,1,0,3) * curve($u,0,0,3,.5,1,3,1,0,3);
[$val, $val, $val]

output7.png

08.

$amplitude = 11; #0,100
$kazu=16; # 1,100
$offset = 0;#-10,10
$colorA = [1,1,0];
$colorB=[0,0,0];
$x = $u;
$y = $v;
$Line=1/abs($x * $amplitude*sin($y*$kazu)/2+$offset);
invert($Line)*$colorB+$Line*$colorA

output8.png

09.

$colorA = [1,1,0];
$colorB=[1,0,0];
$takasa=4;#1,10
$kazu=15; # 1,120
$Line=sin($u*$kazu)/$takasa+.5>$v;
invert($Line)*$colorB+$Line*$colorA

output9.png

10.

$amplitude = 1; #0,100
$kazu=22; # 1,100
$takasa=2;#1,10
$offset = 6;#-10,10
$colorA = [1,1,0]; # 黄色
$colorB =[0,0,0] ; # 黒
$x = $u;
$y = $v;

# 1/ を削除し、条件の結果(0 or 1)をそのままマスクにする
$mask = ($amplitude * sin($y * $kazu) / $takasa + 0.1 * $offset > $x);

# mix関数を使用して、マスクが0ならcolorB、1ならcolorAを出力する
mix($colorB, $colorA, $mask)

output10.png

11.

$LineColor = [0,0,0.9];
$MixColor = [1,1,1];
$fuzz = 0.0087;
$LineSize = 0.07826;
$Orient=0;
$offset = 0.40435;

if(Orient==0){
     $dist = abs($v-$offset);
}
else{
     dist = abs($u-$offset);
}

$inTop = 1 - smoothstep($LineSize/2.0 - $fuzz, $LineSize/2.0+$fuzz, $dist);
mix($MixColor, $LineColor, 1-$inTop)

output11.png

12.

$red=[1,0,0];
$blue=[0,0,1];
$a=boxstep($v,1-$u);
mix($red,$blue,$a)

output12.png

13.

$ValueA=[0,1,0];
$layer_color=[1,1,0];
$repeatCount=3; #1,30
$ss=fmod($u*$repeatCount,1);
$tt=fmod($v*$repeatCount,1);

mix($ValueA,$layer_color,boxstep($ss,$tt))

output13.png

14.

$ValueA=[1,1,1];
$ValueB=[0,0,1];
$repeat=9; #1,30
$whichStripe=floor($u*$repeat);
mix($ValueA, $ValueB, fmod($whichStripe, 2))

output14.png

15.

$ValueA=[1,1,1];
$ValueB=[0,0,1];
$repeat=6; #1,30
$sTile=floor($u*$repeat);
$tTile=floor($v*$repeat);
$tiles=fmod($sTile+$tTile, 2);
mix($ValueA,$ValueB,$tiles)

output15.png

16.

$ValueA=[1,1,1];
$ValueB=[0,0,1];
$fuzz=0.093;
$repeat=4;
$radius=0.295;
$ss=fmod($u*$repeat,1);
$tt=fmod($v*$repeat,1);

$centre=[0.5,0.5,0];
$here=[$ss,$tt,0];
$dist=length($here-$centre);

$inDisk=smoothstep($radius-$fuzz,$radius+$fuzz,$dist);
mix($ValueA,$ValueB,$inDisk)

output16.png

17.

[vnoise($v),noise($v),noise($u)]

output17.png

18.

$P=[$u,$v,0];
$Cs=[1,0,1];
$Size=0.26203;
$Strength=1;
$X=0.12299;
$Y=0.72727;
$Z=1;
$Source=0.46524;
$Range=0;
$Falloff=0.27807;
$Type=1;
$R=1;
$G=1;
$B=0.39091;
$xGrain=0.91444;
$yGrain=0.8984;
$zGrain=0;
$pSize=1;
$x2Grain=0.79679;
$y2Grain=1;
$z2Grain=0.39091;
$p2Size=0.36364;
((1-$Strength)*$Cs+($Strength*remap(noise(($P*turbulence($P)*$Size*50)*[$X,$Y,$Z]),$Source,$Range,$Falloff,$Type*2))*[$R,$G,$B]*noise(($P*turbulence($P*fbm($P*[$x2Grain,$y2Grain,$z2Grain]*$p2Size*50))*$pSize*50)*[$xGrain,$yGrain,$zGrain]))

output18.png

19.三項演算子

# ローカル変数の定義
$color1 = [0.8,0.3,0.2]; # 赤色
$color2 = [0.1,0.4,0.8]; # 青色

# 対角線による条件分岐 ($u と $v の比較)三項演算子
$color = $u > $v ?  $color1 : $color2;
$color

output19.png

20.smoothstep

$v=1-$v; #反転
# 色の定義
$color1 = [0.8,0.2,0.1]; # 赤
$color2 = [0.2,0.4,0.9]; # 青

# 境界の幅を設定(a と b の範囲)
$edge_start = 0.48087; # 0.0, 1.0
$edge_end = 0.52823;   # 0.0, 1.0

# 対角線上の位置を計算
# ($u - $v) の結果を 0.5 前後の範囲に収まるよう調整
$val = ($u - $v) + 0.5;

# smoothstepで0から1へのマスク(重み)を作成
$mask = smoothstep($val, $edge_start, $edge_end);

# マスクに基づいて2色を混合
mix($color1, $color2, $mask)

output21.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?