Rendering学習日記

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

cgkit-2.0.0alpha9.win32-py2.5.exe

cgkitがアップデートした。
ますますRenderMan互換レンダラーで便利に使える。

Python2.5でのcgkitのインストール注意点をまとめておく。

■必要なファイル 
python-2.5.4.msi
PyOpenGL-3.0.1a2.win32.exe
PyODE-1.2.0.win32-py2.5.exe
pygame-1.8.1release.win32-py2.5.msi
PIL-1.1.6.win32-py2.5.exe
cgkit-2.0.0alpha9.win32-py2.5.exe
PyProtocols-0.9.3.zip
(msvcp71.dll)

■マイ コンピュータを右クリック
詳細設定→環境変数→システム環境変数のPATHを探して、「編集」をクリック。ここで変数値が選択状態になっているが、マウスでクリックして選択解除、他の設定を消さないように、変数値の最後の部分に次のパスを追加する。

;C:\Python25;C:\Python25\Scripts

■マシンを再起動。

以上をインストールしたら、
PyProtocols-0.9.3.zipをC:\Python25に解凍する。

■コマンドプロンプトから
C:\Python25\PyProtocols-0.9.3>python setup.py --without-speedups install

続いて、サンプルを動かしてみる。
C:\Python25>viewer.py demo1.py
Traceback (most recent call last):
File "C:\Python25\Scripts\viewer.py", line 63, in
from cgkit.all import *
File "C:\Python25\Lib\site-packages\cgkit\all\__init__.py", line 46, in
from cgkit import _core
ImportError: DLL load failed: 指定されたモジュールが見つかりません。

上記のエラーが出る場合はMicrosoft C++ Runtime Libraryがない。

msvcp71.dllを探してきて、Python25フォルダに入れておくとcgkitは動きます。
  • -
  • -

easy_installでPyOpenGLのアンインストール

easy_install -m PyOpenGL==3.0.0a5

Searching for PyOpenGL==3.0.0a5
Best match: pyopengl 3.0.0a5
Processing pyopengl-3.0.0a5-py2.5.egg
Removing pyopengl 3.0.0a5 from easy-install.pth file

Using c:\python25\lib\site-packages\pyopengl-3.0.0a5-py2.5.egg

Because this distribution was installed --multi-version, before you can
import modules from this package in an application, you will need to
'import pkg_resources' and then use a 'require()' call similar to one of
these examples, in order to select the desired version:

pkg_resources.require("pyopengl") # latest installed version
pkg_resources.require("pyopengl==3.0.0a5") # this exact version
pkg_resources.require("pyopengl>=3.0.0a5") # this version or higher

Processing dependencies for PyOpenGL==3.0.0a5
Finished processing dependencies for PyOpenGL==3.0.0a5

できました。ありがとうございます。
  • -
  • -

matid

メタセコイアからOBJ出力した面の色情報の割り当て方がわかる。
cgkitは面白い。

load("facetest.obj")

model=worldObject("obj1")

convertToTriMesh(model)

#model.geom.newVariable("matid", UNIFORM, INT)

m1=OBJMaterial( name = "mat1",
Ka = (0.6, 0.0, 0.0),
Kd = (0.8, 0.0, 0.0),
Ks = (0.0, 0.0, 0.0),
Ns = 5.0
)

m2=OBJMaterial( name = "mat2",
Ka = (0.0, 0.0, 0.6),
Kd = (0.0, 0.0, 0.8),
Ks = (0.0, 0.0, 0.0),
Ns = 5.0
)

m3=OBJMaterial( name = "mat3",
Ka = (0.6, 0.6, 0.0),
Kd = (0.8, 0.8, 0.0),
Ks = (0.0, 0.0, 0.0),
Ns = 5.0
)

model.material = [m1,m2,m3]


matids = model.geom.slot("matid")

i=0
for v in model.geom.slot("matid"):
matids[i] = v
i=i+1

matid1.jpg

matid2.jpg

ありがとうございます。
  • -
  • -
<< 161/184 >>