Skip to content

Commit e56ade6

Browse files
committed
added an openvdb demo
1 parent dc00ef9 commit e56ade6

16 files changed

+262
-25
lines changed

DisplayDriver/SDLDisplayDriver/rgb.rib

+3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ Display "rgb.exr" "sdldisplaydriver" "rgb"
44
#Display "rgb.exr" "it" "rgb"
55
Format 1024 720 1
66
Hider "raytrace" "int incremental" [1]
7+
78
PixelVariance 0.02
89
ShadingRate 2
910

1011
#PixelVariance 40
1112
#ShadingRate 40
1213
Integrator "PxrPathTracer" "integrator"
14+
Option "bucket" "string order" ["spiral"]
15+
1316
Projection "perspective" "uniform float fov" [30]
1417
Identity
1518
Scale 1 1 -1

RIS/openvdb/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.vdb
2+
*.exr
607 KB
Binary file not shown.
611 KB
Binary file not shown.
611 KB
Binary file not shown.
609 KB
Binary file not shown.
610 KB
Binary file not shown.

RIS/openvdb/impl_openvdb.so

5.4 MB
Binary file not shown.

RIS/openvdb/vdb.py

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/usr/bin/python
2+
import prman
3+
# import the python functions
4+
import sys
5+
sys.path.append('../common')
6+
from Camera import *
7+
8+
9+
ri = prman.Ri() # create an instance of the RenderMan interface
10+
11+
versionMajor=int(ri.PRMAN_VERSION_STR.split('.')[0])
12+
13+
filename = "__render"
14+
# this is the begining of the rib archive generation we can only
15+
# make RI calls after this function else we get a core dump
16+
ri.Begin('__render')
17+
18+
ri.Option( "ribparse", { "string varsubst" : [""] })
19+
ri.Option("ribparse" , {"string varsubst" : ["$"]})
20+
21+
ri.Option( "searchpath", { "string procedural" : [".:${RMANTREE}/lib/plugins:@"]})
22+
# on Version 20.12 openvdb plug is here
23+
ri.Option( "searchpath", { "string procedural" : [".:${RMANTREE}/etc:@"]})
24+
25+
ri.Option( "bucket" ,{"string order" : ["spiral"]})
26+
27+
# now we add the display element using the usual elements
28+
# FILENAME DISPLAY Type Output format
29+
ri.Display("vdb.exr", "it", "rgba")
30+
ri.Format(1024,720,1)
31+
32+
# setup the raytrace / integrators
33+
34+
ri.Hider("raytrace" ,{"int incremental" :[1], "int minsamples" : [4] , "int maxsamples" : [128]})
35+
ri.PixelVariance (0.2)
36+
ri.ShadingRate(20)
37+
ri.Integrator ("PxrPathTracer" , "integrator" ,{ "int numLightSamples" : [4] , "int numBxdfSamples" : [4], "int maxPathLength" : [1]})
38+
39+
# now set the projection to perspective
40+
ri.Projection(ri.PERSPECTIVE,{ri.FOV:30})
41+
# Simple translate for our camera
42+
cam=Camera(Vec4(0,1,10),Vec4(0,0,0),Vec4(0,1,0))
43+
cam.place(ri)
44+
45+
46+
47+
# now we start our world
48+
ri.WorldBegin()
49+
50+
#Lighting We need geo to emit light
51+
ri.AttributeBegin()
52+
53+
#ri.Rotate(45,0,1,0)
54+
ri.Declare("areaLight" ,"string")
55+
ri.Declare("areaLight" ,"string")
56+
57+
if versionMajor == 20 :
58+
ri.AreaLightSource( "PxrStdAreaLight", {ri.HANDLEID : "areaLight", "float exposure" : [4] })
59+
else :
60+
ri.Light("PxrMeshLight" ,{ ri.HANDLEID : "areaLight", "float exposure" : [4]} )
61+
62+
63+
ri.TransformBegin()
64+
ri.Translate(0.8,1.3,2)
65+
ri.Rotate(180,1,0,0)
66+
ri.Scale(.1,.1,.1)
67+
ri.Geometry("rectlight")
68+
ri.TransformEnd()
69+
ri.AttributeEnd()
70+
71+
# smoke
72+
73+
ri.AttributeBegin()
74+
ri.Attribute( "visibility", { "int transmission" : [1]})
75+
76+
# we have a density value in the VDB file
77+
ri.Pattern( "PxrPrimvar", "primvar", {"string type" : ["float"], "string varname" : ["density"]})
78+
# use a volume shader
79+
ri.Bxdf( "PxrVolume", "smooth" , { "color diffuseColor" : [1, 1 ,1],
80+
"reference float densityFloat" : ["primvar:resultF"],
81+
"float maxDensity" : [10] ,"int samples" : [8]})
82+
# change this for speed.
83+
ri.ShadingRate(5)
84+
85+
86+
# now load the vdf as a volume
87+
ri.Volume ("blobbydso:impl_openvdb.so", [-100, 100, -100 ,100, -100 ,100] ,[0, 0, 0] , {"constant string[2] blobbydso:stringargs" : ["teapot.vdb", "density"] , "varying float density" : [] })
88+
89+
90+
ri.AttributeEnd()
91+
92+
93+
94+
# floor
95+
ri.TransformBegin()
96+
ri.Bxdf( "PxrDisney","bxdf", {
97+
"color baseColor" : [ 1.0,1.0,1.0]
98+
})
99+
s=5.0
100+
face=[-s,0,-s, s,0,-s,-s,0,s, s,0,s]
101+
#ri.Patch("bilinear",{'P':face})
102+
103+
ri.TransformEnd()
104+
105+
106+
107+
# end our world
108+
ri.WorldEnd()
109+
# and finally end the rib file
110+
ri.End()

