Basically I want a big block of RiPoints to shade into, so I made them like this
I used cgKit to make a big block of points, now I just need to see how it performs under stress
Parent Voxel script
voxelParent.py
#!/usr/bin/env python from cgkit.ri import * """ RiProcedural(data, bound, subdividefunc, freefunc=None) Declare a procedural model. subdividefunc and freefunc may either be the standard RenderMan procedurals (RiProcDelayedReadArchive, RiProcRunProgram, RiProcDynamicLoad and RiProcFree) or Python callables. In the former case, data must be a sequence of strings or a single string containing the data for the functions. In the latter case, data may be any Python object which is just passed on to the functions. freefunc is optional and defaults to None. Because this module can only produce RIB, a custom subdivide function is simply called with a detail value of RI_INFINITY to generate all the data at once. Example: RiProcedural("mymodel.rib", [-1,1,-1,1,-1,1], \ RiProcDelayedReadArchive, RI_NULL) RiProcedural(["python teapot.py",""],[0,1,0,1,0,1], \ RiProcRunProgram, RI_NULL) RiProcedural(["teapot.so",""],[0,1,0,1,0,1], \ RiProcDynamicLoad, RI_NULL) """ import sys args = sys.stdin.readline() while args: arg = args.split() size=float(arg[0]) parts=int(arg[1]) seed=int(arg[2]) childCount=int(arg[2]) childSeed = seed for xstep in range(parts): for ystep in range(parts): for zstep in range(parts): xmin = xstep - 0.5*size/parts - size*0.5 xmax = xstep + 0.5*size/parts - size*0.5 ymin = ystep - 0.5*size/parts- size*0.5 ymax = ystep + 0.5*size/parts- size*0.5 zmin = zstep - 0.5*size/parts- size*0.5 zmax = zstep + 0.5*size/parts- size*0.5 childSeed+=1 print RiProcedural(["python voxelChild.py","%s %s %s %s %s %s %s %s" % (xmin,xmax,ymin,ymax,zmin,zmax,childSeed, childCount)],[xmin,xmax,ymin,ymax,zmin,zmax], RiProcRunProgram, RI_NULL) sys.stdout.write('\377') sys.stdout.flush() args = sys.stdin.readline() |
Child Voxel Script
#!/usr/bin/env python from cgkit.ri import * from cgkit.cgtypes import * import sys import random args = sys.stdin.readline() while args: arg = args.split() xmin=float(arg[0]) xmax=float(arg[1]) ymin=float(arg[2]) ymax=float(arg[3]) zmin=float(arg[4]) zmax=float(arg[5]) childSeed=int(arg[6]) childCount = int(arg[7]) pointList = [] pointSize = vec3(xmax-xmin,ymax-ymin,zmax-zmin).length() / float(childCount) for xstep in range(childCount): childSeed+=1 random.seed(childSeed) xval = random.uniform(xmin,xmax) random.jumpahead(1) yval = random.uniform(ymin,ymax) random.jumpahead(1) zval = random.uniform(zmin,zmax) random.jumpahead(1) pointVal = vec3(xval,yval,zval) pointList.append(pointVal) print RiPoints(P=pointList,constantwidth=[pointSize]) sys.stdout.write('\377') sys.stdout.flush() args = sys.stdin.readline() |
Just add brick map or ptc based 3d look up shader and rejoice!
I still have an outstanding testing of seeing if it acutally produces geometry and see if it looks good, but they are small details
Does it work?
Comment by Curious Visitor — February 25, 2011 @ 2:12 pm
Do you have any renders of this?
Comment by kerem — June 27, 2011 @ 1:27 pm
I cant remember, I think it did produce some output.
Often I just leave things on my blog somewhat unfinished hoping that I will get back to it at a later stage.
I would imagine that it would be a little bit spotty depending on the size of the points, but I think it did work
Sam
Comment by admin — June 27, 2011 @ 1:41 pm