2008년 5월 22일 목요일

Primitive Variables

rmanFyourvar - constant or vertex floats
rmanPyourvar - constant or vertex points
rmanVyourvar - constant or vertex vectors
rmanNyourvar - constant or vertex normals
rmanCyourvar - constant or vertex colors
rmanSyourvar - constant string
rmanMyourvar - vertex mpoint (for blobs)

2008년 5월 20일 화요일

eMdiffuse Slim Template Review

기존에 사용하던 wrap diffuse의 성능이 그리 좋지 않았던 관계로...
The RenderMan Shading Language Guide - Rudy Cortes 의 디퓨즈 모델을 이용하여
템플릿을 새로 구성하였다.

처음에는 RSLSource StaticFunction을 이용하여 구성하였으나,
AOV 설정에서 다른 템플릿과의 연관성 때문에 포기하고 RSLSource DynamicFuction을 이용하였다.
이방법은 처음 사용한방법인데...
컴파일될때 void같을 프린트하는 스타일이라 sl코딩때와 거의 비슷하고, StaticFuction에 비해 조금은 독립적인것 같은 느낌을 받았다.

sig02.course16.pdf를 보면 스튜어트리틀에서 wrap diffuse의 문제점에 대한 지적이 있는데...
eMdiffuse 역시 문제점을 가지고 있다.
wrap angle의 1.2 이상 올렸을 경우 diffuse 경계라인에 에러가 발생한다.
Gamma를 이용하여 어느정도는 잡을수 있지만... 완벽하게 콘트롤되지는 않는다.
현재로선 1.2 / 1.5가 적정값인것 같다.

eMdiffuse Slim Template AOV'color Sample


eMdiffuse Template Support Color AOV
eMdiff
eMdiffColor
eMdiffDirect
eMdiffDirectShd
eMdiffEnv
eMdiffShd
eMnormal

eMdiffuse Slim Template