RIS/openvdb/vdbFrame.py

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/python
2+
import prman
3+
# import the python functions
4+
import sys,os,glob
5+
sys.path.append('../common')
6+
from Camera import *
7+
8+
9+
ri = prman.Ri() # create an instance of the RenderMan interface
10+
11+
versionMajor=int(ri.PRMAN_VERSION_STR.split('.')[0])
12+
13+
files=glob.glob('teapot*.vdb')
14+
frame=1
15+
for f in files :
16+
17+
filename = "teapot%03d.exr" %frame
18+
print "rendering %s to %s" %(f,filename)
19+
# this is the begining of the rib archive generation we can only
20+
# make RI calls after this function else we get a core dump
21+
ri.Begin('__render')
22+
23+
ri.Option( "ribparse", { "string varsubst" : [""] })
24+
ri.Option("ribparse" , {"string varsubst" : ["$"]})
25+
26+
ri.Option( "searchpath", { "string procedural" : [".:${RMANTREE}/lib/plugins:@"]})
27+
# on Version 20.12 openvdb plug is here
28+
ri.Option( "searchpath", { "string procedural" : [".:${RMANTREE}/etc:@"]})
29+
30+
ri.Option( "bucket" ,{"string order" : ["spiral"]})
31+
32+
# now we add the display element using the usual elements
33+
# FILENAME DISPLAY Type Output format
34+
ri.Display(filename, "file", "rgba")
35+
ri.Format(1024,720,1)
36+
37+
# setup the raytrace / integrators
38+
39+
ri.Hider("raytrace" ,{"int incremental" :[1], "int minsamples" : [4] , "int maxsamples" : [128]})
40+
ri.PixelVariance (0.2)
41+
ri.ShadingRate(20)
42+
ri.Integrator ("PxrPathTracer" , "integrator" ,{ "int numLightSamples" : [4] , "int numBxdfSamples" : [4], "int maxPathLength" : [1]})
43+
44+
# now set the projection to perspective
45+
ri.Projection(ri.PERSPECTIVE,{ri.FOV:30})
46+
# Simple translate for our camera
47+
cam=Camera(Vec4(0,1,10),Vec4(0,0,0),Vec4(0,1,0))
48+
cam.place(ri)
49+
50+
51+
52+
# now we start our world
53+
ri.WorldBegin()
54+
55+
#Lighting We need geo to emit light
56+
ri.AttributeBegin()
57+
58+
#ri.Rotate(45,0,1,0)
59+
ri.Declare("areaLight" ,"string")
60+
ri.Declare("areaLight" ,"string")
61+
62+
if versionMajor == 20 :
63+
ri.AreaLightSource( "PxrStdAreaLight", {ri.HANDLEID : "areaLight", "float exposure" : [4] })
64+
else :
65+
ri.Light("PxrMeshLight" ,{ ri.HANDLEID : "areaLight", "float exposure" : [4]} )
66+
67+
68+
ri.TransformBegin()
69+
ri.Translate(0.8,1.3,2)
70+
ri.Rotate(180,1,0,0)
71+
ri.Scale(.1,.1,.1)
72+
ri.Geometry("rectlight")
73+
ri.TransformEnd()
74+
ri.AttributeEnd()
75+
76+
# smoke
77+
78+
ri.AttributeBegin()
79+
ri.Attribute( "visibility", { "int transmission" : [1]})
80+
81+
# we have a density value in the VDB file
82+
ri.Pattern( "PxrPrimvar", "primvar", {"string type" : ["float"], "string varname" : ["density"]})
83+
# use a volume shader
84+
ri.Bxdf( "PxrVolume", "smooth" , { "color diffuseColor" : [1, 1 ,1],
85+
"reference float densityFloat" : ["primvar:resultF"],
86+
"float maxDensity" : [10] ,"int samples" : [8]})
87+
# change this for speed.
88+
ri.ShadingRate(5)
89+
90+
91+
# now load the vdf as a volume
92+
ri.Volume ("blobbydso:impl_openvdb.so", [-100, 100, -100 ,100, -100 ,100] ,[0, 0, 0] , {"constant string[2] blobbydso:stringargs" : [f, "density"] , "varying float density" : [] })
93+
94+
95+
ri.AttributeEnd()
96+
97+
98+
99+
# floor
100+
ri.TransformBegin()
101+
ri.Bxdf( "PxrDisney","bxdf", {
102+
"color baseColor" : [ 1.0,1.0,1.0]
103+
})
104+
s=5.0
105+
face=[-s,0,-s, s,0,-s,-s,0,s, s,0,s]
106+
#ri.Patch("bilinear",{'P':face})
107+
108+
ri.TransformEnd()
109+
110+
111+
112+
# end our world
113+
ri.WorldEnd()
114+
# and finally end the rib file
115+
ri.End()
116+
frame=frame+1

