magneto Posted January 15, 2015 Share Posted January 15, 2015 (edited) Hi, I was watching Peter Quint's tutorial on using point clouds in shaders but I am having weird results. Even the original files do not render correctly unfortunately. I fixed some issues regarding orientation and rendering the files to disk but still no white patches as shown in the video: http://vimeo.com/9108284 This is what I am getting: I attached my simple file. You have to render the point cloud first as the forum doesn't allow me to attach that. I know how to use point clouds but never used them in a shader, and this tutorial is for H10, so I assume some major renderer, shader change have happened that causes the results I am seeing? Thanks pcloud_shader.hip Edited January 15, 2015 by magneto Quote Link to comment Share on other sites More sharing options...
iamyog Posted January 15, 2015 Share Posted January 15, 2015 I think you just need to carry on the tutorial from around the minute 17, he explains that by using a VOPSOP rather than direct VEX code, there are some difficulties to set the order in which the code will be executed, and that you are actually calling a pciterate before you are using the value you want to use, resulting in out of index data at the end of the point cloud (pciterate move the pointer to the next point as soon as it is called). He also explains how you can cheat that by introducing a dummy switch node. I just tested it to confirm it was that, by doing so and reducing the search radius, you'll get your expected result. 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted January 15, 2015 Author Share Posted January 15, 2015 Thanks I actually saw that part but thought this dummy tricky was not necessary. I will try what you suggested but shouldn't one be able to do the same by using pcnumfound?I thought that was more elegant. Will report back with results Quote Link to comment Share on other sites More sharing options...
magneto Posted January 15, 2015 Author Share Posted January 15, 2015 (edited) Thanks you are right. It works. I also got it working with pcnumfound which also required the switch trick. I didn't realize you couldn't order operations otherwise. Is there a better way to do this? Lastly I don't understand how In Peter's example he iterates outside the while loop first and then imports P. Shouldn't he first import P out of pcopen and then at the end do a pciterate? Because in his example it looks like this: success = pciterate while success import(P) success = pciterate Mine looks like this: success = pcnumfound while success import(P) success = pciterate Am I missing something? Using point clouds in VOPs is not as intuitive as in code Thanks. Edited January 15, 2015 by magneto Quote Link to comment Share on other sites More sharing options...
iamyog Posted January 15, 2015 Share Posted January 15, 2015 (edited) I'm not following the tuto but I quickly scrubed through the timeline and I think he is only using pciterate as a test to trigger the while loop, the same way you are using pcnumfound. With pcnumfound you get a positive result if there are point within your search radius, since it's a non-zero result, you satisfy the condition of the while loop and execute its code : loop through all the points, etc etc Peter get the same positive result to trigger the execution of the while loop, but inside the loop, he is reusing the original handle, where the pointer had not been moved due to the call to pciterate. I might be wrong but this is how I understand it with a quick look. edit: typo Edited January 15, 2015 by iamyog 1 Quote Link to comment Share on other sites More sharing options...
fathom Posted January 25, 2015 Share Posted January 25, 2015 it's a lot easier to just do: while (pciterate(handle)) { pcimport stuff } no need to check pcnumfound or anything... and iamyog is right, you can't use pcimport functions without first calling pciterate. i wouldn't be surprised if there was an error message on your console about this. Quote Link to comment Share on other sites More sharing options...
Peter Quint Posted February 5, 2015 Share Posted February 5, 2015 A belated reply. Since that tutorial was recorded, the new Point Cloud Import by Index VOP node has been added. This allows you to use a for loop instead of a PC iterate, and thus avoid the ordering problem discussed above. You can use PC numfound to determine the range of the for loop. Peter 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.