template shadingcomponent eMdiffuseSC {
label eMdiffuse
description {
editmasin edit Rudy Cortes wrap diffuse Model for slim
connect : masin77@gmail.com
Support AOV'color
Final Diffuse -> eMdiff
Color -> eMdiffColor
Diffuse Direct -> eMdiffDirect
Diffuse Direct Shadow -> eMdiffDirectShd
Shadow Red Ch -> eMdiffShd
NonDiffuse Blue Ch -> eMdiffShd
Environment Diffuse -> eMdiffEnv
Bent Normals -> eMnormal
}
parameter float Intensity {
description {
Intensity of diffuse component
}
range {0 1 .001}
default 1
detail varying
}
parameter color Color {
detail varying
default {1 1 1}
}
parameter float wrap {
label Wrap
description "Diffuse Wrap Angle"
range {0 2 .1}
default 1.2
detail varying
}
parameter float gam {
label Gamma
description "Diffuse Gamma"
range {1 2 .1}
default 1.5
detail varying
}
collection void envdiffuse {
label "Envrionment Value"
state close
parameter float envInt {
label "Intensity"
range {0 1 .1}
default 1
detail varying
}
parameter float envSaturation {
label "Saturation"
range {0 1 .1}
default 1
detail varying
}
}
parameter normal Normal {
detail mustvary "pixar,ShadingNormal"
}
collection shadingcomponent result {
access output
display hidden
parameter color col {
access output
}
}
RSLSource DynamicFunction {
proc primvars {} {
declare output varying color eMdiff 0;
declare output varying color eMdiffColor 0;
declare output varying color eMdiffShd 0;
declare output varying color eMdiffDirect 0;
declare output varying color eMdiffDirectShd 0;
declare output varying color eMdiffEnv 0;
declare output varying color eMnormal 0;
}
proc function {} {
output "void [getFunctionName]("
indent
output "float Kd;"
output "color coloration;"
output "float wrap;"
output "float gam;"
output "float envInt;"
output "float envSaturation;"
output "normal Ns;"
output "output color col;"
output ")"
exdent
output "{"
indent
output "extern point P;"
output "extern color eMdiff;"
output "extern color eMdiffColor;"
output "extern color eMdiffShd;"
output "extern color eMdiffDirect;"
output "extern color eMdiffDirectShd;"
output "extern color eMdiffEnv;"
output "extern color eMnormal;"
output ""
output "color eMdiffusenonShd = 0;"
output "color Cl_noshd, Cl_diff;"
output "float wrp = 1 - .5 * wrap;"
output "float wa = acos(wrp*2-1);"
output "vector dirsum = 0;"
output "dirsum = normalize(dirsum);"
output "vector bend = dirsum - Ns;"
output ""
output "//illumination from direct lights"
output "illuminance(\"-environment\", P, Ns, wa, \"lightcache\", \"reuse\")"
output "\{"
indent
output "float nondiff = 0;"
output "lightsource(\"__nondiffuse\", nondiff);"
output "if (nondiff < dotp =" .5" k =" (1-nondiff)" k =" (1-nondiff)" 0 ="=" cl_noshd =" Cl;" cl_diff =" Cl_noshd"> 0)"
output "\{"
indent
output "float nondiff = 0;"
output "color envCol = 0;"
output "illuminance(\"environment\", P, Ns, wa,\n"
indent
output "\"lightcache\", \"refresh\",\n"
output "\"send:light:__surfacearea\", -10,\n"
output "\"send:light:__coneangle\", wa,\n"
output "\"send:light:__coneaxis\", Ns,\n"
output "\"light:__nondiffuse\", nondiff)"
exdent
output "\{"
indent
output "if (nondiff < 1)"
indent
output "float envlum = .2125 * comp(Cl, 0) + .7154 * comp(Cl, 1) + .0721 * comp(Cl, 2);"
output "envCol = (1 - nondiff) * mix(color(envlum), Cl, envSaturation);"
output "eMdiffEnv += envCol;"
exdent
exdent
output "\}"
exdent
output "\}"

output ""
output "// Result"
output "eMdiffDirect *= Kd;"
output "eMdiffDirectShd *= Kd;"
output "eMdiffEnv *= Kd * envInt;"
output "eMdiffShd += (color(1,0,0) * eMdiffDirectShd + color(0,0,1) * (1 - eMdiffDirect));"
output ""
output "col = (eMdiffDirect - eMdiffDirectShd + eMdiffEnv) * coloration;"
output "eMdiff = col;"
output "eMdiffColor = coloration;"
output "eMnormal = ((color bend) + 1) / 2;"
exdent
output "}"
}
}
}

2008년 5월 18일 일요일

CentOS yum install 관련...

Loading "installonlyn" pluginSetting up repositoriesCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=extras error was[Errno 4] IOError: Error: Cannot find a valid baseurl for repo: extras

이와 같은 에러가 발생할경우

/etc/resolv.conf 파일에 nameserver 설정이 빠져있을 가능성이 높다.
nameserver 168.126.63.1
nameserver 168.126.63.2

를 추가한다.

2008년 5월 13일 화요일

Python2.5 install for Maya

./configure --prefix=/opt/python25 --enable-unicode=ucs4

2008년 5월 11일 일요일

Python for Maya 환경변수 설정

PYTHONPATH = C:\Program Files\Autodesk\Maya2008\Python\lib\site-packages

MAYA_LOCATION = C:\Program Files\Autodesk\Maya2008

확인...
import sys

print sys.path

하였을 경우 마야 site-packages가 뜨면 정상이다.
어떠한 IDLE에서도 디버깅이 가능하다.

외부에서 python으로 Maya 콘트롤하기...

import maya.standalone
maya.standalone.initialize()

import maya.cmds as cmds
import maya.mel as mel

cmds.file('C:/Temp/test.ma', o=True)

...
...
...

cmds.file(save=True)