Rendering学習日記

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

Pythonを使ってRenderManを操る その1

とりあえず、サンプルを参考にカメラをテストしました。
イギリスのbournemouth universityを参考にしました。ありがとうございます。Thank you.


#!/usr/bin/python
# set PYTHONPATH=C:\Python25;C:\Python25\Scripts;%RMANTREE%\bin

import sys
sys.path.append("D:\lighting\PythonClasses")

import math
import getpass
import time,random

# import the python renderman library
import prman

from vector import Vector
from Camera import *


def Scene(ri) :
ri.AttributeBegin()
random.seed(25)

face=[-0.1,-1,-3, 0.1,-1,-3,-0.1,-1,3, 0.1,-1,3]
plank=-5.0
while (plank <=5.0) :
ri.TransformBegin()
ri.Color([random.uniform(0.35,0.4),random.uniform(0.1,0.025),0])
c0=[random.uniform(-10,10),random.uniform(-10,10),random.uniform(-10,10)]
c1=[random.uniform(-10,10),random.uniform(-10,10),random.uniform(-10,10)]
ri.Surface("wood",{"Ks":[0.1],"point c0":c0,"point c1":c1,"float grain":random.randint(2,20)})
ri.Translate(plank,0,0)
ri.Patch("bilinear",{'P':face})
ri.TransformEnd()
plank=plank+0.206
ri.AttributeEnd()
ri.TransformBegin()
ri.AttributeBegin()
ri.Attribute( "visibility", {"trace": [1]})
ri.Attribute( "visibility", {"int transmission": [1]})
ri.Color([0.2,0.4,0.75])
ri.Translate( 0,-1.0,0)
ri.Rotate(-90,1,0,0)
ri.Rotate(36,0,0,1)
ri.Scale(0.4,0.4,0.4)
ri.Surface("plastic")
ri.Geometry("teapot")
ri.AttributeEnd()
ri.TransformEnd()



ri = prman.Ri() # create an instance of the RenderMan interface
#cam=Camera(Vector(4,0.2,4,1),Vector(0,0,0,1),Vector(0,1,0,0))
cam=Camera(Vector(0,2,4,1),Vector(0,0,0,1),Vector(0,1,0,0))

cam.fov=40

#filename = "Camera.rib"
filename = "__render"

ri.Begin(filename)
#ri.Begin(ri.RENDER)
ri.Declare("Light1" ,"string")
ri.Declare("Light2" ,"string")
ri.Declare("Light3" ,"string")
# now we add the display element using the usual elements
# FILENAME DISPLAY Type Output format
#ri.Display("Camera.exr", "framebuffer", "rgba")
ri.Display("Camera.png", "file", "rgb")
cam.Format(ri)

# now we start our world
ri.WorldBegin()
ri.LightSource("shadowdistant",{ri.HANDLEID:"Light1", "from": [ -10, 10, -10], "to": [ 0, 0, 0], "intensity":[2.0], "string shadowname": ["raytrace"]})
#ri.LightSource( "pointlight", {ri.HANDLEID:"Light1", "point from":[-2,2,4], "float intensity": [50]})
ri.LightSource( "distantlight", {ri.HANDLEID:"Light2", "point to":[-1,-0.03,0], "float intensity": [1]})
ri.LightSource( "distantlight", {ri.HANDLEID:"Light3", "point to":[0,-0.5,-1], "float intensity": [0.2]})

ri.Illuminate("Light1",1)
ri.Illuminate("Light2",1)
ri.Illuminate("Light3",1)
cam.Place(ri)
ri.TransformBegin()
Scene(ri)
ri.TransformEnd()
# end our world
ri.WorldEnd()
# and finally end the rib file
ri.End()

cam.jpg
  • -
  • -

VirtualBox Guest Additions for CentOS 6.3

Forumsリンクが切れそうなんで転載します。Building the OpenGL support moduleで失敗になる修正パッチ
VirtualBox guest additions (4.1.18) won't build properly for CentOS 6.3. The patch Thank you.


--- vboxvideo_drm.c.original 2012-07-10 08:26:22.000000000 +0200
+++ vboxvideo_drm.c 2012-07-10 08:34:06.000000000 +0200
@@ -67,6 +67,9 @@
# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1)
# define DRM_RHEL61
# endif
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,3)
+# define DRM_RHEL63
+# endif
# endif
# endif

@@ -85,7 +88,7 @@
return 0;
#endif
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) || defined(DRM_RHEL63)
/* since linux-3.3.0-rc1 drm_driver::fops is pointer */
static struct file_operations driver_fops =
{
@@ -109,7 +112,7 @@
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
#endif
-# if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) && !defined(DRM_RHEL63)
.fops =
{
.owner = THIS_MODULE,

  • -
  • -

はじめてのFujiyama Renderer その5

毛並表現わかりました。

$ curvegen hoge.mesh hoge.crv

でファーを生成する。
ありがとうございます。
furbunny.jpg
  • -
  • -
<< 31/184 >>