A small python script generates rib procedure and print directly to the renderer, so it doesn't need to be saved to a disk. Actually it has both advantage and disadvantage. I think advantage could be flexibility and disadvantage is memory problem.
Procedural "RunProgram" ["python cloudMaker.py" "1000000 1 2 1"] [-1 1 -1 1 -1 1]
The program could be anything that uses stdin and stdout like C, tcl or Python. It is important to specify a correct bound area. Bounding box parameter helps using memory efficiently.
It was not so simple to make randomly speeded points on a arbitrary sphere
without a regular pattern so I downloaded pretty useful random function library
from this
web page. It works like sphererand() in Mel.
Also, I used vector noise from Python
CG-kit.
This example shows lots of points can make cloud look. However, when I tried to generate 9,000,000 points using a single RunProgram procedure, I got memory allocation error because Python script generate 9,000,000 points data in memory at one time. I think this is a drawback of using RunProgram method. Although at this time I went around using RunProgram 9 times with different seed values, I’ll try to make DSO later.
Rib
Display "rotate" "framebuffer" "rgb"
Format 400 400 1
Projection "perspective" "fov" 30
ShadingRate 5
Translate 0 0 6
Rotate -30 1 0 0
Rotate 20 0 1 0
Scale 1 1 -1
WorldBegin
ReverseOrientation
TransformBegin
Surface "particle" "c" [0.003 0.002 0.001]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 1"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 2"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 3"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 4"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 5"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 6"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 7"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 8"] [-1 1 -1 1 -1 1]
Procedural "RunProgram" ["python ../python/cloudMaker.py"
"1000000 1 2 9"] [-1 1 -1 1 -1 1]
TransformEnd
WorldEnd
I tried to run this helper program through Houdini. Houdini has ri_runprogram shop, and adding Point Instancing Rendering Attribute makes each point in Geometry runs ri_runprogram. I attached my Matrix Composition python script to the helper program.
In this case, each particle point evokes the python helper program.
And, in below example, each vertex of the torus runs the python helper program.