Jump to content
thesoloman

Learning VOPSOP

Recommended Posts

Day 8 :

Here's an idea for the dot product, some trigonometry and our beloved sin function.

post-9757-0-12068200-1410230682_thumb.jp

Cheers,

Remi

Edited by Shinjipierre

Share this post


Link to post
Share on other sites

A little late to the party. 

Having a quick go at this one. Not used the cross product yet, just dotting the vector from P to the nearest point on the cylinder with another planar vector (1,0,0) and putting that into a sin. Looks like I'm not quite there though.

post-3273-0-30823600-1410237866_thumb.jp

Edited by wixman

Share this post


Link to post
Share on other sites

Just noticed I've written cross product instead of dot product, you don't need a cross for this, you're really close :)

Share this post


Link to post
Share on other sites

Just noticed I've written cross product instead of dot product, you don't need a cross for this, you're really close :)

Thanks! Well that's good to know - I guess it's possible to use the cross for this (?) as the length of the cross is the sin of the angle between the two vectors multiplied by their lengths

Share this post


Link to post
Share on other sites

Ok, I think I got there. 

 

(Took the arccos of my dot, then plugged that into the sin)

post-3273-0-56575600-1410241388_thumb.jp

Edited by wixman

Share this post


Link to post
Share on other sites

Shinji's tasks are so hard T_T

Sorry for taking so long to post but what I did was basically follow wixman's instructions, I would've never figured it out on my own. So I did some more messing around in Houdini to get an idea of what's actually going on. 

Anyway, here's a screenshot;

post-11810-0-97319800-1410365655_thumb.p

Share this post


Link to post
Share on other sites

Hi, I'm having some trouble figuring out how to solve shinjipierre's task. I tried to apply wixman's explanations, looking for other ways but I can't figure out what I'm doing wrong.

If someone could point me in the right track, thx a lot. Here is what I have for now:

problem_Shinpierre.hip

Share this post


Link to post
Share on other sites

edit; nvm, I tweaked a few things and it looked like it's working fine until I tried moving the cylinder. What I used instead of the PC import by index was PC Import inside of an If-then block. The rest of the network was pretty much the same as yours. Also I had to increase the Search Radius on the PC Open quite a bit ;3 

Also you should consider unhooking that N pipe from the VopSop's output. For some reason it's doing weird things , at least on my machine. 

Edited by Georgie

Share this post


Link to post
Share on other sites

I've attached an image of my network.
 

Presumably, if it's not working when you move the tube around, something is wrong with the point cloud look up. Because if it finds nothing, the lines will fan out from center (0,0,0).

What the dot product is essentially doing is comparing the two (normalized) vectors, and giving the cosine of the angle between them:

1 if they're the same direction, -1 if they're opposite direction and 0 if they're perpendicular. The arccos gives the actual angle between the two vectors in radians (from 0 to pi)

I've done this in an attribvop, which has opinputs as globals making the point cloud lookup a bit simpler.

post-3273-0-54387000-1410385038_thumb.pn

Edited by wixman

Share this post


Link to post
Share on other sites

Could someone explain me why the position of the points I try to get doesn't work using the PC import node with an if block? maybe I'm doing something wrong because he doesn't take the points of the cylinder, only the origin. Here is the modified file

Édit: you used a PC filter node, from the help, it says you get the average of the point given by the point cloud, but don't you want to get the correct position, not an average one?

problem_Shinpierre.hip

Edited by ioness
  • Like 1

Share this post


Link to post
Share on other sites

My humble try

 

DXmxvpS.jpg

 

Could you post an image of your result? This is pretty much the network I had in my first attempt - the size of my beams wasn't consistent without the arccos

Edited by wixman

Share this post


Link to post
Share on other sites

I'm glad to see I'm not the only one who failed at this :))    I tried for hours yesterday to no avail.  Not even close all i could get was a lines going parallel to the vector I dotted with and when i added the sin function I just got two parallel lines.

 

Soo then I started to mess around and did this...  Its not right barely even close unless you tweak tons of parameters, but if I mess with the number of points to return on the point cloud open node the pattern vibrates and it makes a really badass tunnel effect :)

 

tunnel.jpg

 

network.jpg

Share this post


Link to post
Share on other sites

I'm glad to see I'm not the only one who failed at this :))    I tried for hours yesterday to no avail.  Not even close all i could get was a lines going parallel to the vector I dotted with and when i added the sin function I just got two parallel lines.

 

Soo then I started to mess around and did this...  Its not right barely even close unless you tweak tons of parameters, but if I mess with the number of points to return on the point cloud open node the pattern vibrates and it makes a really badass tunnel effect :)

 

 

Hey Captain - to be honest, the only thing that looks out of the ordinary here is the nearpt/getattrib here. We just need a vector from our current position (P) to the nearest point on the cylinder.

Also, use the 'trigonometric functions' node for the sin - the key here is to crank up the frequency to increase the number of beams. 

Share this post


Link to post
Share on other sites

oooooooohhhhhhhhhhhhhhhhh    that makes sense, I couldn't figure out why I could only get blocks instead of a radial pattern.  I think near point works better then a point cloud in this instance, though subtracting the both of them just makes a cool wiggling effect :)  

 

Thanks for the explanation of the math, this makes a lot more sense to me now.

Share this post


Link to post
Share on other sites

 I think near point works better then a point cloud in this instance

 

It does! - getting a cook of 13.51ms with the nearpt setup vs a cook of 18.40ms with pcopen.

Good to know!

Edited by wixman

Share this post


Link to post
Share on other sites

Point cloud gets all the points in the search radius and returns a weighted result of all the points, near point just gets the nearest point. :)

 

I'm pretty sure pcopen stops once it reaches the set number of points, in this case I had it set to 1. 

Share this post


Link to post
Share on other sites

Yes sorry ,I was referring to whole set up, pc filter weights the points, even if its just one point it may still weight it or at minimum it has to test it if its just one point. Then return it.

Edited by captain

Share this post


Link to post
Share on other sites

Okay here's one for Day 9:

 

Using the intersect vop create shadows from a mesh onto a grid.  Extra credit for making it a soft shadow( you can use a second vopsop for this)

 

 

mountain_Range.jpg

 

Roberts example is better you should stride to it like that |

                                                                                         \/

Edited by captain

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

×