RIS/openvdb/vdbteapotH15.hipnc

609 KB
Binary file not shown.

RIS/openvdb/vdbteapotH16.hipnc

610 KB
Binary file not shown.

rFM/Rfm/renderman/osl1/rib/0001/perspShape_Final.0001.rib

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##RenderMan RIB
22
#Created by RenderMan for Maya 21.3 (@1715407 Feb 15 2017)
3-
#Wed Apr 26 21:23:12 BST 2017
3+
#Thu Apr 27 09:08:49 BST 2017
44
version 3.04
55
Option "ribparse" "string varsubst" [""]
66
Option "ribparse" "string varsubst" ["$"]
@@ -57,13 +57,13 @@ FrameBegin 1
5757
Hider "raytrace" "int adaptall" [0] "int incremental" [1] "string pixelfiltermode" ["weighted"] "int minsamples" [0] "int minextrasamples" [0] "int maxsamples" [512] "float darkfalloff" [0.025]
5858
Integrator "PxrPathTracer" "PxrPathTracer" "int maxPathLength" [10] "string sampleMode" ["bxdf"] "int numLightSamples" [8] "int numBxdfSamples" [8] "int numIndirectSamples" [1] "int numDiffuseSamples" [1] "int numSpecularSamples" [1] "int numSubsurfaceSamples" [1] "int numRefractionSamples" [1] "int rouletteDepth" [4] "float rouletteThreshold" [0.2] "string imagePlaneSubset" ["rman__imageplane"] "int clampDepth" [2] "float clampLuminance" [10] "int allowCaustics" [0]
5959
Format 1280 720 1
60-
Display "renderman/osl1/images/osl1" "it" "rgba" "string filter" ["gaussian"] "float[2] filterwidth" [2 2] "int[4] quantize" [0 0 0 0] "float dither" [0] "float[2] exposure" [1 1] "float[3] remap" [0 0 0] "int merge" [0] "string connection" ["-launchURI /Applications/Pixar/RenderManProServer-21.3/bin/it.app/Contents/MacOS/it"] "string dspyParams" [" itOpenHandler {::ice::startTimer;};;; itCloseHandler {::ice::endTimer %arglist; };;; dspyRender -renderer preview -time 1 -crop 0 1 0 1 -port 61036 -context \"renderman/osl1/images/osl1\" -notes \"(Wed Apr 26 21:23:12 BST 2017)\nSamples: [email protected] PxrPathTracer node is missing !\""]
60+
Display "renderman/osl1/images/osl1" "it" "rgba" "string filter" ["gaussian"] "float[2] filterwidth" [2 2] "int[4] quantize" [0 0 0 0] "float dither" [0] "float[2] exposure" [1 1] "float[3] remap" [0 0 0] "int merge" [0] "string connection" ["-launchURI /Applications/Pixar/RenderManProServer-21.3/bin/it.app/Contents/MacOS/it"] "string dspyParams" [" itOpenHandler {::ice::startTimer;};;; itCloseHandler {::ice::endTimer %arglist; };;; dspyRender -renderer preview -time 1 -crop 0 1 0 1 -port 52214 -context \"renderman/osl1/images/osl1\" -notes \"(Thu Apr 27 09:08:49 BST 2017)\nSamples: [email protected] PxrPathTracer node is missing !\""]
6161
#Camera perspShape
6262
Clipping 0.1 10000
6363
Projection "perspective" "fov" [54.4322]
6464
ScreenWindow -1 1 -0.5625 0.5625
6565
Shutter 0 0
66-
ConcatTransform [ 0.93358 -0.346699 -0.0907073 1.82102e-09 5.50694e-09 0.25311 -0.967437 -1.10042e-09 -0.358368 -0.903181 -0.236299 4.74393e-09 -8.08811e-08 -0.640445 15.0139 1 ]
66+
ConcatTransform [ 0.838671 -0.21925 -0.498559 1.12743e-11 0 0.915393 -0.402561 0 -0.544639 -0.337616 -0.767714 -7.3216e-12 0 -2.31622 14.1357 1 ]
6767
Camera "world" "float[2] shutteropening" [0 1]
6868
Option "user" "color camera_bg" [0 0 0] "float camera_bga" [0]
6969
DisplayFilter "PxrBackgroundDisplayFilter" "background" "color backgroundColor" [0 0 0]
@@ -78,6 +78,10 @@ FrameBegin 1
7878
Attribute "dice" "string referencecamera" ["worldcamera"] "float minlength" [-1] "float micropolygonlength" [1] "int watertight" [0]
7979
Attribute "procedural" "int reentrant" [1]
8080
Attribute "displacementbound" "string coordinatesystem" ["shader"] "float sphere" [0]
81+
Attribute "user" "string irRenderCam" ["false,6.53963,7.81071,10.0701"]
82+
Attribute "user" "string irRenderCamFOV" ["54.4322"]
83+
Attribute "user" "string irRenderCamXform" ["0.838671,-1.38778e-17,-0.544639,0,-0.21925,0.915393,-0.337616,0,0.498559,0.402561,0.767713,0,6.53963,7.81071,10.0701,1"]
84+
Attribute "user" "string irRenderCamRatio" ["1"]
8185
AttributeBegin
8286
Attribute "identifier" "string name" ["PxrDomeLightShape1"]
8387
Attribute "grouping" "string membership" ["+rman__imageplane"]
@@ -102,12 +106,12 @@ FrameBegin 1
102106
AttributeEnd
103107
AttributeBegin
104108
Attribute "identifier" "string name" ["pPlane1"]
105-
Attribute "identifier" "float id" [5]
109+
Attribute "identifier" "float id" [4]
106110
ConcatTransform [ 2.36828 0 0 0 0 2.36828 0 0 0 0 2.36828 0 0 0 0 1 ]
107111
AttributeBegin
108112
AttributeBegin
109113
Attribute "identifier" "string name" ["pPlaneShape1"]
110-
Attribute "identifier" "float id" [12]
114+
Attribute "identifier" "float id" [11]
111115
Sides 2
112116
Attribute "visibility" "int camera" [1] "int indirect" [1] "int transmission" [1]
113117
Attribute "shade" "string transmissionhitmode" ["shader"]
@@ -120,52 +124,54 @@ FrameBegin 1
120124
AttributeEnd
121125
AttributeEnd
122126
AttributeBegin
123-
Attribute "identifier" "string name" ["TeapotMoved:Mesh"]
124-
Attribute "identifier" "float id" [2]
125-
ConcatTransform [ 2.00635 0 1.00301 0 -0 2.24309 0 0 -1.00301 -0 2.00635 0 0 5.29437 0 1 ]
127+
Attribute "identifier" "string name" ["pCube1"]
128+
Attribute "identifier" "float id" [3]
129+
ConcatTransform [ 1.5 0 0 0 0 1.5442 0 0 0 0 1.5 0 0 1.95627 0 1 ]
126130
AttributeBegin
127131
AttributeBegin
128-
Attribute "identifier" "string name" ["TeapotMoved:MeshShape"]
132+
Attribute "identifier" "string name" ["pCubeShape1"]
129133
Attribute "identifier" "float id" [10]
130134
Sides 2
131135
Attribute "visibility" "int camera" [1] "int indirect" [1] "int transmission" [1]
132136
Attribute "shade" "string transmissionhitmode" ["shader"]
133137
Attribute "grouping" "string membership" ["+reflection,refraction,shadow"]
134-
##RLF Inject SurfaceShading -attribute sets@,PxrDisney4SG,
138+
##RLF Inject SurfaceShading -attribute sets@,PxrDisney2SG,
135139
TransformBegin
136-
Procedural2 "DelayedReadArchive2" "SimpleBound" "string filename" ["renderman/osl1/rib/job/staticGeoCache.job.zip!renderman/osl1/rib/job/TeapotMoved_MeshShape.job.rib"] "float[6] bound" [-0.915817 1.04796 -0.457885 0.457885 -0.610514 0.610514] "int __immediatesubdivide" [0]
140+
Procedural2 "DelayedReadArchive2" "SimpleBound" "string filename" ["renderman/osl1/rib/job/staticGeoCache.job.zip!renderman/osl1/rib/job/pCubeShape1.job.rib"] "float[6] bound" [-1.5 1.5 -1.5 1.5 -1.5 1.5] "int __immediatesubdivide" [0]
137141
TransformEnd
138142
AttributeEnd
139143
AttributeEnd
140144
AttributeEnd
141145
AttributeBegin
142-
Attribute "identifier" "string name" ["pCube1"]
143-
Attribute "identifier" "float id" [4]
144-
ConcatTransform [ 1.5 0 0 0 0 1.5442 0 0 0 0 1.5 0 0 1.95627 0 1 ]
146+
Attribute "identifier" "string name" ["PxrDomeLight1"]
147+
Attribute "identifier" "float id" [1]
148+
ConcatTransform [ -230.321 -0 -0 0 0 230.321 0 0 0 0 230.321 0 0 0 0 1 ]
149+
AttributeBegin
150+
AttributeEnd
151+
AttributeEnd
152+
AttributeBegin
153+
Attribute "identifier" "string name" ["teapot:Mesh"]
154+
Attribute "identifier" "float id" [7]
155+
ConcatTransform [ 2.02994 0 0 0 0 2.02994 0 0 0 0 2.02994 0 0 5.11509 0 1 ]
145156
AttributeBegin
146157
AttributeBegin
147-
Attribute "identifier" "string name" ["pCubeShape1"]
148-
Attribute "identifier" "float id" [11]
158+
Attribute "identifier" "string name" ["teapot:MeshShape"]
159+
Attribute "identifier" "float id" [12]
149160
Sides 2
150161
Attribute "visibility" "int camera" [1] "int indirect" [1] "int transmission" [1]
151162
Attribute "shade" "string transmissionhitmode" ["shader"]
152163
Attribute "grouping" "string membership" ["+reflection,refraction,shadow"]
153-
##RLF Inject SurfaceShading -attribute sets@,PxrDisney2SG,
164+
##RLF Inject SurfaceShading -attribute sets@,PxrDisney4SG,
154165
TransformBegin
155-
Procedural2 "DelayedReadArchive2" "SimpleBound" "string filename" ["renderman/osl1/rib/job/staticGeoCache.job.zip!renderman/osl1/rib/job/pCubeShape1.job.rib"] "float[6] bound" [-1.5 1.5 -1.5 1.5 -1.5 1.5] "int __immediatesubdivide" [0]
166+
Procedural2 "DelayedReadArchive2" "SimpleBound" "string filename" ["renderman/osl1/rib/job/staticGeoCache.job.zip!renderman/osl1/rib/job/teapot_MeshShape.job.rib"] "float[6] bound" [-0.9959 0.967877 -0.457885 0.457885 -0.610514 0.610514] "int __immediatesubdivide" [0]
156167
TransformEnd
157168
AttributeEnd
158169
AttributeEnd
159-
AttributeEnd
160-
AttributeBegin
161-
Attribute "identifier" "string name" ["PxrDomeLight1"]
162-
Attribute "identifier" "float id" [1]
163-
ConcatTransform [ -230.321 -0 -0 0 0 230.321 0 0 0 0 230.321 0 0 0 0 1 ]
164170
AttributeBegin
165171
AttributeEnd
166172
AttributeEnd
167173
##RLF ScopeEnd -name perspShape_Final
168174
WorldEnd
169175
ResourceEnd
170-
##streammarker 0
176+
##streammarker 4
171177
FrameEnd

rFM/Rfm/renderman/osl1/rib/0001/perspShape_Final.0001.rlf

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Bxdf "PxrDisney" "teapotMat" "reference color baseColor" ["PxrOSL11:Cout"] "colo
1717
</InjectablePayloads>
1818
<TightBindings>
1919
<Binding Key="pPlane1/pPlaneShape1" PayloadId="PxrDisney4SG"/>
20-
<Binding Key="TeapotMoved:Mesh/TeapotMoved:MeshShape" PayloadId="PxrDisney4SG"/>
2120
<Binding Key="pCube1/pCubeShape1" PayloadId="PxrDisney2SG"/>
21+
<Binding Key="teapot:Mesh/teapot:MeshShape" PayloadId="PxrDisney4SG"/>
2222
</TightBindings>
2323
</RenderManLookFile>
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)