イギリスのbournemouth universityを参考にしました。ありがとうございます。Thank you.
#hair2.py
#set PYTHONPATH=C:\Python25;C:\Python\Scripts;%RMANTREE%\bin
import random
from random import uniform as ru
import prman
ri=prman.Ri()
points=[]
pappend=points.append
width=[]
wappend=width.append
npoints=[]
npappend=npoints.append
random.seed(129234)
ru=random.uniform
zpos=-2.0
plus=0.1
minus=-0.1
while(zpos < 2.0 ) :
xpos=-2.0
while (xpos < 2.0) :
pappend(xpos+ru(minus,plus))
pappend(0)
pappend(zpos+ru(minus,plus))
pappend(xpos+ru(minus,plus))
pappend(0.1)
pappend(zpos+ru(minus,plus))
pappend(xpos+ru(minus,plus))
pappend(0.2)
pappend(zpos+ru(minus,plus))
pappend(xpos+ru(minus,plus))
pappend(0.3+ru(-0.1,0.1))
pappend(zpos+ru(minus,plus))
wappend(0.006)
wappend(0.001)
npappend(4)
xpos+=0.02
zpos+=0.02
ri.Begin(ri.RENDER)
ri.Imager("background", {"color color":(.2,.4,.6)})
ri.Display("hair_pr.png", "file", "rgb")
ri.Format(640,480,1)
ri.Projection(ri.PERSPECTIVE, {ri.FOV: 90})
ri.Translate(0,0,2)
ri.Rotate(-25,1,0,0)
ri.WorldBegin()
ri.LightSource("distantlight", {ri.HANDLEID: "1"})
ri.LightSource("ambientlight", {ri.HANDLEID: "2", "intensity":[0.4]})
ri.Color((1,0.2,0.2))
ri.Surface("hair")
ri.Curves( "cubic",npoints,"nonperiodic",{ri.P:points, ri.WIDTH : width})
ri.WorldEnd()
ri.End()
- -
- -