resonanz Posted August 7, 2010 Share Posted August 7, 2010 Hi all! After fiddling around for hours without any progress I thought it would be better to ask: Let´s suppose I have some geometry and a single point. how can I project the geometry on an arbitrary plane using vops, similar to camera projections? I know it has something to do with matrix math but I cannot find the solution. thanks. project_to_plane.hipnc Quote Link to comment Share on other sites More sharing options...
mawi Posted August 7, 2010 Share Posted August 7, 2010 Hi all! After fiddling around for hours without any progress I thought it would be better to ask: Let´s suppose I have some geometry and a single point. how can I project the geometry on an arbitrary plane using vops, similar to camera projections? I know it has something to do with matrix math but I cannot find the solution. thanks. If I get you right you are looking for the ray-sop. Quote Link to comment Share on other sites More sharing options...
resonanz Posted August 7, 2010 Author Share Posted August 7, 2010 Thank you Mawi for the reply but I am looking for a way to do the computation in VOPS. If i understand the math correctly I need homogeneous coordinates to perform the calculation but I have no idea how to do it practically. Quote Link to comment Share on other sites More sharing options...
Macha Posted August 8, 2010 Share Posted August 8, 2010 (edited) I haven't done it myself but I think you would have to convert this into vops: http://en.wikipedia.org/wiki/3D_projection#Perspective_projection It seems like a lot of fiddly work but should be possible. Perhaps if I have time I will have a go at it. Edited August 8, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
mawi Posted August 8, 2010 Share Posted August 8, 2010 Thank you Mawi for the reply but I am looking for a way to do the computation in VOPS. If i understand the math correctly I need homogeneous coordinates to perform the calculation but I have no idea how to do it practically. If you dont want to use the intersect-VOP, it´s out of my knowledge. Quote Link to comment Share on other sites More sharing options...
Macha Posted August 9, 2010 Share Posted August 9, 2010 (edited) I think this works but I haven't tested it fully. It doesn't use homogenous coordinates though. It's a slightly more standard setup, but still very low level. Red lines are the projections onto the arbitrary plane. untitled.hipnc Edited August 9, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted August 9, 2010 Share Posted August 9, 2010 Screen and video for anybody interested. (Most of the red projection vectors were deleted for better display) Quote Link to comment Share on other sites More sharing options...
resonanz Posted August 11, 2010 Author Share Posted August 11, 2010 Thank you very much Mawi and Macha!! Both solution you have provided works great but they do not really fit my needs. I should have been more precise with my question, sorry about that. Let me explain the problem as a whole. The reason why i would like to solve the problem by using Homogeneous Coordinates are simple. Its all about SPEED!. I have some GEO with very high polycount (around 60000) from Maya. Now i must compute the 2D projection of this geometry on a plane that: 1. Sit on every point of the same Geo 2. Direction of projection goes from Eye-point through every point of the Geo After that i need the vector-sum of the projected geometry as an attribute for later use. I have tried to do this with the Ray-SOP and an Foreach-SOP but looping though all the points in SOPs its far to slow. When i use the Intersect-VOP I have the same problem because I still need the projection plane and therefore the Foreach-SOP or COPY-SOP. As far as i know Homogeneous Coordinates do not need a plane for the actual projection and that is the main reason why I want to use them. Macha, your solution is quite interesting but if i understand the Node Network it works quite similar to the Intersect-VOP mentioned by Mawi and again I need geometry to project onto. For better understanding I have attached the file I´m working with. Thank´s again!!! project_test.hipnc Quote Link to comment Share on other sites More sharing options...
Macha Posted August 11, 2010 Share Posted August 11, 2010 (edited) When you project the geometry, does it have to project towards a point (like a camera?) or would it be sufficient if you were to project just straight and perpendicular to the plane. If the latter is true then the fastest way I can think of would perhaps be to change the base frame and so it aligns with the plane's frame and set one axis scale to zero. To be honest I am not sure homogenous coordinates will be much faster... If you look at my example there's only a few dot products in there and it only grabs two vectors to define the plane, the same two for all points in the calculation. Compare that to a bunch of 4*4 matrices... I am sure the Houdini nodes made for this thing, intersect, etc, are quite good at what they do, probably even using homogenous coordinates. How fast do you need it to be? Otherwise, perhaps you could pipe this through a graphics card but that is beyond my capabilities. Edit: In my previous file, get rid of all the attributes, and there should be a nicer way to get at the 2 plane defining vectors. It should then multithread and be much faster. Edited August 11, 2010 by Macha 1 Quote Link to comment Share on other sites More sharing options...
petz Posted August 11, 2010 Share Posted August 11, 2010 i´m not sure if i get what you are after but if speed is an issue i wouldn´t use homogeneous coordinates since this seems a bit overstated in your case. attached is a example using simple trigonometry to do the projection. should be fairly fast. petz project_test1.hipnc 1 Quote Link to comment Share on other sites More sharing options...
Macha Posted August 12, 2010 Share Posted August 12, 2010 (edited) I tried a teapot with 62000 points on my vopsop and it projects during playback without much stuttering (on a P4). Surely that's not so bad? Edited August 12, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted August 12, 2010 Share Posted August 12, 2010 (edited) Here is another method I tried. It is very rough, and I struggle to understand it properly, so forgive the shortcomings. The idea is to change the points' expression in terms of base coordinates with a tensor and scale along one of the new axes and then express those new coordinates in the original bases. The 3 colored orthogonal lines are the new base vectors (the frame of your "plane"). Use the parameters on the vopsop1 to scale. Use the red attribute node to set angles. The interesting (if useless?) trivia here is that you can use a skew angular base if you change the vopsop2 parameters. (perhaps this can be used to make a projection that is not perpendicular to the plane -perspective instead- but I haven't figured out how to control it) method2.hipnc Edited August 12, 2010 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted August 12, 2010 Share Posted August 12, 2010 Sorry, I think the previous file was wrongly wired because I scaled rows instead of columns... this should be better...argh...it's so confusing... method2a.hipnc Quote Link to comment Share on other sites More sharing options...
resonanz Posted August 15, 2010 Author Share Posted August 15, 2010 Thank you so much Macha and Petz!!! Petz: That is exactly what I was looking for. And it´s more than fast enough for my needs. Macha: Thanks for your on-going interest in this topic and all your files you have provided. Thanks again, guys! Quote Link to comment Share on other sites More sharing options...
Macha Posted August 30, 2010 Share Posted August 30, 2010 (edited) If anyone is still interested in this or needs it for future reference... I have updated that last file with a more streamlined version. If the second bases are unit vectors the direction cosines are simply dot products. tensor.hipnc Edited August 30, 2010 by Macha 2 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.