Jump to content
Sign in to follow this  

Point cloud troubles

Recommended Posts

Can anyone see what is wrong with this bit of code?

I think I'm missing something blindingly obvious but I can't see it.

It actually seems to work but when I put it on an animated object the results seem to vary radically from frame to frame, I just can't see why.

#define PI 3.1415926535897932

float shadows(string pcmap;int nfp;float rad,samt;int back)
   vector mapP;
   float w,occ;
   int test,pn;
   string channel = "S";
   vector pp = wo_space(P);
   int handle = pcopen(pcmap, "P", pp, rad, nfp);

   while (pcunshaded(handle,channel)) {
      pcimport(handle, "P", mapP);
      pcimport(handle, "width", w);
      float shad = 0;
      int lc = 0;
      if (back) {
          illuminance(ow_space(mapP),N,PI) {
            if (rayhittest(ow_space(mapP),L,w+0.05)>0) shad++;
            //if (fastshadow(ow_space(mapP),L,w+0.05)==0) shad++;
            lc ++;
      else {
          illuminance(ow_space(mapP)) {
            if (rayhittest(ow_space(mapP),L,w+0.05)>0) shad++;
            lc ++;
      occ = 1-shad/lc*samt;
      test = pcexport(handle, channel, occ);

    shad = pcfilter(handle,channel);


    return shad;

	string   pcmap  = "";    // pointcloud file
	float    samt   = 0.5;
	int      snfp   = 50;
	float    srad   = 10;
	int  doback = 1;
	Cf  = shadows(pcmap,snfp,srad,samt,doback);

Doh! figured it out, it's just the bias value too high.

Edited by sibarrick

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this