Rendering学習日記

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

python cgkitで変換を求める

Pythonコマンドラインから、

>>> from cgkit.all import *

ちょっと時間がかかる・・・・。とりあえず球体!!!
>>> s=Sphere()
45度の回転行列を求める。
>>> s.rot=mat3().fromEulerXYZ(0.25,0,0)
>>> s.rot
(1, 0, 0)
(0, 0.968912, -0.247404)
(0, 0.247404, 0.968912)

>>> s.rot=mat3().fromEulerXYZ(0,0.25,0)
>>> s.rot
(0.968912, 0, 0.247404)
(0, 1, 0)
(-0.247404, 0, 0.968912)

>>> s.rot=mat3().fromEulerXYZ(0,0,0.25)
>>> s.rot
(0.968912, -0.247404, 0)
(0.247404, 0.968912, 0)
(0, 0, 1)



>>> for slot in s.iterSlots():
... print slot
...
angularvel
cog
dynamics
inertiatensor
linearvel
mass
pos
rot
scale
static
totalmass
transform
visible
worldtransform
>>> s.radius
1.0
>>> s.pos
(0, 0, 0)
>>> s.rot
(1, 0, 0)
(0, 1, 0)
(0, 0, 1)

>>> s.static
False
>>> s.transform
[1, 0, 0, 0]
[0, 1, 0, 0]
[0, 0, 1, 0]
[0, 0, 0, 1]
  • -
  • -

NVIDIA GelatoでBOXを表示する。その2

同じオブジェクトをたくさん並べてみよう
影も計算するように設定しました。
whileのインデントはきちんと整えること。
#box1.pyg
Output ("box02.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 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 ("string geometryset", "+shadows")

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

mypos=-3
while mypos<=3:
PushTransform ()
Attribute ("color C", (1, 1, 0))
Shader ("surface", "plastic")
Translate ( 0, 0.5, mypos)
Input ("BoxGeom.rib")
PopTransform ()
mypos+=1.3

Attribute ("color C", (1, 1, 1))
Rotate (90.00, 1.00, 0.00, 0.00)
Shader ("surface", "plastic")
Input("PlaneGeom.rib")
Render()

box1.jpg
  • -
  • -

NVIDIA Gelatoでレンダリング その3

スポットライトをあてる。
shadingqualityを2にする。デフォルトは1。
#sphere3.pyg
Output ("sphere03.tif", "tiff", "rgb", "camera", "float gain", 1, "float gamma",
1, "string filter", "gaussian", "float[2] filterwidth", (2, 2))
Attribute ("float shadingquality",2)
Attribute ("string projection", "perspective")
Attribute ("float fov", 10)
Attribute ("int[2] resolution", (640, 480))
#placecam -20 15 0 0 0 0
Rotate (-36.87, 1.00, 0.00, 0.00)
Rotate (-90.00, 0.00, 1.00, 0.00)
Translate (20.00, -15.00, 0.00)

Attribute ("string geometryset", "+shadows")

World ()
#Light ("light1", "pointlight", "float intensity", 4000, "point from", (-20, 50, -20),"string shadowname", "shadows")

Light ("light1", "spotlight", "string shadowname", "shadows", "point from", (-20, 50, -20), "point to", (0, 0, 0), "float intensity", 6000, "float coneangle", 90,"float shadowblur",0.01,"float shadowsamples", 4,"float shadowbias",0.1)

PushTransform ()
Attribute ("color C", (0, 0, 1))
Shader ("surface", "plastic")
Translate ( 0, 0.5, 0)
Sphere (1, -1, 1, 360)
PopTransform ()

Attribute ("color C", (1, 1, 1))
Shader ("surface", "plastic")
Rotate (90.00, 1.00, 0.00, 0.00)
Input("PlaneGeom.rib")
Render()

sphere3.jpg
  • -
  • -
<< 3/10 >>