nkyms Posted December 12, 2020 Share Posted December 12, 2020 (edited) Hello, Houdini beginner here, I am looking for a solution to project geometry from a given single point (labelled as the green dot in the diagram, just above the mid point of the sphere) to y=0 to make a semisphere. The point is to have a flat ground without deformations and changes to the UV projection while a camera is positioned at the given point. So say you had a panoramamic image/video applied to the semisphere, it would look undistorted when viewing from this given point. Thanks in advance! Edited December 12, 2020 by nkyms Quote Link to comment Share on other sites More sharing options...
animatrix Posted December 12, 2020 Share Posted December 12, 2020 Hi, You mean like this? Then you can just use this inside a Point Wrangle SOP: if ( @P.y < 0 ) @P.y = 0; if ( @P.y < 0 ) @P.y = 0; Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 12, 2020 Author Share Posted December 12, 2020 Thanks for the reply. No, the shape is close to what is intended but what I'd like to do is bring the points in towards the middle. In theory I need each point below y=0 to move towards 0,0,0 (or a given point) until it hits the y axis. 14 minutes ago, animatrix said: Hi, You mean like this? Then you can just use this inside a Point Wrangle SOP: if ( @P.y < 0 ) @P.y = 0; if ( @P.y < 0 ) @P.y = 0; Quote Link to comment Share on other sites More sharing options...
animatrix Posted December 12, 2020 Share Posted December 12, 2020 Like this? if ( @P.y < 0 ) @P = 0; Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 12, 2020 Author Share Posted December 12, 2020 (edited) No, let me reword this. I'd like to move each point below the y-axis towards the middle until it reaches the y axis. Meaning the points will not come to a single point. And when viewing from the middle point, each point will still be at the same angle. I'd use the ray node, but this only allows for a vector direction. Edited December 12, 2020 by nkyms Quote Link to comment Share on other sites More sharing options...
Librarian Posted December 12, 2020 Share Posted December 12, 2020 You can Use Clip Sop with Stereo Projection ON any Given Point Or Geo.Have Fun ..You Have Those Methods Here ON OdFroce Investigate Link 1 Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 12, 2020 Author Share Posted December 12, 2020 I am aware of Clip Sop however I don't recall there being a Stereo Projection functionality. Could you elaborate on this method? I've had a search around on the forums, but I still can't find a solution. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
animatrix Posted December 12, 2020 Share Posted December 12, 2020 1 Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 12, 2020 Author Share Posted December 12, 2020 27 minutes ago, animatrix said: Thanks for the help so far. By bringing the points towards the middle of the initial sphere they should hit the bottom of the semisphere along the x,z plane, sorry I think I confused you by saying y-axis. The first image you sent is the closest, but the angles of each point viewed from the center are changed. I need each point to be the same angle and projected to the lower base of the semi-circle. Quote Link to comment Share on other sites More sharing options...
animatrix Posted December 12, 2020 Share Posted December 12, 2020 I see yes this can be done using Ray Plane intersection analytically without creating a plane geometry. I will post an example when i get home. Quote Link to comment Share on other sites More sharing options...
Librarian Posted December 12, 2020 Share Posted December 12, 2020 v@rayDir = {0, -1, 0}; Ray.hiplc Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted December 12, 2020 Share Posted December 12, 2020 Inside view / Outside view: hemisphere.hipnc 1 Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted December 12, 2020 Share Posted December 12, 2020 Same result along with greetings from stack overflow: string cam = chs('camera'); matrix xform_cam = optransform(cam); vector pos_cam = cracktransform(0,0,0,0,0, xform_cam); vector pos_plane = {0,0,0}; vector nml_plane = {0,1,0}; vector dir_line = normalize(v@P - pos_cam); float scale = dot(nml_plane, pos_plane) - dot(nml_plane, pos_cam) / dot(nml_plane, dir_line); v@P = pos_cam + dir_line * scale; hemisphere_calc.hipnc 2 1 Quote Link to comment Share on other sites More sharing options...
Noobini Posted December 12, 2020 Share Posted December 12, 2020 i don't know if the effect is same as: - Point SOP - preset Flatten Bottom - adjust to whatever level you like (max half way), doesn't have to be exact hemisphere, animatable. Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 13, 2020 Author Share Posted December 13, 2020 14 hours ago, konstantin magnus said: Same result along with greetings from stack overflow: string cam = chs('camera'); matrix xform_cam = optransform(cam); vector pos_cam = cracktransform(0,0,0,0,0, xform_cam); vector pos_plane = {0,0,0}; vector nml_plane = {0,1,0}; vector dir_line = normalize(v@P - pos_cam); float scale = dot(nml_plane, pos_plane) - dot(nml_plane, pos_cam) / dot(nml_plane, dir_line); v@P = pos_cam + dir_line * scale; hemisphere_calc.hipnc Thanks for the solution. This did the trick. I still don't really understand what is happening fully in the expression, but I'll have a shot. Quote Link to comment Share on other sites More sharing options...
animatrix Posted December 13, 2020 Share Posted December 13, 2020 (edited) You can also use something like this which is similar to Konstantin's approach: vector linePlaneIntersection ( vector raypos, raydir, planepos, planedir ) { vector diff = raypos - planepos; vector d = dot ( diff, planedir ) / dot ( raydir, planedir ); return raypos - raydir * d; } if ( @P.y < 0 ) { vector n = normalize ( chv("p") - @P ); vector p = linePlaneIntersection ( @P, n, 0, { 0, 1, 0 } ); @P = p; } Depending on the P parameter, the result will change, so make sure to set it to non 0, 0, 0. Otherwise all bottom points will intersect at 0, 0, 0. Here I use 0, 0.3, 0: Edited December 13, 2020 by animatrix 2 Quote Link to comment Share on other sites More sharing options...
nkyms Posted December 13, 2020 Author Share Posted December 13, 2020 (edited) 10 hours ago, animatrix said: You can also use something like this which is similar to Konstantin's approach: vector linePlaneIntersection ( vector raypos, raydir, planepos, planedir ) { vector diff = raypos - planepos; vector d = dot ( diff, planedir ) / dot ( raydir, planedir ); return raypos - raydir * d; } if ( @P.y < 0 ) { vector n = normalize ( chv("p") - @P ); vector p = linePlaneIntersection ( @P, n, 0, { 0, 1, 0 } ); @P = p; } Depending on the P parameter, the result will change, so make sure to set it to non 0, 0, 0. Otherwise all bottom points will intersect at 0, 0, 0. Here I use 0, 0.3, 0: Thanks, this works well. I'll have a look at your solution too. Edited December 13, 2020 by nkyms 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.