Rendering学習日記

日々、3DCGの世界は進歩しています。勉強して理解したことをまとめていきます。RenderMan互換レンダラーやグローバル・イルミネーション。いろんなことに好奇心を持って、面白くなる。目指せShader書き!!
ありがとうございます。

NVIDIA gelatoで球を並べてみる その3

さらに参考にしながら、いじってみる。
http://agata.ciao.jp/graphic/tips/chapter3.html
rotate<0,30,-60>とある部分の順番がわからない。
とりあえず、適当。
ありがとうございます。
kaiten3.jpg

#kaiten3.pyg
from math import *

Output ("kaiten3.tif", "tiff", "rgb", "camera", "float gain",
1, "float gamma", 1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("float shadingquality",1.2)
Attribute ("string projection", "perspective")
Attribute ("float fov", 45)
Attribute ("int[2] resolution", (640, 480))
#placecam 10 5 -10 0 0 0
Rotate (-19.47, 1.00, 0.00, 0.00)
Rotate (45.00, 0.00, 1.00, 0.00)
Translate (-10.00, -5.00, 10.00)

Attribute ( "int ray:shadows", 1 )
Attribute ("string geometryset", "+shadows")
Attribute ("string geometryset", "+reflection")

World ()
Light ("light1", "pointlight", "float intensity", 400, "point from", (-10, 10, -10),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 400, "point from", (10, 10, -10),"string shadowname", "shadows")

PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()

N1=32
N2=8
K=1
while K<=N2:
J=1
while J<=N1:
PushTransform ()
Attribute ("color C", (0.5*(1+sin(2*pi/N1*J)),0.5, 0.5*(1+cos(2*pi/N1*J))))
Shader ( "surface", "plastic")
Translate (0,1,0)
Rotate (30, 0, 1, 0)
Rotate (-60,0, 0, 1)
Rotate (360/(N2*N1)*(K*N1+J),1,0,0)
Translate (0,0,5)
Rotate (360/N1*J, 0, 1, 0)
Translate ( 2, 0.5, 0)
Sphere (0.2, -0.2, 0.2, 360)
PopTransform ()
J+=1
K+=1

Attribute ("color C", (1, 1, 1))
Rotate (90.00, 1.00, 0.00, 0.00)
ShaderGroupBegin ()
Shader ("surface", "checker","layer1","float stilesize", .1, "float ttilesize", .1)
Shader ("surface", "shinyplastic","layer2")
ConnectShaders ("layer1", "Cout", "layer2", "C")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
Render()
  • -
  • -

ズラリと並べる その2

参考にしたのはhttp://agata.ciao.jp/graphic/tips/chapter3.html
大変、勉強になります。ありがとうございます。

box_kaiten2.jpg

#box_kaiten2.pyg

from math import *

Output ("box_kaiten2.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("float shadingquality",1.2)
Attribute ("string projection", "perspective")
Attribute ("float fov", 20)
Attribute ("int[2] resolution", (640, 480))
#placecam 10 5 -10 0 0 0
Rotate (-19.47, 1.00, 0.00, 0.00)
Rotate (45.00, 0.00, 1.00, 0.00)
Translate (-10.00, -5.00, 10.00)

Attribute ( "int ray:shadows", 1 )
Attribute ("string geometryset", "+shadows")
Attribute ("string geometryset", "+reflection")

World ()
Light ("light1", "pointlight", "float intensity", 400, "point from", (-10, 10, -10),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 400, "point from", (10, 10, -10),"string shadowname", "shadows")

PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()

N1=16
J=1
while J<=N1:
PushTransform ()
Attribute ("color C", (0.5*(1+sin(2*pi/N1*J)),0.5, 0.5*(1+cos(2*pi/N1*J))))
Shader ( "surface", "plastic")
Rotate (360/N1*J, 0, 1, 0)
Translate ( 3.2, 0.5, 0)
Input ("BoxGeom.rib")
PopTransform ()
J+=1

Attribute ("color C", (1, 1, 1))
Rotate (90.00, 1.00, 0.00, 0.00)
ShaderGroupBegin ()
Shader ("surface", "checker","layer1","float stilesize", .1, "float ttilesize", .1)
Shader ("surface", "shinyplastic","layer2")
ConnectShaders ("layer1", "Cout", "layer2", "C")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
Render()
  • -
  • -

POV-Rayの例を参考にしました。
参考にしたのはhttp://agata.ciao.jp/graphic/tips/chapter3.html
大変、勉強になります。ありがとうございます。

RotateとTranslateが逆になるところが違いになりますか。
RenderManやGelatoの記述での変換は、下から上に変換していきます。
box_kaiten1.jpg

#box_kaiten.pyg
Output ("box_kaiten.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("float shadingquality",1.2)
Attribute ("string projection", "perspective")
Attribute ("float fov", 20)
Attribute ("int[2] resolution", (640, 480))
#placecam 10 5 -10 0 0 0
Rotate (-19.47, 1.00, 0.00, 0.00)
Rotate (45.00, 0.00, 1.00, 0.00)
Translate (-10.00, -5.00, 10.00)

Attribute ( "int ray:shadows", 1 )
Attribute ("string geometryset", "+shadows")
Attribute ("string geometryset", "+reflection")

World ()
Light ("light1", "pointlight", "float intensity", 400, "point from", (-10, 10, -10),"string shadowname", "shadows")
Light ("light2", "pointlight", "float intensity", 400, "point from", (10, 10, -10),"string shadowname", "shadows")

PushTransform ()
Attribute ("color C", (0.2, 0.4, 0.75))
Sphere (100, -100, 100, 360)
PopTransform ()

J=1
while J<=8:
PushTransform ()
Attribute ("color C", (1, 1, 1))
Shader ( "surface", "metal","string envname","reflection" )
Rotate (360/8.0*J, 0, 1, 0)
Translate ( 2.5, 0.5, 0)
Input ("BoxGeom.rib")
PopTransform ()
J+=1

Attribute ("color C", (1, 1, 1))
Rotate (90.00, 1.00, 0.00, 0.00)
ShaderGroupBegin ()
Shader ("surface", "checker","layer1","float stilesize", .1, "float ttilesize", .1)
Shader ("surface", "shinyplastic","layer2")
ConnectShaders ("layer1", "Cout", "layer2", "C")
ShaderGroupEnd ()
Input("PlaneGeom.rib")
Render()
  • -
  • -
<< 151/184 >>