1/1

UV座標のリストを表示する

coord UV座標のリスト
メタセコイアpythonを使って求める
これがst座標になるかはまた検証です。
勉強します。

doc=MQSystem.getDocument()
out=MQSystem.println

obj=doc.object[doc.currentObjectIndex]
out(str(obj.name))

count=obj.numFace
out("面の数:"+str(count))

for face in obj.face:
faceid=list(face.index)

for x in range(0,count):
for y in range(0,obj.face[x].numVertex):
out(str(obj.face[x].index[y])+":"+str(obj.face[x].coord[y]))


出力結果
obj1
面の数:4
1:[0.9957, 0.4946]
3:[0.9957, 0.9754]
2:[0.5149, 0.9754]
1:[0.9930, 0.4892]
2:[0.5122, 0.9700]
0:[0.5122, 0.4892]
4:[0.5203, 0.0004]
5:[1.0011, 0.0004]
1:[1.0011, 0.4811]
4:[0.5203, 0.0058]
1:[1.0011, 0.4865]
0:[0.5203, 0.4865]
  • -
  • -

UVをリストにする その2

参考・・・検討、日々考える。

st=[]
for x in range(0,count):
for y in range(0,obj.face[x].numVertex):
st.append(obj.face[x].coord[y])
out(str(obj.face[x].index[y])+":"+str(obj.face[x].coord[y]))

out(str(list(st)))
  • -
  • -

metasequoiaからUVマップ

メタセコイアのPythonを使ってUVマップ座標を算出、RIBのst座標として記述した。また3Delightでレンダリングするので、テクスチャを変換。

MakeTexture "grade.tif" "grade.tdl" "periodic" "periodic" "gaussian" 1 1

menuv.jpg
以下、サンプルRIBです。ライトが明るすぎてテクスチャが白くなりすぎていました。


##Renderman RIB-Structure 1.0
Display "men.tif" "file" "rgba"
Display "+men.tif" "framebuffer" "rgba"

Format 640 480 1
PixelSamples 4 4
PixelFilter "catmull-rom" 3 3
ShadingRate 1

Imager "background" "background" [0.500 0.500 0.600]

Sides 1
Orientation "lh"
Projection "perspective" "fov" [9.52728338145235]
Rotate -40.8862682605356 1 0 0 # pich
Rotate 52.9183819582828 0 1 0 # head
Translate -90.469199 -98.183947 68.375702
Scale 0.1 0.1 0.1
WorldBegin
Attribute "visibility" "trace" [1]
Attribute "visibility" "transmission" ["Os"]
Attribute "visibility" "transmission" "opaque"
Attribute "light" "shadows" "on"
Attribute "trace" "displacements" [1]
LightSource "ambientlight" 0 "intensity" [ 0.1 ] "lightcolor" [ 1 1 1 ]
LightSource "distantlight" 1 "intensity" [ 3 ] "lightcolor" [ 1 1 1 ] "from" [ -1 1 -1 ] "to" [ 0 0 0 ]
LightSource "distantlight" 2 "intensity" [ 3 ] "lightcolor" [ 1 1 1 ] "from" [ 1 1 2.5 ] "to" [ 0 0 0 ]
ReadArchive "men_mdl.rib"
WorldEnd





##Renderman RIB-Structure 1.0
## filename: men_mdl.rib

MakeTexture "grade.tif" "grade.tdl" "periodic" "periodic" "gaussian" 1 1
AttributeBegin
Attribute "identifier" "name" ["obj1"]
Declare "st" "facevarying float[2]"
### MaterialName: Default
Surface "supertexmap" "string Csmapname" "grade.tdl"
#Surface "paintedplastic" "uniform float Ks" 0.5 "uniform float Kd" 0.5
#"uniform float Ka" 1 "uniform float roughness" 0.1 "uniform color specularcolor" [1 1 1] "uniform string texturename" "grade.tdl"
PointsPolygons
[3 3 3 3]
[0 1 2 0 2 3 4 5 2 4 2 1]
"P" [50.000000 0.000000 100.000000
50.000000 20.000000 0.000000
-50.000000 20.000000 0.000000
-50.000000 0.000000 100.000000
50.000000 0.000000 -100.000000
-50.000000 0.000000 -100.000000]
"N" [0.000000 0.980581 0.196116
0.000000 1.000000 0.000000
0.000000 1.000000 0.000000
0.000000 0.980581 0.196116
0.000000 0.980581 -0.196116
0.000000 0.980581 -0.196116]
"st" [0.9982 -0.0019
0.9982 0.4789
0.5174 0.4789
0.9965 -0.0001
0.4965 0.4905
0.4965 -0.0001
0.9916 0.9968
0.4916 0.9968
0.4916 0.4905
0.9965 0.9968
0.4965 0.4905
0.9949 0.4889]
AttributeEnd




何とかなりそう。面白いです。ありがとうございます。
  • -
  • -

No module named pygame

XPマシンで久々、python cgkitを使おうとしたら、
下記のエラー
Traceback (most recent call last):
File "C:\Python25\Scripts\viewer.py", line 56, in ?
import pygame
ImportError: No module named pygame

pygameはインストールされているし、おかしい。
最新版を入れなおしても、同じ。
最近は、メタセコイアpythonを利用している。新たに
python223jp-20030608.exeをインストールしていた。cgkitが動いている別のマシンに、このPython2.2.3日本語環境をインストールしたら、上記のエラーが出た。特別なモジュールを利用しないならば、2.2.3はアンインストールしても良いか。
アンインストールしたところ、今度は、viewer.pyがpython2.5.4で認識せず、python2.5.4とcgkitをアンインストールして再インストールした。
ちょっと、面倒なことになりましたが、cgkit動いています。

Windows Vistaではどうだったか、確認する必要があります。
Vista 64bitでは、両方インストールされても動きました。
ありがとうございます。

うーん、・・・Windows7 64bitでは、併用できないようです。・・・?
  • -
  • -

1/1