Jump to content

beginner question


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 by Macha
  • Like 1
Link to comment
Share on other sites

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)

post-4013-128159746885_thumb.jpg

method2.hipnc

Edited by Macha
Link to comment
Share on other sites

  • 2 weeks later...

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

post-4013-128314602078_thumb.jpg

Edited by Macha
  • Like 2
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...