getpoints() in Slim/Renderman


#1

Hi.

 Did anybody code something around getpoints()-function in RSL? I'm  desperately trying to shade a surface depending on nearest-points from a  point-cloud. But it's so hard to find any example of getpoints vs.  texture3d() function in renderman.

Posted that in renderman-forum as well - so far without any success.

 My main question:

the idea with getpoints() is sampling the position of the nearest point/s from the pointcloud and get the distance to the shading point P ? … and do something with that?

Thats what I put into an SL-box in Slim:
------------------
color offsetColor = 0;
float test;
extern point P;
extern normal N;
normal Nn = normalize(transform(“world”, N));
normal Nnull = (0,0,0);

  uniform string filename = "";
  filename = "Z:/_rnd/caches/ptc/rman_slim_shading_ptc/particleShape1.0020.ptc";
  
  float npoints;
  filterregion frP, frN;
  frP->calculate3d(P);
  frP->scale(1);
  normal N0 = normal(0);
  frN->calculate3d(N0, N0, N0);
  
  point position[1] = { point(0) };
  float distance;
  float falloff;
  
  npoints = getpoints(filename, frP, frN, 1, "_position", position, "vBla", test);

  distance = length(P - position[0]);
  falloff = 1 - smoothstep(0,.1,distance);
  
  color outcolor = color Nn;
  offsetColor = color test;
  result = (.5*outcolor + .5) + offsetColor * falloff;
  ----------------------

That should offset the color of the surface based on distance to nearest point from the pointcloud - at least thats what I was expecting … so far I can’t see any offset in the color.

What am I missing here?