logix1390 Posted November 25, 2017 Share Posted November 25, 2017 Hello, I am in the middle of doing a procedural modeling tutorial:http://lesterbanks.com/2017/03/procedural-modeling-houdini/ He creates a curve and manually rays it to the terrain using vex . The code is as follows: (the curve is in the first input and the terrain mesh is in the second input) vector rayD = {0,-100,0}; vector hittP, hitUVW; i@hitPrim = intersect(1, @P, rayD, hittP, hitUVW); @P = hittP; This works perfectly Now I am trying to understand what is going on here exactly and how Houdini is solving this . I searched for the intersect function in the help and found this: int intersect(int input, vector orig, vector dir, vector p&, vector uvw&) I guess what is confusing me is the "vector p&", and "vector uvw&" above and how that related to the vectors he created "vector hittP, hitUVW" . I am still a beginner in VEX ... If anyone can help me understand this, I would really appreciate it. I will also attach my scene file for anyone that wants to take a look. Thank you! Ray_VEX.hip Quote Link to comment Share on other sites More sharing options...
acey195 Posted November 25, 2017 Share Posted November 25, 2017 for the intersect function, the last 2 parameters are output parameter you initialize them beforehand and the intersect function will overwrite them, in this case with the position, for "vector &p", where the ray hit (or the "orig" position if it did not hit anything) "vector uvw&" returns the intrinisic uv of the position on the primitive (i@hitPrim) you could use this together with the primuv() function basically whenever there is a & in a function param, thats a way the docs try to tell you its an output parameter. Hope that helps! Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 25, 2017 Share Posted November 25, 2017 https://www.sidefx.com/forum/topic/49550/#post-223800 Quote Link to comment Share on other sites More sharing options...
logix1390 Posted November 26, 2017 Author Share Posted November 26, 2017 Thanks guys, I can tell this is a very deep topic. I definitely have a better perspective on it now. 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.